Search code examples
kuberneteskubernetes-helmargocdgitops

ArgoCD Helm files from remote sources


I have this argo application :

project: myproject
    destination:
      server: 'https://kubernetes.default.svc'
      namespace: myns
    syncPolicy:
      automated:
        prune: true
      syncOptions:
        - CreateNamespace=true
    sources:
      - repoURL: >-
          https://gitlab.com/myrepos/helm-repo.git
        path: helm
        targetRevision: HEAD
        helm:
          valueFiles:
            - $values/mocks/values.yaml
      - repoURL: >-
          https://gitlab.com/myrepos/values-repo.git
        targetRevision: HEAD
        ref: values

This is my values file:

mocks:
  projectName: "soapui-project"

this works fine and I am able to set the values from a remote repo as long as my xml file is in the same repo as my helm chart.

This is a template from my chart, it's a kubernetes configmap:

{{ $projectFile := printf "%s.xml" .Values.mocks.projectName  }}
{{ $projectName := .Values.mocks.projectName  }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: "{{ $projectName | lower }}"
data:
{{ ($.Files.Glob $projectFile).AsConfig | indent 1 }}

My problem/question:

Can I read the file contents if the file is not in the same repo as the helm chart, let's say my xml file is in my values repo and pass it's content to the data of the config map?

I am expecting to be able to put my xml soapui file in a distant repo and pass it's content to my argo app's helm chart the same way I pass values from another repo to my argo App


Solution

  • No, you cannot. The $values feature is very specific to sharing the values file, not arbitrary config files.

    This PR intends to implement the more general feature you need: https://github.com/argoproj/argo-cd/pull/12508