argoproj / argo-cd

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

multiple valueFiles does not work #18246

Closed envy16 closed 1 week ago

envy16 commented 2 weeks ago

Checklist:

Describe the bug

i have argo Application yaml:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: example
  namespace: gitops
spec:
  destination:
    namespace: some-ns
    server: 'https://kubernetes.default.svc'
  syncPolicy:
    automated:
      selfHeal: true
      prune: true
    syncOptions:
      - CreateNamespace=true
  project: myproj
  sources:
    - chart: common-app
      repoURL: 'https://artifactory.example.com/artifactory/common-helm-temp/'
      targetRevision: 0.6.3-rc-2
      helm:
        passCredentials: true
        releaseName: wp-api
        valueFiles:
          - $anltcs/anltcs-dev/wp-api.yaml
          - $anltcs/feature-flow/wp-api.yaml
        valuesObject:
          namespace: some-ns
          image:
            tag: latest
    - repoURL: 'https://git.example.com/common-templates/values-templates/analytics.git'
        targetRevision: WP-4506
        ref: anltcs

$anltcs/anltcs-dev/wp-api.yaml (yes, PGHOST is commented) :

app:
  env:
    #PGHOST:  postgresql.example.com
    POSTGRES_DB: dev_wpapi

$anltcs/feature-flow/wp-api.yaml:

app:
  env:
    PGHOST: postgresql
    POSTGRES_DB: feat_wpapi

Values from secondary file not applied, i get "POSTGRES_DB: dev_wpapi" inside my pod from Deployment, and completely missing PGHOST env.

If i change order like:

valueFiles:
    - $anltcs/feature-flow/wp-api.yaml
    - $anltcs/anltcs-dev/wp-api.yaml

i will get env inside pod "PGHOST: postgresql", but will be same "POSTGRES_DB: dev_wpapi" env.

To Reproduce

Expected behavior

Argo should use values Files precedence like in documentation (lower file have higher precedense) and get env:

app:
  env:
    PGHOST: postgresql
    POSTGRES_DB: feat_wpapi

while i use this order:

valueFiles:
          - $anltcs/anltcs-dev/wp-api.yaml
          - $anltcs/feature-flow/wp-api.yaml

Screenshots

Version

{
    "Version": "v2.10.2+fcf5d8c",
    "BuildDate": "2024-03-01T21:24:51Z",
    "GitCommit": "fcf5d8c2381b68ab1621b90be63913b12cca2eb7",
    "GitTreeState": "clean",
    "GoVersion": "go1.21.3",
    "Compiler": "gc",
    "Platform": "linux/amd64",
    "KustomizeVersion": "v5.2.1 2023-10-19T20:13:51Z",
    "HelmVersion": "v3.14.2+gc309b6f",
    "KubectlVersion": "v0.26.11",
    "JsonnetVersion": "v0.20.0"
}

Logs

Paste any relevant application logs here.
envy16 commented 1 week ago

The reason for the non-standard behavior of merging multiple helm values files was a plugin helm-secrets https://github.com/jkroepke/helm-secrets