argoproj / argo-cd

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

Empty value skipped from Application Parameters to Helm Chart #6303

Open mssanjay opened 3 years ago

mssanjay commented 3 years ago

Hi, I have Argocd 1.8.7 installed. I am observing that EMPTY object from my Helm chart values.yaml is skipped as input parameters. I need to pass EMPTY value as below

resources: {}

when I do this, ArgoCD skips the input to Helm Chart from values.yaml

Expected: resources: {} passed to Helm Chart

Thanks Sanjay

maratsal commented 2 years ago

We got the same issue when we are trying to pass empty value (null) argo cd strips it out from application definition.

desired application code:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  labels:
    app.kubernetes.io/instance: root-application
  name: sealed-secrets
  namespace: argocd
spec:
  destination:
    namespace: sealed-secrets
    server: https://kubernetes.default.svc
  project: cluster-config-project
  source:
    chart: sealed-secrets
    helm:
      parameters:
      - name: metrics.serviceMonitor.enabled
        value: "true"
      - name: namespace
        value: sealed-secrets
      - name: metrics.serviceMonitor.enabled
        value: "true"
      - name: namespace
        value: sealed-secrets
      - name: containerSecurityContext.runAsUser
        value:
      - name: podSecurityContext.fsGroup
        value:
    repoURL: https://bitnami-labs.github.io/sealed-secrets
    targetRevision: 2.1.2
  syncPolicy:
    retry:
      backoff:
        duration: 5m
        factor: 1
        maxDuration: 5m
      limit: 3
    syncOptions:
    - CreateNamespace=true

but instead we receive following application code and it breaks helm chart generation as argo cd is replacing empty value (null) with empty string ('').

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  labels:
    app.kubernetes.io/instance: root-application
  name: sealed-secrets
  namespace: argocd
spec:
  destination:
    namespace: sealed-secrets
    server: https://kubernetes.default.svc
  project: cluster-config-project
  source:
    chart: sealed-secrets
    helm:
      parameters:
      - name: metrics.serviceMonitor.enabled
        value: "true"
      - name: namespace
        value: sealed-secrets
      - name: metrics.serviceMonitor.enabled
        value: "true"
      - name: namespace
        value: sealed-secrets
      - name: containerSecurityContext.runAsUser
      - name: podSecurityContext.fsGroup
    repoURL: https://bitnami-labs.github.io/sealed-secrets
    targetRevision: 2.1.2
  syncPolicy:
    retry:
      backoff:
        duration: 5m
        factor: 1
        maxDuration: 5m
      limit: 3
    syncOptions:
    - CreateNamespace=true
shinkle-procore commented 2 years ago

We are running into the same problem. Any idea when this might be resolved?

For example, a config block of:

hostmetrics:
  scrapers:
    cpu:
    filesystem:
    disk:

Gets incorrectly squashed down into:

hostmetrics:
  scrapers: {}
alexminder commented 2 years ago

For me it works using values:

spec:
    source:
      helm:
        parameters:
...
        values: |-
          ABC:
            securityContext:
              runAsUser: null
from-nibly commented 2 years ago

Same issue. Any news? this is breaking a helm chart for us.

sebdevaux commented 1 year ago

Hello, same issue. Any news or work around?

alex-souslik-hs commented 1 year ago

@sebdevaux

helm:
   parameters:
      - name: podSecurityContext.fsGroup
        value: "null"