Is it possible to have some sort of condition check before declaring a variable in a helm chart for deployment?
For example lets say I have
- name: EXAMPLE_VAR
valueFrom:
secretKeyRef:
name: "name"
key: "key"
but I only want to include this in my deployment for a specific configuration (based on lets say an environment variable) and don't want to have to maintain a seperate yaml configuration just for this configuration option
Let's say you have this in your chart's values.yaml
some-condition: true
Then in deployment template you may do like that:
spec:
env:
{{- if .Values.some-condition }}
- name: EXAMPLE_VAR
valueFrom:
secretKeyRef:
name: "name"
key: "key"
{{- end }}