argocd-vault-plugin icon indicating copy to clipboard operation
argocd-vault-plugin copied to clipboard

Does not work with argocd multiple sources

Open ilya251188 opened this issue 2 years ago • 17 comments

argo-vault-plugin version 1.13.1 installed as sidecar container Tried add this manifest

project: myProject
source:
  repoURL: 'https://gitlab.local/k8s/testproject/testapp.git'
  path: ./
  targetRevision: HEAD
destination:
  server: 'https://kubernetes.default.svc'
  namespace: test
sources:
  - repoURL: 'https://gitlab.local/k8s/testproject/testapp.git'
    path: ./
    targetRevision: master
    plugin:
      name: argocd-vault-plugin-helm
      env:
        - name: HELM_ARGS
          value: -f $app_values/global/values.yaml
  - repoURL: 'https://git.local/k8s/testproject/env.git'
    targetRevision: feature/argocd
    ref: app_values

And I get an error: Unable to save changes: application spec for testapp is invalid: InvalidSpecError: Unable to generate manifests in ./: rpc error: code = Unknown desc = plugin sidecar failed. error generating manifests in cmp: rpc error: code = Unknown desc = error generating manifests: `sh -c helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . | argocd-vault-plugin generate - ` failed exit status 126: sh: 2: argocd-vault-plugin: Exec format error Error: open /global/values.yaml: no such file or directory

Maybe I'm doing something wrong)

ilya251188 avatar Jan 27 '23 15:01 ilya251188

i have same issue, anyone have solution?

mircyb avatar Feb 14 '23 00:02 mircyb

remove plugin part and try again as it's not required with sidecar method anymore

Hax7 avatar Feb 15 '23 15:02 Hax7

remove plugin part and try again as it's not required with sidecar method anymore

If I understand correctly, the same error

 sources:
    - path: ./
      repoURL: 'https://gitlab.local/k8s/testproject/testapp.git'
      targetRevision: master
      plugin:
        env:
          - name: HELM_ARGS
            value: '-f $app_values/global/values.yaml'
    - repoURL: 'https://git.local/k8s/testproject/env.git'
      targetRevision: feature/argocd
      ref: app_values

Unable to create application: application spec for testapp is invalid: InvalidSpecError: Unable to generate manifests in ./: rpc error: code = Unknown desc = plugin sidecar failed. error generating manifests in cmp: rpc error: code = Unknown desc = error generating manifests: `sh -c helm template $ARGOCD_APP_NAME -n $ARGOCD_APP_NAMESPACE ${ARGOCD_ENV_HELM_ARGS} . | argocd-vault-plugin generate - ` failed exit status 126: sh: 2: argocd-vault-plugin: Exec format error Error: open /global/values.yaml: no such file or directory

ilya251188 avatar Feb 16 '23 10:02 ilya251188

Seems the issue is with ArgoCD. https://github.com/argoproj/argo-cd/issues/12476

jete-vian avatar Mar 03 '23 22:03 jete-vian

@ilya251188 was the Argo CD issue linked above able to help your issue?

werne2j avatar Mar 22 '23 18:03 werne2j

Does somebody have any updates? Can we hope multiple sources will be supported? Currently, we have to use single source with helm dependency like as workaround.

alekseydemidov avatar Jun 12 '23 08:06 alekseydemidov

Our current workaround is to pull and store the helm chart into the same git repo we store the values in.

repo
|- chart-1.0
  |- Chart.yaml
  |- ...
  |- our-values.yaml

So the app would look something like that

...
source:
  repoURL: 'https://our-git/our-repo.git'
  path: chart-1.0
  targetRevision: HEAD
  plugin:
    name: argocd-vault-plugin-helm
    env:
      - name: HELM_ARGS
        value: '-f our-values.yaml'

olzemal avatar Jun 21 '23 11:06 olzemal

olzemal

Thanks for your advice, but in this case multiple source feature is almost useless. We use a universal chart for the deployment multiple internal applications, and I wanna to keep it in separate repo (chart or oci), and values files in the another repo. As result, I had to refuse from multi sources and backward to use helm dependancy with single ArgoCD source :(

alekseydemidov avatar Jun 22 '23 08:06 alekseydemidov

Are there any plans to fix this in future? I'm facing the same issue and it's quite disturbing

volver-13 avatar Jun 27 '23 12:06 volver-13

Same here, currently can't use the multiple sources with a custom plugin :/

Diliz avatar Jun 30 '23 07:06 Diliz

Except the workaround proposed by @olzemal, does someone find another alternative?

I am having the same issue and trying to find a solution for use case when Helm charts are published by an external third party such as Bitnami and I just maintain the values.<environment>.yaml in my own GitHub repos.

subigre avatar Jul 24 '23 13:07 subigre

Any update on this one ? Has anyone managed to get this working? Plugins with multi-sourced apps

kartik-moolya avatar Sep 13 '23 11:09 kartik-moolya

The dirty workaround might be to clone the git repository with values files explicitly during init phase of plugin. I'm attaching pseudocode example of what I have in mind. It's not tested and most likely not working out of the box:

      argocd-vault-plugin-helm:
        init:
          command: [sh, -c]
          args: ["git clone https://github.com/my-values-repo ../my-values-repo"]
        generate:
          command: ["bash", "-o", "pipefail", "-c"]
          args: ['helm template $ARGOCD_APP_NAME --include-crds -n $ARGOCD_APP_NAMESPACE -f ../my-values-repo/values.yaml} . | argocd-vault-plugin generate -']

Git binary must be of course available inside the sidecar (if you use default argocd image it's there). The problem might be credentials so you might have to mount there SSH key from some secret or use some username/password combination. my-values-repo string can be probably replaced with $ARGOCD_APP_VALUES_REPO env varible defined in Application manifest.

welcomeboredom avatar Sep 26 '23 12:09 welcomeboredom

Help please :) I have the same issue!

andrewkaczynski avatar Nov 02 '23 18:11 andrewkaczynski

As linked above this is an issue with ArgoCD. https://github.com/argoproj/argo-cd/issues/12476 We have no control over how ArgoCD works AVP is just a custom plugin.

werne2j avatar Nov 02 '23 19:11 werne2j

The dirty workaround might be to clone the git repository with values files explicitly during init phase of plugin.

I am trying the similar solution by cloning on-premise (Github Enterprise server) repos in the plugin. However, I agree with you that it is a dirty trick. By the way did you get correct argocd-native solution for deploying Application (helm workload) using multiple sources (values.yaml)? Thanks

jaythamke avatar Nov 20 '23 15:11 jaythamke

I have the same issue when I generate resources by kustomize!

zeusal avatar Dec 05 '23 08:12 zeusal