Skip to content

Helm Support

You can use the Helm construct in order to include Helm charts.

Note

You will need helm to be installed locally for this feature. For accessing private helm repositories, you must be authenticated to the repository in a way that the helm pull command recognizes.

The following example adds the bitnami/redis Helm chart with sentinel containers enabled:

The Bitnami helm repo needs to be added through: helm repo add bitnami https://charts.bitnami.com/bitnami

class MyChart extends cdk8s.Chart {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    const redis = new Helm(this, 'redis', {
      chart: 'bitnami/redis',
      values: {
        sentinel: {
          enabled: true
        }
      }
    });
  }
}

The Helm construct will render the manifest from the specified chart by executing helm template. If values is specified, these values will override the default values included with the chart.

The name option can be used to specify the chart’s release name. If not specified, a valid and unique release name will be allocated based on the construct path.

The Helm construct extends Include and inherits it’s API. For example, you can use the apiObjects property to find and interact with included API objects.

The following example shows how to add an annotation to the Redis master deployment:

const master = redis.apiObjects.find(o => o.name === 'foo-redis-master');
master.metadata.addAnnotation('my.annotation', 'hey-there');