Want to learn about running containers in Lambda? Join our free hands-on workshop. Register Now

Module helm/v3

This page documents the language specification for the kubernetes package. If you're looking for help working with the inputs, outputs, or functions of kubernetes resources in a Pulumi program, please see the resource documentation for examples and API reference.

APIs

APIs

class Chart

class Chart extends CollectionComponentResource

Chart is a component representing a collection of resources described by an arbitrary Helm Chart. The Chart can be fetched from any source that is accessible to the helm command line. Values in the values.yml file can be overridden using ChartOpts.values (equivalent to --set or having multiple values.yml files). Objects can be transformed arbitrarily by supplying callbacks to ChartOpts.transformations.

Chart does not use Tiller. The Chart specified is copied and expanded locally; the semantics are equivalent to running helm template and then using Pulumi to manage the resulting YAML manifests. Any values that would be retrieved in-cluster are assigned fake values, and none of Tiller’s server-side validity testing is executed.

Example Usage

Local Chart Directory
import * as k8s from "@pulumi/kubernetes";

const nginxIngress = new k8s.helm.v3.Chart("nginx-ingress", {
  path: "./nginx-ingress",
});
Remote Chart
import * as k8s from "@pulumi/kubernetes";

const nginxIngress = new k8s.helm.v3.Chart("nginx-ingress", {
  chart: "nginx-ingress",
  version: "1.24.4",
  fetchOpts:{
    repo: "https://kubernetes-charts.storage.googleapis.com/",
  },
});
Set Chart values
import * as k8s from "@pulumi/kubernetes";

const nginxIngress = new k8s.helm.v3.Chart("nginx-ingress", {
  chart: "nginx-ingress",
  version: "1.24.4",
  fetchOpts:{
    repo: "https://kubernetes-charts.storage.googleapis.com/",
  },
  values: {
    controller: {
      metrics: {
        enabled: true,
      }
    }
  },
});
Deploy Chart into Namespace
import * as k8s from "@pulumi/kubernetes";

const nginxIngress = new k8s.helm.v3.Chart("nginx-ingress", {
  chart: "nginx-ingress",
  version: "1.24.4",
  namespace: "test-namespace",
  fetchOpts:{
    repo: "https://kubernetes-charts.storage.googleapis.com/",
  },
});
Chart with Transformations
import * as k8s from "@pulumi/kubernetes";

const nginxIngress = new k8s.helm.v3.Chart("nginx-ingress", {
  chart: "nginx-ingress",
  version: "1.24.4",
  fetchOpts:{
    repo: "https://kubernetes-charts.storage.googleapis.com/",
  },
  transformations: [
    // Make every service private to the cluster, i.e., turn all services into ClusterIP instead of LoadBalancer.
    (obj: any, opts: pulumi.CustomResourceOptions) => {
      if (obj.kind === "Service" && obj.apiVersion === "v1") {
        if (obj.spec && obj.spec.type && obj.spec.type === "LoadBalancer") {
          obj.spec.type = "ClusterIP";
        }
      }
    },

    // Set a resource alias for a previous name.
    (obj: any, opts: pulumi.CustomResourceOptions) => {
    if (obj.kind === "Deployment") {
      opts.aliases = [{ name: "oldName" }]
    },

    // Omit a resource from the Chart by transforming the specified resource definition to an empty List.
    (obj: any, opts: pulumi.CustomResourceOptions) => {
    if (obj.kind === "Pod" && obj.metadata.name === "test") {
      obj.apiVersion = "v1"
      obj.kind = "List"
    },
  ],
});

constructor

new Chart(releaseName: string, config: ChartOpts | LocalChartOpts, opts?: pulumi.ComponentResourceOptions)

Create an instance of the specified Helm chart.

  • releaseName Name of the Chart (e.g., nginx-ingress).
  • config Configuration options for the Chart.
  • opts A bag of options that control this resource's behavior.

method getCustomResource

public getCustomResource<T>(groupVersionKind: string, namespace: string): pulumi.Output<T>

getCustomResource returns a resource defined by a CRD with the given group/version/kind and name.

For example: getCustomResource(“monitoring.coreos.com/v1/ServiceMonitor”, “kube-prometheus-exporter-kubernetes”)

public getCustomResource<T>(groupVersionKind: string, namespace: string, name: string): pulumi.Output<T>

method getData

protected getData(): Promise<TData>

Retrieves the data produces by [initialize]. The data is immediately available in a derived class’s constructor after the super(...) call to ComponentResource.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method getResource

public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string): pulumi.Output<MutatingWebhookConfiguration>

getResource returns a resource defined by a built-in Kubernetes group/version/kind and name.

For example: getResource(“apps/v1/Deployment”, “nginx”)

public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<MutatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfigurationList", name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfiguration", name: string): pulumi.Output<MutatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<MutatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfigurationList", name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/MutatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<MutatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfiguration", name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfiguration", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfiguration>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfigurationList", name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "admissionregistration.k8s.io/v1beta1/ValidatingWebhookConfigurationList", namespace: string, name: string): pulumi.Output<ValidatingWebhookConfigurationList>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinition", name: string): pulumi.Output<CustomResourceDefinition>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinition", namespace: string, name: string): pulumi.Output<CustomResourceDefinition>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinitionList", name: string): pulumi.Output<CustomResourceDefinitionList>
public getResource(groupVersionKind: "apiextensions.k8s.io/v1/CustomResourceDefinitionList", namespace: string, name: string): pulumi.Output<CustomResourceDefinitionList>
+ 374 additional overloads

method getResourceProperty

public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">

getResourceProperty returns a single property of a resource defined by a built-in Kubernetes group/version/kind and name.

For example: getResourceProperty(“v1/Service”, “nginx”, “spec”)

public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfiguration">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfiguration">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "metadata"): pulumi.Output<ObjectMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "metadata"): pulumi.Output<ObjectMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", name: string, property: "webhooks"): pulumi.Output<MutatingWebhook[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfiguration", namespace: string, name: string, property: "webhooks"): pulumi.Output<MutatingWebhook[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "items"): pulumi.Output<MutatingWebhookConfiguration[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "items"): pulumi.Output<MutatingWebhookConfiguration[]>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfigurationList">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "kind"): pulumi.Output<"MutatingWebhookConfigurationList">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", name: string, property: "metadata"): pulumi.Output<ListMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/MutatingWebhookConfigurationList", namespace: string, name: string, property: "metadata"): pulumi.Output<ListMeta>
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", namespace: string, name: string, property: "apiVersion"): pulumi.Output<"admissionregistration.k8s.io/v1">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", name: string, property: "kind"): pulumi.Output<"ValidatingWebhookConfiguration">
public getResourceProperty(groupVersionKind: "admissionregistration.k8s.io/v1/ValidatingWebhookConfiguration", namespace: string, name: string, property: "kind"): pulumi.Output<"ValidatingWebhookConfiguration">
+ 1836 additional overloads

method initialize

protected initialize(args: Inputs): Promise<TData>

Can be overridden by a subclass to asynchronously initialize data for this Component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use .getData.

method isInstance

static isInstance(obj: any): obj is ComponentResource

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method parseChart

parseChart(config: ChartOpts | LocalChartOpts, releaseName: string, opts?: pulumi.ComponentResourceOptions): OutputInstance<{[key: string]: CustomResource}> & { ... }

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

registerOutputs registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.

ComponentResources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.

property resources

resources: pulumi.Output<{[key: string]: CustomResource}>;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

interface ChartOpts

interface ChartOpts extends BaseChartOpts

The set of arguments for constructing a Chart resource from a remote source.

property apiVersions

apiVersions?: pulumi.Input<pulumi.Input<string>[]>;

The optional kubernetes api versions used for Capabilities.APIVersions.

property chart

chart: pulumi.Input<string>;

The name of the chart to deploy. If [repo] is provided, this chart name will be prefixed by the repo name. Example: repo: “stable”, chart: “nginx-ingress” -> “stable/nginx-ingress” Example: chart: “stable/nginx-ingress” -> “stable/nginx-ingress”

property fetchOpts

fetchOpts?: pulumi.Input<FetchOpts>;

Additional options to customize the fetching of the Helm chart.

property namespace

namespace?: pulumi.Input<string>;

The optional namespace to install chart resources into.

property repo

repo?: pulumi.Input<string>;

The repository name of the chart to deploy. Example: “stable”

property resourcePrefix

resourcePrefix?: undefined | string;

An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix=“foo” would produce a resource named “foo-resourceName”.

property transformations

transformations?: (o: any, opts: CustomResourceOptions) => void[];

A set of transformations to apply to Kubernetes resource definitions before registering with engine.

property values

values?: pulumi.Inputs;

Overrides for chart values.

property version

version?: pulumi.Input<string>;

The version of the chart to deploy. If not provided, the latest version will be deployed.

interface FetchOpts

interface FetchOpts

Additional options to customize the fetching of the Helm chart.

property caFile

caFile?: pulumi.Input<string>;

Verify certificates of HTTPS-enabled servers using this CA bundle.

property certFile

certFile?: pulumi.Input<string>;

Identify HTTPS client using this SSL certificate file.

property destination

destination?: pulumi.Input<string>;

Location to write the chart. If this and tardir are specified, tardir is appended to this (default “.”).

property devel

devel?: pulumi.Input<boolean>;

Use development versions, too. Equivalent to version ‘>0.0.0-0’. If –version is set, this is ignored.

property home

home?: pulumi.Input<string>;

Location of your Helm config. Overrides $HELM_HOME (default “/Users/alex/.helm”).

property keyFile

keyFile?: pulumi.Input<string>;

Identify HTTPS client using this SSL key file.

property keyring

keyring?: pulumi.Input<string>;

Keyring containing public keys (default “/Users/alex/.gnupg/pubring.gpg”).

property password

password?: pulumi.Input<string>;

Chart repository password.

property prov

prov?: pulumi.Input<boolean>;

Fetch the provenance file, but don’t perform verification.

property repo

repo?: pulumi.Input<string>;

Chart repository url where to locate the requested chart.

property untar

untar?: pulumi.Input<boolean>;

If set to false, will leave the chart as a tarball after downloading.

property untardir

untardir?: pulumi.Input<string>;

If untar is specified, this flag specifies the name of the directory into which the chart is expanded (default “.”).

property username

username?: pulumi.Input<string>;

Chart repository username.

property verify

verify?: pulumi.Input<boolean>;

Verify the package against its signature.

property version

version?: pulumi.Input<string>;

Specific version of a chart. Without this, the latest version is fetched.

interface LocalChartOpts

interface LocalChartOpts extends BaseChartOpts

The set of arguments for constructing a Chart resource from a local source.

property apiVersions

apiVersions?: pulumi.Input<pulumi.Input<string>[]>;

The optional kubernetes api versions used for Capabilities.APIVersions.

property namespace

namespace?: pulumi.Input<string>;

The optional namespace to install chart resources into.

property path

path: string;

The path to the chart directory which contains the Chart.yaml file.

property resourcePrefix

resourcePrefix?: undefined | string;

An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix=“foo” would produce a resource named “foo-resourceName”.

property transformations

transformations?: (o: any, opts: CustomResourceOptions) => void[];

A set of transformations to apply to Kubernetes resource definitions before registering with engine.

property values

values?: pulumi.Inputs;

Overrides for chart values.