argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.47k stars 5.32k forks source link

YAML literal blocks changing into folded blocks in Argo UI rendering #12173

Open lanmarti opened 1 year ago

lanmarti commented 1 year ago

Discussed in https://github.com/argoproj/argo-cd/discussions/10977

Originally posted by **lanmarti** October 17, 2022 Hi, I've got a few configmaps of which the YAMLs are defined using literal blocks, e.g.: ``` apiVersion: v1 data: multi-line.conf: | foo bar kind: ConfigMap metadata: name: data-map ``` When I dryrun these through kubectl, or use them as resources in kustomize, the configmaps are unmodified. However, if I let ArgoCD track these configmaps as part of an application, the manifests sometimes change the literal blocks into folded blocks with newlines inbetween the actual lines, like so: ``` apiVersion: v1 data: multi-line.conf: > foo bar kind: ConfigMap metadata: name: data-map ``` There can be multiple entries in a single configmap, and some of them might get changed to folded blocks while others remain as literal blocks. I haven't been able to figure out the trigger. I'm not sure the problem lies with ArgoCD and I haven't had the time to properly test whether the content of the field matters. I've done a quick search, but didn't really find anything like what I'm seeing. Has anyone experienced this, or are there any suggestions on what tool in the chain might be causing this? ``` kubectl version Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.0", GitCommit:"ab69524f795c42094a6630298ff53f3c3ebab7f4", GitTreeState:"clean", BuildDate:"2021-12-07T18:16:20Z", GoVersion:"go1.17.3", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.8-gke.1900", GitCommit:"79209257257c051b27df67c567755783eda93353", GitTreeState:"clean", BuildDate:"2022-07-15T09:23:51Z", GoVersion:"go1.17.11b7", Compiler:"gc", Platform:"linux/amd64"} kustomize version {Version:kustomize/v4.5.7 GitCommit:56d82a8378dfc8dc3b3b1085e5a6e67b82966bd7 BuildDate:2022-08-02T16:35:54Z GoOs:linux GoArch:amd64} ``` ArgoCD: v2.5.0+b00d9b7
Kerwood commented 1 year ago

This is a very annoying issues, would love to see this fixed :)

lanmarti commented 1 year ago

I've found that the issue might simple be a combination of factors on my side, and might not be a real issue at all.

On the one hand I had ConfigMaps containing one or more spaces before newlines (e.g. This is an example \nof a literal block that would be changed vs This is an example\nof a literal block that would be fine), which caused literal blocks to be changed to folded blocks both locally and through ArgoCD.

On the other hand, ConfigMaps with long lines are broken up in the ArgoCD UI, and are displayed using folded blocks, but when retrieving the ConfigMap through kubectl, the data is still defined in literal blocks as intended.

@Kerwood if possible, could you check if you are encountering either of the above scenarios? If not could you provide an example ConfigMap so I can use that to test?

I still have to verify more thoroughly myself, but from a few quick tests, any inconsistencies between literal blocks defined in the manifest in git and folded blocks displayed through ArgoCD UI seem to be one of the above 2 scenarios for me.

todaywasawesome commented 1 year ago

We might at least count that as a bug in the UI where it renders improperly. Literals are hard.

0xF0D0 commented 1 year ago

this happens on v2.7.8+92949f6.dirty too

villisco commented 11 months ago

Still happening on v2.8.4 also. ArgoCD converts "|" to ">" or "|-"

bradmorgtile commented 5 months ago

Still happening in v2.9.7. | will get converted to > if there is a line that is a certain number of characters long.

zebesh commented 5 months ago

I have same problem. I have annotations:

      vault.hashicorp.com/agent-inject-template-default-admin-password: |
        {{- with secret "secret/data/infrastructure/airflow//airflow-secret-default-admin-password" -}}
        export AIRFLOW_DEFAULT_USER_PASSWORD="{{ .Data.data.default-admin-password }}"
        {{- end }}

and argocd change it to:

        vault.hashicorp.com/agent-inject-template-default-admin-password: >
          {{- with secret
          "secret/data/infrastructure/airflow//airflow-secret-default-admin-password"
          -}}\n export AIRFLOW_DEFAULT_USER_PASSWORD="{{
          .Data.data.default-admin-password }}"\n {{- end }}

after that nothing works