-
Notifications
You must be signed in to change notification settings - Fork 202
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
feat: Add compatibility for ArgoCD 2.4 prefixed environment variables #356
Conversation
Thanks for the PR @edjmao! I would really like to find a way that allows seamless use with 2.4 without introducing a new annotation. Will try to take a look on Monday to maybe come up with some options |
One thing we could do is, in the config, specifically https://github.com/argoproj-labs/argocd-vault-plugin/blob/main/pkg/config/config.go#L271, we could find all env vars with the @jkayani what are your thoughts on this? Or any other ideas? |
I agree that the best is if a seamless transition could occur. This was just my quick attempt to get something working for my team, as we had to upgrade ArgoCD. I'm still trying to figure out how Viper works, and I must have missed that for loop at the bottom. I'm happy to close this PR if a different approach is decided upon. |
@edjmao do you want to try giving this..
a shot? |
Yeah, I can try this in my spare evenings this week. |
Hi all, sorry for my absence on this discussion - I agree with @werne2j that it'd be best to quietly make things work, rather than having an explicit config option a user would have to set for compatibility with ArgoCD 2.4+ vs earlier releases. The way Viper is being used right now is that it looks for env variables that match the config key on each Viper lookup (via
That way any non-AVP specific keys set at the app manifest ( @edjmao Let me know if this makes sense or not. I appreciate the effort you've made so far on this PR, hoping we can add this on and without too much trouble! |
May want to make sure to mention the change in behavior. I hadn't upgraded yet but I was going to need to figure out how to deal with setting |
Goal is not have any change in behavior and have things work seamlessly regardless of the version of Argo CD being used (set var |
Found some time to revisit this PR this week. The quickest change I was able to make was to simply replace the lookup of another environment variable with the presence of
I did end up going the route that @jkayani recommended for completeness. It's got more steps, but it's more versatile. I've update the PR with those changes.
|
@edjmao Can you rebase your branch with main? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code, tests, docs all look good to me. Thanks!
But, please rebase onto latest main so we can merge
Codecov Report
@@ Coverage Diff @@
## main #356 +/- ##
==========================================
+ Coverage 77.53% 77.64% +0.11%
==========================================
Files 22 22
Lines 1006 1011 +5
==========================================
+ Hits 780 785 +5
Misses 142 142
Partials 84 84
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Rebased from main. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @edjmao!
Change env variable `HELM_VALUES` to `ARGOCD_ENV_HELM_VALUES` in manifest to comply with (argoproj-labs#356) changes Add `-n "$ARGOCD_APP_NAMESPACE"` to use with `helm template` to avoid issues with with `{{.Release.Namespace}}` in helm templates
Change env variable `HELM_VALUES` to `ARGOCD_ENV_HELM_VALUES` in manifest to comply with (#356) changes Add `-n "$ARGOCD_APP_NAMESPACE"` to use with `helm template` to avoid issues with with `{{.Release.Namespace}}` in helm templates
Description
ArgoCD 2.4 adds a security fix where all environment variables passed to the repo server during the
init
andgenerate
phases are prefixed withARGOCD_ENV
to prevent users from setting potentially sensitive environment variables. Theargocd-vault-plugin
binary needs to read the required values from env vars with the new prefix. This PR adds another flag to set (USE_PREFIX
) to switch from reading un-prefixed to reading prefixed env vars.Checklist
Please make sure that your PR fulfills the following requirements:
go mod tidy -compat=1.17
to ensure only the minimum is pulled in.Type of Change
Other information
The ArgoCD 2.4 breaking change was mentioned in #352. I tried looking into ways to have the
config.go
module to read from both the prefixed and unprefixed env vars, but I couldn't get Viper to do that without having to rewrite how those variables read out of the config manager. This was the least intrusive way I could find to make this compatible with 2.4.I have tested it on our own ArgoCD 2.4 instance with no issues so far.