Using Helm template I can specify deployment environment variables.
However, if the environment variable gets modified manually via Openshift web console, it will be ignored by Helm on upgrades even if the template code changes.
The command I use is
helm upgrade --install --force --debug app .
templates/deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
spec:
template:
spec:
containers:
- name: app
image: app:latest
env:
- name: ENV
value: {{ Values.env }}
values.yaml
env: dev
How can I make Helm always override environment variables on upgrade?
To customize the chart values, you can use:
--values
/ -f
to pass in a yaml file holding settings,--set
to provide one or more key=val pairs directly,--set-string
to provide key=val forcing val to be stored as a string,--set-file
to provide key=path to read a single large value from a file at path.To edit or append to the existing customized values, add the --reuse-values
flag, otherwise any existing customized values are ignored.
In your case, you can export the variable and use it while running helm upgrade:
$ export ENV=change
It is possible to easily override variable by adding a --set
flag in call to helm upgrade:
$ helm upgrade --set env=$ENV ./mychart
--set
flag has a higher precedence than the default values.yaml
file.
I reccomend you to read more about helm upgrade flags from following documentation and article.