travisghansen / argo-cd-helmfile

Integration between argo-cd and helmfile
MIT License
213 stars 55 forks source link

argo-cd-helmfile.sh discover` failed exit status 1 #48

Open kfirfer opened 9 months ago

kfirfer commented 9 months ago

Hello

we're getting these errors from the repo-servers & helmfile-plugin containers:

[argocd-repo-server-7c87b45c78-klqsl helmfile-plugin] 2023-12-02T23:31:00.576124817Z time="2023-12-02T23:31:00Z" level=error msg="`argo-cd-helmfile.sh discover` failed exit status 1: helm version v3.13.2+g2a2fb3b\nhelmfile version 0.159.0\nstarting discover" execID=9f414

[argocd-repo-server-7c87b45c78-klqsl repo-server] 2023-12-02T23:28:01.967570989Z {"CWE":775,"level":"error","msg":"repository /tmp/_argocd-repo/6ce5552d-0857-429f-976c-3270dcb35528 is not the match because error receiving stream response: rpc error: code = Unknown desc = match repository error: error running find command: `argo-cd-helmfile.sh discover` failed exit status 1: helm version v3.13.2+g2a2fb3b\nhelmfile version 0.159.0\nstarting discover","security":2,"time":"2023-12-02T23:28:01Z"}

we have 2 replicas of repo-server

but we dont know the problem argocd version is: v2.9.2+c5ea5c4 and helmfile-plugin version is: travisghansen/argo-cd-helmfile:v0.3.7 what could be the problem ?

kfirfer commented 9 months ago

This is my values custom yaml file and installing argocd with the helm chart version 5.51.4

configs:
  cm:
    timeout.reconciliation: 300s
  params:
    controller.repo.server.timeout.seconds: 120
    controller.self.heal.timeout.seconds: 10
    reposerver.parallelism.limit: 50
repoServer:
  env:
  - name: ARGOCD_EXEC_TIMEOUT
    value: 10m
  - name: ARGOCD_GIT_ATTEMPTS_COUNT
    value: "2"
  - name: HELM_PLUGINS
    value: /custom-tools/helm-plugins/
  - name: HARBOR_HELM_REPOS_PASSWORD
    value: XXXXX
  extraContainers:
  - command:
    - /var/run/argocd/argocd-cmp-server
    env:
    - name: ARGOCD_EXEC_TIMEOUT
      value: 10m
    - name: ARGOCD_GIT_ATTEMPTS_COUNT
      value: "2"
    - name: HELM_PLUGINS
      value: /custom-tools/helm-plugins/
    - name: HELM_SECRETS_HELM_PATH
      value: /usr/local/bin/helm
    - name: HELM_SECRETS_SOPS_PATH
      value: /custom-tools/sops
    - name: HELM_SECRETS_KUBECTL_PATH
      value: /custom-tools/kubectl
    - name: HELM_SECRETS_CURL_PATH
      value: /custom-tools/curl
    - name: HELM_SECRETS_VALUES_ALLOW_SYMLINKS
      value: "true"
    - name: HELM_SECRETS_VALUES_ALLOW_ABSOLUTE_PATH
      value: "true"
    - name: HELM_SECRETS_VALUES_ALLOW_PATH_TRAVERSAL
      value: "true"
    - name: HELM_SECRETS_URL_VARIABLE_EXPANSION
      value: "true"
    - name: SOPS_AGE_KEY_FILE
      value: /sops/age/key.txt
    - name: HARBOR_HELM_REPOS_PASSWORD
      value: XXXXX
    image: travisghansen/argo-cd-helmfile:v0.3.7
    name: helmfile-plugin
    resources:
      limits:
        cpu: 1000m
        memory: 4Gi
      requests:
        cpu: 100m
        memory: 100Mi
    securityContext:
      runAsNonRoot: true
      runAsUser: 999
    volumeMounts:
    - mountPath: /sops/age
      name: helm-secrets-age-private-key
    - mountPath: /var/run/argocd
      name: var-files
    - mountPath: /home/argocd/cmp-server/plugins
      name: plugins
    - mountPath: /tmp
      name: helmfile-cmp-tmp
    - mountPath: /custom-tools
      name: custom-tools
    - mountPath: /usr/local/bin/helm
      name: custom-tools
      subPath: helm
    - mountPath: /usr/local/bin/sops
      name: custom-tools
      subPath: sops
    - mountPath: /usr/local/bin/helmfile
      name: custom-tools
      subPath: helmfile
  initContainers:
  - args:
    - |
      wget https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz
      tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz
      mv linux-amd64/helm /custom-tools/
      chmod +x /custom-tools/helm

      #curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
      #chmod 700 get_helm.sh
      #./get_helm.sh

      mkdir -p /custom-tools/helm-plugins

      wget -qO /custom-tools/argo-cd-helmfile.sh https://raw.githubusercontent.com/travisghansen/argo-cd-helmfile/master/src/argo-cd-helmfile.sh &&
      chmod +x /custom-tools/argo-cd-helmfile.sh

      wget -qO /custom-tools/helmfile.tar.gz https://github.com/helmfile/helmfile/releases/download/v${HELMFILE_VERSION}/helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz
      tar -zxvf /custom-tools/helmfile.tar.gz -C /custom-tools
      chmod +x /custom-tools/helmfile

      wget -qO /custom-tools/age.tar.gz https://dl.filippo.io/age/latest?for=linux/amd64
      tar -zxvf /custom-tools/age.tar.gz -C /custom-tools
      chmod +x /custom-tools/age/age
      mv /custom-tools/age/age /custom-tools/age-bin

      wget -qO- https://github.com/jkroepke/helm-secrets/releases/download/v${HELM_SECRETS_VERSION}/helm-secrets.tar.gz | tar -C /custom-tools/helm-plugins -xzf-;

      wget -qO /custom-tools/sops https://github.com/mozilla/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux
      wget -qO /custom-tools/kubectl https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
      wget -qO /custom-tools/curl https://github.com/moparisthebest/static-curl/releases/latest/download/curl-amd64 \

      echo "echo \$HELM_REPOSITORY_PASSWORD | helm registry login \$HELM_DOCKERHUB_REGISTRY -u \$HELM_REPOSITORY_USERNAME --password-stdin" > /custom-tools/init-helmfile.sh
      chmod +x /custom-tools/init-helmfile.sh

      chmod +x /custom-tools/*
    command:
    - sh
    - -ec
    env:
    - name: HELM_SECRETS_VERSION
      value: 4.5.1
    - name: SOPS_VERSION
      value: 3.7.3
    - name: KUBECTL_VERSION
      value: 1.28.3
    - name: HELMFILE_VERSION
      value: 0.159.0
    - name: HELM_VERSION
      value: v3.13.2
    image: alpine:3
    name: download-tools
    volumeMounts:
    - mountPath: /custom-tools
      name: custom-tools
  rbac:
  - apiGroups:
    - ""
    resources:
    - secrets
    verbs:
    - get
  replicas: 2
  resources:
    limits:
      cpu: 2000m
      memory: 4Gi
    requests:
      cpu: 10m
      memory: 450Mi
  serviceAccount:
    create: true
    name: argocd-repo-server
  volumeMounts:
  - mountPath: /custom-tools
    name: custom-tools
  - mountPath: /usr/local/bin/argo-cd-helmfile.sh
    name: custom-tools
    subPath: argo-cd-helmfile.sh
  - mountPath: /usr/local/bin/helmfile
    name: custom-tools
    subPath: helmfile
  - mountPath: /usr/local/bin/helm
    name: custom-tools
    subPath: helm
  - mountPath: /usr/local/bin/sops
    name: custom-tools
    subPath: sops
  - mountPath: /etc/profile.d/gpg-tty.sh
    name: custom-tools
    subPath: gpg-tty.sh
  - mountPath: /usr/local/bin/init-helmfile.sh
    name: custom-tools
    subPath: init-helmfile.sh
  - mountPath: /usr/local/bin/age
    name: custom-tools
    subPath: age-bin
  - mountPath: /helm-secrets-age-private-key/
    name: helm-secrets-age-private-key
  volumes:
  - emptyDir: {}
    name: custom-tools
  - name: helm-secrets-age-private-key
    secret:
      secretName: helm-secrets-age-private-key
  - emptyDir: {}
    name: helmfile-cmp-tmp
server:
  config:
    helm.valuesFileSchemes: secrets+gpg-import, secrets+gpg-import-kubernetes, secrets+age-import,
      secrets+age-import-kubernetes, secrets, https

I dont know if its relating or not, but since i upgraded from the prev argocd version with the configmap deprecated plugin, the CPU usage is quite high and the sync taking triple the time to finish as before