Helm-set plugin allows you to substitute the environment variables specified in your helm values file with their respective values in the environment from within a CICD pipeline. Heavily inspired by Terraform's envsubst feature.
Install
The installation itself is simple as:
helm plugin install https://github.com/bery/helm-set.git
You can install a specific release version:
helm plugin install https://github.com/bery/helm-set.git --version <release version>
To use the plugin, you do not need any special dependencies. The installer will download the latest release with prebuilt binary from GitHub releases.
Usage
Simple usage
Use environment variables as helm values by taking all variables starting with HELM_VAR_ to --set values. Usage: set [command] Available Commands: completion Generate the autocompletion script for the specified shell help Help about any command install wrapper for helm install, decrypting secrets upgrade wrapper for helm upgrade, decrypting secrets Flags: -d, --debug enable verbose output --dry-run parameter parsing mode (rename, copy) -h, --help help for set -v, --verbose enable verbose output
Examples
Basic usage
Set the HELM_VAR_replicaCount envrionment variable to 3 by:
export HELM_VAR_replicaCount=3Replace helm upgrade with helm set upgrade and run:
helm set upgrade --install --dry-run=false <name> <chart>
This will replace the value of replicaCount in the helm upgrade command with the value of the environment variable HELM_VAR_replicaCount.
Result
helm upgrade upgrade --install --dry-run=false <name> <chart> --set replicaCount=3
Nested values
Goal: set value of image.tag to latest and value of image.pullPolicy to Always.
export HELM_VAR_image__tag="latest" export HELM_VAR_image__pullPolicy="Always" helm set upgrade --install --dry-run=false <name> <chart>
Result
helm upgrade upgrade --install <name> <chart> --set image.tag="latest" --set image.pullPolicy="Always"
Lists values
export HELM_VAR_list__item___0___path="your_path" helm set upgrade --install --dry-run=false <name> <chart>
Result
helm upgrade upgrade --install <name> <chart> --set list.item[0].path="your_path"
Uninstall
helm plugin remove helm-set