Argocd + env var + applicationset + kustomize #9814
-
We are running into an issue where we would like to simply add an environment variable
We continue to see references to the CMP where we are "supposed" to just be able to use: plugin:
env:
- name: IMAGETAG
value: "{{version}}" However, when using that we run into : rpc error: code = Unknown desc = plugin sidecar failed. Couldn't find cmp-server plugin supporting repository .apps/core-api/deploy/overlays/staging So, how, exactly are we supposed to add an environment variable to kustomize templating from an applicationset? I know how to retrieve it on the templating side, but setting it on the applicationset seems to either be impossible or completely undocumented? Any pointers here or help would be fantastic! Thanks! Documentation Sources: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Actually I solved my own problem, but this was a HUGE combination of documented pieces from around the web... ok so here are the pieces... In my plugin:
env:
- name: IMAGETAG
value: "{{version}}"
name: kustomized-helm In argocd helm configuration for plugins: # server.config.configManagementPlugins
configManagementPlugins: |
- name: kustomized-helm
generate:
command: ["/bin/sh", "-c"]
args: ["IMAGETAG=${ARGOCD_ENV_IMAGETAG} kustomize build --enable-helm"] Local configMapGenerator:
- name: image-tag-var
env: image.tag.properties
replacements:
- path: image-tag-replacement.yaml Local IMAGETAG Notice the deployment name and the Local source:
kind: ConfigMap
name: image-tag-var
fieldPath: data.IMAGETAG
version: v1
targets:
- select:
name: my-deployment
kind: Deployment
fieldPaths:
- spec.template.spec.containers.[name=my-container].image
options:
delimiter: ':'
index: 1
create: true
|
Beta Was this translation helpful? Give feedback.
-
I'm trying to use this for my setup as well but I have encountered a problem: When I want to open a new PR, a new app is created but it also updates the existing ones too. Do we have a solution and/or an explanation of why this occurs? I tried the same setup with Helm and everything works as expected. |
Beta Was this translation helpful? Give feedback.
Actually I solved my own problem, but this was a HUGE combination of documented pieces from around the web... ok so here are the pieces...
In my
applicationSet
:In argocd helm configuration for plugins:
Local
kustomization.yaml
: