kubernetesargocd

How do I use values file from a private repo to be used to install a helm chart from a public repo


I have a scenario where I want to create an argoCD application - Nginx-ingress - using it official helm chart. But in the valueFiles field, I want to source from my own private repository. This is what I've tried

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: nginx-ingress-app
  namespace: argocd
spec:
  project: default
  source:
    repoURL: 'https://kubernetes.github.io/ingress-nginx'
    targetRevision: main 
    chart: ingress-nginx
    helm:
      releaseName: nginx-ingress
      valueFiles:
        - https://raw.githubusercontent.com/<org>/<repo>/main/helm-charts/nginx-ingress/values.yaml
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: nginx-ingress
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

but this gives 404 error. probably due to access issue. But I have added that repo to argocd.

How can I do that. Thank you all


Solution

  • Both repositories should be in the sources, and then by $values, we try to select the values for the chart:

    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: nginx-ingress-app
      namespace: argocd
    spec:
      project: default
      sources:
      - repoURL: 'https://kubernetes.github.io/ingress-nginx'
        targetRevision: main 
        chart: ingress-nginx
        helm:
          releaseName: nginx-ingress
          valueFiles:
            - $values/charts/nginx-ingress/values.yaml # $values is the root of value files repository
      - repoURL: 'https://github.com/<org>/<repo>'
        targetRevision: main # replaced with the branch
        ref: values # The reference to be used above
      destination:
        server: 'https://kubernetes.default.svc'
        namespace: nginx-ingress
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true
    

    This is called Multiple Sources for an Application. For the permission part, if you can git clone the repository, it is enough. To do so, you need github ssh authentication.