Skip to main content

HelmChart v2

Introduced in Replicated KOTS v1.99.0

To deploy Helm charts, KOTS requires a unique HelmChart custom resource for each Helm chart .tgz archive in the release. You configure the HelmChart custom resource to provide the necessary instructions to KOTS for processing and preparing the chart for deployment. Additionally, the HelmChart custom resource creates a mapping between KOTS and your Helm chart to allow Helm values to be dynamically set during installation or upgrade.

For more information, see About Distributing Helm Charts with KOTS.


The following is an example manifest file for the HelmChart v2 custom resource:

kind: HelmChart
name: samplechart
# chart identifies a matching chart from a .tgz
name: samplechart
chartVersion: 3.1.7

releaseName: samplechart-release-1

exclude: "repl{{ ConfigOptionEquals `include_chart` `include_chart_no`}}"

# weight determines the order that charts are applied, with lower weights first.
weight: 42

# helmUpgradeFlags specifies additional flags to pass to the `helm upgrade` command.
- --skip-crds
- --no-hooks
- --timeout
- 1200s
- --history-max=15

# values are used in the customer environment as a pre-render step
# these values are supplied to helm template
enabled: repl{{ ConfigOptionEquals `postgres_type` `embedded_postgres`}}

- when: "repl{{ ConfigOptionEquals `postgres_type` `external_postgres`}}"
recursiveMerge: false
postgresqlDatabase: "repl{{ if ConfigOptionEquals `postgres_type` `external_postgres`}}repl{{ ConfigOption `external_postgres_database`}}repl{{ end}}"
postgresqlUsername: "repl{{ if ConfigOptionEquals `postgres_type` `external_postgres`}}repl{{ ConfigOption `external_postgres_username`}}repl{{ end}}"
postgresqlHost: "repl{{ if ConfigOptionEquals `postgres_type` `external_postgres`}}repl{{ ConfigOption `external_postgres_host`}}repl{{ end}}"
postgresqlPassword: "repl{{ if ConfigOptionEquals `postgres_type` `external_postgres`}}repl{{ ConfigOption `external_postgres_password`}}repl{{ end}}"
postgresqlPort: "repl{{ if ConfigOptionEquals `postgres_type` `external_postgres`}}repl{{ ConfigOption `external_postgres_port`}}repl{{ end}}"
# adds backup labels to postgresql if the license supports snapshots
- when: "repl{{ LicenseFieldValue `isSnapshotSupported` }}"
recursiveMerge: true
commonLabels: velero my-app
podLabels: velero my-app

# namespace allows for a chart to be installed in an alternate namespace to
# the default
namespace: samplechart-namespace

# builder values render the chart with all images and manifests.
# builder is used to create `.airgap` packages and to support end users
# who use private registries
enabled: true


The chart key allows for a mapping between the data in this definition and the chart archive itself. More than one kind: HelmChart can reference a single chart archive, if different settings are needed.

The name of the chart. This value must exactly match the name field from a Chart.yaml in a .tgz chart archive that is also included in the release. If the names do not match, then the installation can error or fail.


The version of the chart. This value must match the version field from a Chart.yaml in a .tgz chart archive that is also included in the release.


Specifies the release name to use when installing this instance of the Helm chart. Defaults to the chart name.

The release name must be unique across all charts deployed in the namespace. To deploy multiple instances of the same Helm chart in a release, you must add an additional HelmChart custom resource with a unique release name for each instance of the Helm chart.

Must be a valid Helm release name that matches regex ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ and is no longer than 53 characters.


Determines the order in which KOTS applies the Helm chart. Charts are applied by weight in ascending order, with lower weights applied first. Supported values: Positive or negative integers. Default: 0

In KOTS v1.99.0 and later, weight also determines the order in which charts are uninstalled. Charts are uninstalled by weight in descending order, with higher weights uninstalled first. For more information about uninstalling applications, see remove in kots CLI.

For more information, see Orchestrating Resource Deployment.


Specifies additional flags to pass to the helm upgrade command for charts. These flags are passed in addition to any flags Replicated KOTS passes by default. The values specified here take precedence if KOTS already passes the same flag. The helmUpgradeFlags attribute can be parsed by template functions. For more information about template functions, see About template function contexts.

KOTS uses helm upgrade for all deployments of an application, not just upgrades, by specifying the --install flag. For non-boolean flags that require an additional argument, such as --timeout 1200s, you must use an equal sign (=) or specify the additional argument separately in the array.


- --timeout
- 1200s
- --history-max=15


The attribute is a value for making optional charts. The exclude attribute can be parsed by template functions.

When Replicated KOTS processes Helm charts, it excludes the entire chart if the output of the exclude field can be parsed as a boolean evaluating to true.

For more information about optional charts, template functions, and how KOTS processes Helm charts, see:


The values key can be used to set or delete existing values in the Helm chart values.yaml file. Any values that you include in the values key must match values in the Helm chart values.yaml. For example, spec.values.images.pullSecret in the HelmChart custom resource matches images.pullSecret in the Helm chart values.yaml.

During installation or upgrade with KOTS, values is merged with the Helm chart values.yaml in the chart archive. Only include values in the values key that you want to set or delete.

For more information about using values, see Setting Helm Chart Values with KOTS.


The optionalValues key can be used to set values in the Helm chart values.yaml file when a given conditional statement evaluates to true. For example, if a customer chooses to include an optional application component in their deployment, it might be necessary to include Helm chart values related to the optional component.

optionalValues includes the following properties:

  • optionalValues.when: Defines a conditional statement using KOTS template functions. If optionalValues.when evaluates to true, then the values specified in optionalValues are set.

  • optionalValues.recursiveMerge: Defines how optionalValues is merged with values.

  • optionalValues.values: An array of key-value pairs.

For more information about using optionalValues, see Setting Helm Chart Values with KOTS.


The optionalValues.when field defines a conditional statement that must evaluate to true for the given values to be set. Evaluation of the conditional in the optionalValues.when field is deferred until render time in the customer environment.

Use KOTS template functions to write the optionalValues.when conditional statement. The following example shows a conditional statement for selecting a database option on the admin console configuration screen:

- when: "repl{{ ConfigOptionEquals `postgres_type` `external_postgres`}}"

For more information about using KOTS template functions, see About Template Functions.


The optionalValues.recursiveMerge boolean defines how KOTS merges values and optionalValues:

  • When optionalValues.recursiveMerge is false, the top level keys in optionalValues override the top level keys in values. By default, optionalValues.recursiveMerge is set to false.

  • When optionalValues.recursiveMerge is true, all keys from values and optionalValues are included. In the case of a conflict where there is a matching key in optionalValues and values, KOTS uses the value of the key from optionalValues.

Default: False

For an example of recursive and non-recursive merging, see About Recursive Merge.


The namespace key specifies an alternative namespace where Replicated KOTS installs the Helm chart. Default: The Helm chart is installed in the same namespace as the admin console. The namespace attribute can be parsed by template functions. For more information about template functions, see About template function contexts.

If you specify a namespace in the HelmChart namespace field, you must also include the same namespace in the additionalNamespaces field of the Application custom resource manifest file. KOTS creates the namespaces listed in the additionalNamespaces field during installation. For more information, see additionalNamespaces in the Application reference.


The builder key is required for the following use cases:

  • To create an .airgap bundle for installations into air gap environments.

    To create an .airgap bundle for a release that uses Helm charts, the Replicated vendor portal renders the Helm charts' templates with helm template. The builder key specifies the Helm chart values that the vendor portal uses when running helm template to create the .airgap bundle.

  • To support online installations that use a local private registry, the builder field renders the Helm chart with all of the necessary images so that KOTS knows where to pull the images.

    By default, pushing images to a local registry is enabled for all installations. A user in an online environment might disable the ability to push images to a local registry only if an external process is responsible for pushing all images to the registry. For more information, see Using Private Registries.

The builder key has the following requirements and recommendations:

  • Replicated recommends that you include only the minimum Helm values in the builder key that are required to template the Helm chart with the correct image tags.
  • Use only static, or hardcoded, values in the builder key. You cannot use template functions in the builder key because values in the builder key are not rendered in a customer environment.
  • Any Helm values entries that are required for rendering Helm chart templates must have a value supplied in the builder key. For more information about the Helm required function, see Using the 'required' function in the Helm documentation.
  • Use the same builder configuration to support the use of local registries in both online and air gap installations. If you already configured the builder key to support air gap installations, then no additional configuration is required.


The following example demonstrates how to add a conditional postgresql resource to the builder key.

postgresql is defined as a conditional resource in the values key of the HelmChart custom resource:

enabled: repl{{ ConfigOptionEquals `postgres_type` `embedded_postgres`}}

As shown above, postgresql is included only when the user selects the embedded_postgres option.

To ensure this conditional postgresql resource is included in the installation files, add the same postgresql value to the builder key with enabled set to true:

enabled: true