Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{.Release.Namespace}} value translation when using AVP #323

Closed
ixxeL2097 opened this issue Mar 22, 2022 · 4 comments
Closed

{{.Release.Namespace}} value translation when using AVP #323

ixxeL2097 opened this issue Mar 22, 2022 · 4 comments

Comments

@ixxeL2097
Copy link

ixxeL2097 commented Mar 22, 2022

Describe the bug
When using plugin AVP with ArgoCD, the native value {{.Release.Namespace}} from helm chart is interpreted as the target namespace of the CR Application (namespace argocd) instead of the actual target namespace of the application itself (which can be whatever you want: default, kube-system, test...)

Expected behavior
The native value {{.Release.Namespace}} from helm chart should be interpreted correctly and reflect the target namespace of the actual deployment instead of the CR Application of argocd's app.

Maybe i missed something about the AVP usage that could help me interpreting this variable as expected, but for now, this is a probleme for me since {{.Release.Namespace}} is always translated as argocd namespace no matter the real namespace I am deploying the app in.

Does anybody has a solution for this ? or is it an actual bug from the plugin ?

EDIT:

The only way I found to bypass this behaviour is to pass a plugin env value like this :

argocd app create [...] --plugin-env="helm_args=--namespace <app-target-namespace>"

with the template of configuration :

      - name: vault-avp-helm-args
        init:
          command: [sh, -c]
          args: ["helm dependency build"]
        generate:
          command: ["sh", "-c"]
          args: ["helm template $ARGOCD_APP_NAME ${helm_args} . | argocd-vault-plugin generate -"]
@ixxeL2097 ixxeL2097 changed the title Release.Namespace value when using AVP {{.Release.Namespace}} value translation when using AVP Mar 22, 2022
@werne2j
Copy link
Member

werne2j commented Mar 22, 2022

Hi @ixxeL2097 custom plugins only have access to a certain environment, as you can read about here. https://argo-cd.readthedocs.io/en/stable/user-guide/config-management-plugins/#environment. The build environment does have some things such as ARGOCD_APP_NAMESPACE described here https://argo-cd.readthedocs.io/en/stable/user-guide/build-environment. But because the CMP is not being treated as an actual Helm app in Argo CD we don't have certain capabilities.

This is a limitation of Argo CD as you can see here argoproj/argo-cd#7623

@ixxeL2097
Copy link
Author

Hi @werne2j and thanks for the clear answer. This is something to take into account indeed when choosing to deploy with AVP.
Anyway, I found a workaround for now, and I hope that this limitation will be treated and maybe enhanced. AVP is a very nice plugin and it would be very intersting to implement it as a first class feature in ArgoCD.

Anyway thanks for helping

@werne2j
Copy link
Member

werne2j commented Mar 22, 2022

Glad to help @ixxeL2097!

@werne2j werne2j closed this as completed Mar 22, 2022
@tiwarisanjay
Copy link

@ixxeL2097 @werne2j What is the workaround for this.
I am passing --namespace as helm
Arg but still creating resources in ArgoCD namespace instead of target namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants