-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Discover command for side car plugins should have access to application instance variables #9273
Comments
@pierrecregut I agree, that command should get the user-configured env vars. Would you have time to open the PR? I think that we should prefix all the env vars with To avoid confusion, I think the other commands should receive the un-prefixed and prefixed env vars so we can properly deprecate the un-prefixed behavior and give folks time to transition. |
@crenshaw-dev I have opened a pull request. The code is slightly simpler than expected. I have implemented the ENV_ prefixing keeping a legacy behavior for init/generate. The change in the documentation could probably be worded better but I am not a native english speaker. I check that the env can be used on the server but tests should really focus on the client side. But it does not seem easy to mock a server and the unit test available are on the behavior with local plugins not with a sidecar. As a side note while developing the fix on the master branch, I noticed that the ui was empty when I used |
…#9273) Gives access to variables declared in the call of the plugin in the application manifest to the discover command run on the CMP server. Variables are prefixed with ARGOCD_ENV_ to avoid security issues (plugin call overiding important variables). Fixes argoproj#9273 Signed-off-by: Pierre Crégut <pierre.cregut@orange.com>
…9319) * fix: do not export repo-server environment to sidecar (#9393) getPluginEnvs is both used for local plugins and sidecar plugins. For the later do not include the environement variables of the repo-server in the supplied variables. Fixes: #9393 Signed-off-by: Pierre Crégut <pierre.cregut@orange.com> * feat: Add plugin call variables to sidecar plugin discovery (#9273) Gives access to variables declared in the call of the plugin in the application manifest to the discover command run on the CMP server. Variables are prefixed with ARGOCD_ENV_ to avoid security issues (plugin call overiding important variables). Fixes #9273 Signed-off-by: Pierre Crégut <pierre.cregut@orange.com>
…9319) * fix: do not export repo-server environment to sidecar (#9393) getPluginEnvs is both used for local plugins and sidecar plugins. For the later do not include the environement variables of the repo-server in the supplied variables. Fixes: #9393 Signed-off-by: Pierre Crégut <pierre.cregut@orange.com> * feat: Add plugin call variables to sidecar plugin discovery (#9273) Gives access to variables declared in the call of the plugin in the application manifest to the discover command run on the CMP server. Variables are prefixed with ARGOCD_ENV_ to avoid security issues (plugin call overiding important variables). Fixes #9273 Signed-off-by: Pierre Crégut <pierre.cregut@orange.com>
Summary
The discover.find.command command does not have access to the plugin variables defined in the Application manifest.
Motivation
we have several plugins used in different applications.
When plugins were configured through a configMap, the first step to use the right plugin in an application was the name of the plugin that was matched. With the right convention, we may use regular plugin env variables to replace this behaviour and this is what we do in the code of the generate command. On the other hand, there is strictly nothing in the git repository structure that tells we should use plugin A (eg argocd-vault plugin) rather than plugin B (eg something that rewrite/enhance some manifests), so we end up having an empty discover command that accept everything and we defer the real selection work to the generate command. The generate command must emulate the standard behaviour of argocd when there is no plugin (note: sidecar discovery is always called even if there is no plugin section). It is also difficult with the current implementation to have several sidecar plugins.
We end up with a single sidecar plugin that contains a lot of the logic that was implemented by argocd-repo-server. The only gain is that we are not tied to a given argocd release but the implementation is rather monolithic and we reimplement the handling of kustomize/helm applications.
Proposal
The implementation does not change the API, but the set of environment variables available to the discover.find.command command is augmented with the variables defined in the plugin configuration section of the application.
How do you think this should be implemented?
In
repository.go
runConfigurationManagementPluginSidecars
,env
should be computed before runningDetectConfigManagementPlugin
andenv
should be part of the arguments which means a change to thecmpServer/plugin/plugin.proto
. Then the code used ingenerateManifest
to computeenv
should work inmatchRepository
too.The text was updated successfully, but these errors were encountered: