1

我正在尝试向 ArgoCD添加一个掌舵图( https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack )。

当我这样做时,我收到以下错误:

无法保存更改:应用程序规范无效:InvalidSpecError:存储库不可访问:未找到存储库

你们能帮帮我吗?我认为我做的一切都是正确的,但似乎有些不对劲......

这是项目 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

以及我添加 helm repo 的 configmap

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
4

1 回答 1

3

您收到此错误的原因是因为应用程序的定义方式,Argo 认为它是 Git 存储库而不是 Helm。

使用“图表”属性而不是“路径”定义源对象,如下所示:

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

你可以在 Argo 的 application-crd.yaml 的第 128 行看到它的定义

于 2021-03-10T19:55:57.017 回答