argoproj / argo-cd

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

Block Scaler issue with spec.source.helm.parameters.name values longer then 70 chars ArgoCD v2.4.10 #10433

Open zaal-io opened 2 years ago

zaal-io commented 2 years ago

Describe the bug

When providing an ArgoCD Application for deploying a Helm chart, I also specify overriding values with spec.source.helm.parameters. But when the name of the parameter extends 70 chars it transforms into a block scaler. Normally this would not be a direct issue, but it actually does for a specific one: Providing an annotation for a Service of type LoadBalancer for deploying an Azure internal loadbalancer. It expect to see the following annotation before deploying the Azure internal loadbalancer:

service.beta.kubernetes.io/azure-load-balancer-internal: 'true'

Because of the transformation to a block scaler the end result in the live manifest for the service will be:

service: >-
      map[beta:map[kubernetes:map[io/azure-load-balancer-internal:true]]]

And this will not trigger the deployment of an Azure internal loadbalancer, which will cause the deployment to fail.

To Reproduce

Deploy the following ArgoCD application

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: nginx-ingress
  namespace: argocd
spec:
  project: default
  source:
    repoURL: 'https://kubernetes.github.io/ingress-nginx'
    targetRevision: 4.1.1
    chart: ingress-nginx
    helm:
      parameters:
        - name: controller.service.annotations.service.beta.kubernetes.io/azure-load-balancer-internal
          value: 'true'
  destination:
    server: https://kubernetes.default.svc
    namespace: ingress-nginx
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
    automated:
      selfHeal: true
      prune: false

Expected behavior

I expect to get the following end result in the live manifest:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: 'true'
  name: nginx-ingress-ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: LoadBalancer

But the actual end result in the live manifest is:

apiVersion: v1
kind: Service
metadata:
  annotations:
    service: >-
      map[beta:map[kubernetes:map[io/azure-load-balancer-internal:true]]]
  name: nginx-ingress-ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: LoadBalancer
zaal-io commented 1 year ago

This issue is still valid with the latest version of ArgoCD 2.7.1.