# HelmChart

Represents a helm chart within the Kubernetes system.

Applies/deletes the resources using `kubectl` in sync with the resource.

Extends: Construct › HelmChart
Implements: IConstruct, IDependable

- Source: [`aws-eks/lib/helm-chart.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-eks/lib/helm-chart.ts#L133)
- Type last changed: v2.140.0 · 2 May 2024

## Example

```ts
declare const cluster: eks.Cluster;
// option 1: use a construct
new eks.HelmChart(this, 'NginxIngress', {
  cluster,
  chart: 'nginx-ingress',
  repository: 'https://helm.nginx.com/stable',
  namespace: 'kube-system',
});

// or, option2: use `addHelmChart`
cluster.addHelmChart('NginxIngress', {
  chart: 'nginx-ingress',
  repository: 'https://helm.nginx.com/stable',
  namespace: 'kube-system',
});
```

## Initializer

```ts
new HelmChart(scope: Construct, id: string, props: HelmChartProps)
```

## Construct Props

- `atomic`: boolean = false — Whether or not Helm should treat this operation as atomic;

  if set, upgrade process rolls back changes
  made in case of failed upgrade. The --wait flag will be set automatically if --atomic is used.

- `chart`: string — The name of the chart.

  **Default:** No chart name. Implies `chartAsset` is used.

  Either this or `chartAsset` must be specified.

- `chartAsset`: [Asset](/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets.Asset.html) — The chart in the form of an asset.

  **Default:** No chart asset. Implies `chart` is used.

  Either this or `chart` must be specified.

- `cluster`: [ICluster](/cdk/api/v2/docs/aws-cdk-lib.aws_eks.ICluster.html) (required) — The EKS cluster to apply this configuration to.

  [disable-awslint:ref-via-interface]

- `createNamespace`: boolean = true — create namespace if not exist.

- `namespace`: string = default — The Kubernetes namespace scope of the requests.

- `release`: string — The name of the release.

  **Default:** If no release name is given, it will use the last 53 characters of the node's unique id.

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = RemovalPolicy.DESTROY — The removal policy applied to the custom resource that manages the Helm chart.

  The removal policy controls what happens to the resource if it stops being managed by CloudFormation.
  This can happen in one of three situations:

  - The resource is removed from the template, so CloudFormation stops managing it
  - A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it
  - The stack is deleted, so CloudFormation stops managing all resources in it

- `repository`: string — The repository which contains the chart.

  **Default:** No repository will be used, which means that the chart needs to be an absolute URL.

  For example: https://charts.helm.sh/stable/

- `skipCrds`: boolean — if set, no CRDs will be installed.

  **Default:** CRDs are installed if not already present

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.minutes(5) — Amount of time to wait for any individual Kubernetes operation.

  Maximum 15 minutes.

- `values`: { [key: string]: any } — The values to be used by the chart.

  **Default:** No values are provided to the chart.

  For nested values use a nested dictionary. For example:
  values: {
   installationCRDs: true,
   webhook: { port: 9443 }
  }

  In languages other than TypeScript and JavaScript, `null` values (such as
  `None` in Python) are dropped when crossing the jsii boundary. To pass
  `null` values to the chart, see the "Helm Charts" section of the module README.

- `version`: string — The chart version to install.

  **Default:** If this is not specified, the latest version is installed

- `wait`: boolean — Whether or not Helm should wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state before marking the release as successful.

  **Default:** Helm will not wait before marking release as successful

## Properties

- `atomic`: boolean

- `chart`: string

- `chartAsset`: [Asset](/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets.Asset.html)

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `repository`: string

- `RESOURCE_TYPE`: string (static) — The CloudFormation resource type.

- `version`: string

## Methods

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
