argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

ArgoCD AVP not working as expected.

Open funes79 opened this issue 4 months ago • 1 comments

Checklist:

  • [x] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • [x] I've included steps to reproduce the bug.
  • [x] I've pasted the output of argocd version.

Describe the bug

Tried to install app from helm chart:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: grafana-operator
  namespace: argocd
spec:
  project: default
  source:
    chart: grafana-operator
    repoURL: 'https://charts.bitnami.com/bitnami'
    targetRevision: 4.7.3
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: grafana
  syncPolicy:
    syncOptions:
      - CreateNamespace=true

The config of the AVP:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cmp-plugin
data:
  avp.yaml: |
    apiVersion: argoproj.io/v1alpha1
    kind: ConfigManagementPlugin
    metadata:
      name: argocd-vault-plugin
    spec:
      allowConcurrency: true
      discover:
        find:
          command:
            - sh
            - "-c"
            - "find . -name '*.yaml' | xargs -I {} grep \"<path\\|avp\\.kubernetes\\.io\" {} | grep ."
      generate:
        command:
          - argocd-vault-plugin
          - generate
          - "."
      lockRepo: false
---

and the patch of Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: argo-argocd-repo-server
spec:
  template:
    spec:
      automountServiceAccountToken: true
      volumes:
        - configMap:
            name: cmp-plugin
          name: cmp-plugin
        - name: custom-tools
          emptyDir: {}
      initContainers:
      - name: download-tools
        image: registry.access.redhat.com/ubi8
        env:
          - name: AVP_VERSION
            value: 1.16.1
        command: [sh, -c]
        args:
          - >-
            curl -L https://github.com/argoproj-labs/argocd-vault-plugin/releases/download/v$(AVP_VERSION)/argocd-vault-plugin_$(AVP_VERSION)_linux_amd64 -o argocd-vault-plugin &&
            chmod +x argocd-vault-plugin &&
            mv argocd-vault-plugin /custom-tools/
        volumeMounts:
          - mountPath: /custom-tools
            name: custom-tools
      containers:
      - name: avp
        env:
          - name: AWS_REGION
            value: eu-west-1
          - name: AVP_TYPE
            value: awssecretsmanager
        command: [/var/run/argocd/argocd-cmp-server]
        image: registry.access.redhat.com/ubi8
        securityContext:
          runAsNonRoot: true
          runAsUser: 999
        volumeMounts:
          - mountPath: /var/run/argocd
            name: var-files
          - mountPath: /home/argocd/cmp-server/plugins
            name: plugins
          - mountPath: /tmp
            name: tmp

          # Register plugins into sidecar
          - mountPath: /home/argocd/cmp-server/config/plugin.yaml
            subPath: avp.yaml
            name: cmp-plugin

          # Important: Mount tools into $PATH
          - name: custom-tools
            subPath: argocd-vault-plugin
            mountPath: /usr/local/bin/argocd-vault-plugin

Throws:

Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = 
Manifest generation error (cached): plugin sidecar failed. error generating manifests in cmp: rpc error: code = 
Unknown desc = error generating manifests: `argocd-vault-plugin generate .` failed exit status 1: Error: could not read 
YAML/JSON files: could not read file: Chart.yaml from disk: error unmarshaling JSON: while decoding JSON: 
Object 'Kind' is missing in '{"annotations":{"category":"Analytics","images":"- name: grafana\n image: docker.io/bitnami/grafana:11.2.2-debian-12-r0\n- name: grafana-operator\n image: docker.io/bitnami/grafana-operator:5.14.0-debian-12-r0\n","licenses":"Apache-

To Reproduce

Expected behavior

Screenshots

Version

v2.12.3+6b9cd82

Logs

Paste any relevant application logs here.

funes79 avatar Oct 15 '24 12:10 funes79