Search code examples
kubernetes-helmargocd

ArgoCD Helm chart - Repository not accessible


I'm trying to add a helm chart (https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack) to ArgoCD.

When I do this, I get the following error:

Unable to save changes: application spec is invalid: InvalidSpecError: repository not accessible: repository not found

Can you guys help me out please? I think I did everything right but it seems something's wrong...

Here's the Project yaml.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: prom-oper
  namespace: argocd
spec:
  project: prom-oper

  source:
    repoURL: https://prometheus-community.github.io/helm-charts
    targetRevision: "13.2.1"
    path: prometheus-community/kube-prometheus-stack

    helm:
      # Release name override (defaults to application name)
      releaseName: prom-oper
      version: v3
      values: |
        ... redacted

    directory:
      recurse: false


  destination:
    server: https://kubernetes.default.svc
    namespace: prom-oper

  syncPolicy:
    automated: # automated sync by default retries failed attempts 5 times with following delays between attempts ( 5s, 10s, 20s, 40s, 80s ); retry controlled using `retry` field.
      prune: false # Specifies if resources should be pruned during auto-syncing ( false by default ).
      selfHeal: false # Specifies if partial app sync should be executed when resources are changed only in target Kubernetes cluster and no git change detected ( false by default ).
      allowEmpty: false # Allows deleting all application resources during automatic syncing ( false by default ).
    syncOptions:     # Sync options which modifies sync behavior
    - CreateNamespace=true # Namespace Auto-Creation ensures that namespace specified as the application destination exists in the destination cluster.
    # The retry feature is available since v1.7
    retry:
      limit: 5 # number of failed sync attempt retries; unlimited number of attempts if less than 0
      backoff:
        duration: 5s # the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h")
        factor: 2 # a factor to multiply the base duration after each failed retry
        maxDuration: 3m # the maximum amount of time allowed for the backoff strategy

and also the configmap where I added the helm repo

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
  name: argocd-cm
  namespace: argocd
data:
  admin.enabled: "false"
  repositories: |
    - type: helm
      url: https://prometheus-community.github.io/helm-charts
      name: prometheus-community

Solution

  • The reason you are getting this error is because the way the Application is defined, Argo thinks it's a Git repository instead of Helm.

    Define the source object with a "chart" property instead of "path" like so:

    apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: prom-oper
      namespace: argocd
    spec:
      project: prom-oper
    
      source:
        repoURL: https://prometheus-community.github.io/helm-charts
        targetRevision: "13.2.1"
        chart: kube-prometheus-stack
    

    You can see it defined on line 128 in Argo's application-crd.yaml