Passing Env variables in argo-cd config management plugin #10412
Unanswered
goelshubham
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All - I have a question w.r.t argocd config management plugin Env variable passing. I have implemented a use-case of CMP in conjunction with ApplicationSet CRDs and will try to explain in detail.
My goal is to deploy a service in different namespaces of a k8s cluster. Because I want to deploy this service in different namespaces, I want to have some variable configurations for each namespace. Things like kuberneres namespace itself, number of replicas, different AWS elastic load balancer etc. In order to this I am making use ApplicationSet which I know can be used with generators and can create many Application CRD which does the eventual deployment to k8s.
Below is my ApplicationSet. I am using git generator where I will configure some configuration yaml files. The goal is that this application-set when created in ArgoCD, will created
n
unique Application CRD forn
configuration files at locationtest/appset/stage/stage-euw1/eu-west-1/core/test-app-simple5/k2Sharding-shards/shard-*.yaml
. Each configuration file contains key-value pairs specific to deployment in a namespace. I know the parameters configured in the git generator files can be accessed in the template section of ApplicationSet as well as in the ENV section of plugin.In ApplicationSet, I am using cmp and my ApplicationSet looks like this.
Below is my argocd config management plugin configuration. In the command section, I am going to execute a tool
k2
. It is a home-grown tool that takes a custom yaml file (k2generatorinput.yaml
) as an input and generates k8s manifest files. Because cmp works when we print out the k8s manifest to standard out, my commandk2 generate app -f $PWD/k2generatorinput.yaml --print
will also do that.Now the problem that I ran into is - because the final k8s files has to be different for each deployment eventually done by Application CRD created by ApplicationSet CRD (specified above), how do I pass my dynamic parameters configured in git generators of ApplicationSet for different deployments done by Application. I know that plugin
generate
andinit
commands can access the env of plugin and adds a prefixARGOCD_ENV
.If my custom
K2GeneratorInput.yaml
file looks like this, should I inject dynamic parameters forreplicas
andnamespace
like below?Please let me know if this question is not clear and I will try my best to explain it further.
Beta Was this translation helpful? Give feedback.
All reactions