Search code examples
devopsargocd

is there a way in argocd that i can take values.yaml dymically in application sets?


is there a way in argocd that i can take values.yaml dymically on namespace in application sets for example

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: xxxx-application-set
  namespace: argocd
spec:
  generators:
  - list:
      elements:
      - namespace: namespace1
      - namespace: namespace2
      - namespace: namespace3
  template:      
    metadata:
      name: '{{namespace}}-test'
    spec:
      project: default


      source:
        repoURL: XXXX.git
        targetRevision: HEAD
        path: xxxx
        helm:
        valueFiles:
          - 'values-{{namespace}}'.yaml   

cusomtize the values for each namespace as required


Solution

  • It looks good actually what you did there but I would try with

    valueFiles:
      - "values-{{namespace}}.yaml" 
    

    I guess this should work.

    Or you can try this:

    apiVersion: argoproj.io/v1alpha1
    kind: ApplicationSet
    metadata:
      name: xxxx-application-set
      namespace: argocd
    spec:
      generators:
      - list:
          elements:
          - namespace: namespace1
            valuesfile: namespace1_values.yaml
          - namespace: namespace2
            valuesfile: namespace2_values.yaml
          - namespace: namespace3
            valuesfile: namespace3_values.yaml
      template:      
        metadata:
          name: '{{namespace}}-test'
        spec:
          project: default
          source:
            repoURL: XXXX.git
            targetRevision: HEAD
            path: xxxx
            helm:
            valueFiles:
              - $valuesfile #or "{{valuesfile}} 
    

    As you can see in this page you can use build environment variables for the Helm values file path.

    Helm Docu