Helm is a popular package manager for Kubernetes, an open-source container orchestration platform. It simplifies the deployment and management of applications in Kubernetes clusters by providing a templating system and a standardized way to package, distribute, and deploy software. With Helm, developers can define their application's configuration and dependencies using "charts," which are essentially packages that contain all the necessary files, templates, and metadata. These charts can be versioned and shared, allowing for easy collaboration and reuse across different projects.

Helm Chart Source

env0 supports using Helm with 3 chart sources:

  1. git/local - Use charts that are defined in your code and are not hosted in a Helm Repo.
  2. Helm Repo - Use charts which are hosted in a chart repository. If the repository requires authentication you can provide the username and password in ENV0_HELM_REPO_USERNAME and ENV0_HELM_REPO_PASSWORD environment variables.
  3. S3 - Hosted directly on S3, similar to Helm Repo these charts are hosted remotely but they follow a different protocol.

In order to use a chart that is defined directly in your git select the appropriate VCS provider and provide the path to your Helm chart code:

In order to use a chart hosted in a Helm Repo / S3 select the Helm Repo option in your template:

๐Ÿšง

Custom Flow For Helm Repo Deployments

Helm Repo deployments do not require git clone since the chart is not stored in git, therefore there is no custom flow for a Helm Repo template.

In order to use custom flows (for cluster authentication or other usages) in Helm Repo you must configure a Project-level Custom Flow.

Environment Deployment

  1. Create a Helm Template.
  2. Follow our guide to Connect Your Kubernetes Cluster.
  3. Create an Environment.

๐Ÿ“˜

Cluster Authentication

Cluster authentication varies from one provider to another. Please refer to the Connect Your Kubernetes Cluster guide to learn more.

Environment Variables For Enhanced Customization

env0 supports a more customized usage by providing unique environment variables which will be passed to Helm:

  1. ENV0_HELM_SET_<YOUR_VARIABLE_NAME> - set an environment variable with the ENV0_HELM_SET prefix and the variable name as the suffix will be passed to Helm using the --set flag. E.g. ENV0_HELM_SET_servers[0].port=80 will pass --set server[0].port=80 to helm command. (see below for additional examples for inputting more complex types)
  2. ENV0_HELM_VALUES_FILES - set this environment variable in order to provide Helm with your configuration which is stored in a values file(s), and will be passed to Helm using the --values (-f) flag.
  3. ENV0_HELM_CLI_ARGS - this variable's value will be added to every Helm command execution, it can be used to pass additional custom arguments to Helm. For example it can be set to --create-namespace --no-hooks. ENV0_HELM_CLI_ARGS_diff, ENV0_HELM_CLI_ARGS_upgrade, and ENV0_HELM_CLI_ARGS_uninstall are similar, but only added to corresponding helm commands.

Execution Steps

Beyond the common steps such as Clone, Loading variables, etc. Deploy/Destroy Helm deployments contain the following steps:

  1. Helm Diff - helm diff upgrade <release-name> <chart-name/path> --install --allow-unreleased --color --detailed-exitcode

  2. Helm Upgrade - helm upgrade <release-name> . --install --atomic --timeout 4h

  3. Helm Uninstall - helm uninstall <release-name> --wait --timeout 4h

๐Ÿšง

What Counts as a "diff"

env0 calculates diff between deployments using helm and the helm diff plugin.

The Helm diff plugin finds the exact difference between Helm executions, changes to your Kubernetes resources which were not done by helm are left unnoticed.

For example, A Drift Detection run would result as successful (meaning no drift was found) if a change was done manually inside the cluster without using Helm (such as increasing the replicas from 1 to 2).

Complex Input Value Examples

Desired Helm Valueenv0 HELM SET Input
annotationsgeneral rule:
- use quotes to encapsulate the "key" of annotation.
- escape . (period) and / (slashes) with a (backslash)

example(s):
- ENV0_HELM_SET_annotations."nginx.ingress.kubernets.io/backend-protocol"=HTTPS
- ENV0_HELM_SET_server.ingress.annotations."cert-manager.io/cluster-issuer"=letsencrypt
complex valuesgeneral rule:
- escape spaces with a (backslash)

example
- ENV0_HELM_SET_map={"foo:\ bar"}