UNPKG

@pulumi/kubernetes

Version:

[![Build Status](https://travis-ci.com/pulumi/pulumi-kubernetes.svg?token=eHg7Zp5zdDDJfTjY8ejq&branch=master)](https://travis-ci.com/pulumi/pulumi-kubernetes) [![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM

278 lines • 12.1 kB
"use strict"; // *** WARNING: this file was generated by pulumigen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Release = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../../utilities"); /** * A `Release` is an instance of a chart running in a Kubernetes cluster. A `Chart` is a Helm package. It contains all the * resource definitions necessary to run an application, tool, or service inside a Kubernetes cluster. * * This resource models a Helm Release as if it were created by the Helm CLI. The underlying implementation embeds Helm as * a library to perform the orchestration of the resources. As a result, the full spectrum of Helm features are supported * natively. * * You may also want to consider the `Chart` resource as an alternative method for managing helm charts. For more information about the trade-offs between these options see: [Choosing the right Helm resource for your use case](https://www.pulumi.com/registry/packages/kubernetes/how-to-guides/choosing-the-right-helm-resource-for-your-use-case) * * ## Example Usage * ### Local Chart Directory * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const nginxIngress = new k8s.helm.v3.Release("nginx-ingress", { * chart: "./nginx-ingress", * }); * ``` * ### Remote Chart * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const nginxIngress = new k8s.helm.v3.Release("nginx-ingress", { * chart: "nginx-ingress", * version: "1.24.4", * repositoryOpts: { * repo: "https://charts.helm.sh/stable", * }, * }); * ``` * ### Set Chart Values * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const nginxIngress = new k8s.helm.v3.Release("nginx-ingress", { * chart: "nginx-ingress", * version: "1.24.4", * repositoryOpts: { * repo: "https://charts.helm.sh/stable", * }, * values: { * controller: { * metrics: { * enabled: true, * } * } * }, * }); * ``` * ### Deploy Chart into Namespace * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const nginxIngress = new k8s.helm.v3.Release("nginx-ingress", { * chart: "nginx-ingress", * version: "1.24.4", * namespace: "test-namespace", * repositoryOpts: { * repo: "https://charts.helm.sh/stable", * }, * }); * ``` * * ### Depend on a Chart resource * * ```typescript * import * as k8s from "@pulumi/kubernetes"; * * const nginxIngress = new k8s.helm.v3.Release("nginx-ingress", { * chart: "nginx-ingress", * version: "1.24.4", * namespace: "test-namespace", * repositoryOpts: { * repo: "https://charts.helm.sh/stable", * }, * skipAwait: false, * }); * * // Create a ConfigMap depending on the Chart. The ConfigMap will not be created until after all of the Chart * // resources are ready. Notice skipAwait is set to false above. This is the default and will cause Helm * // to await the underlying resources to be available. Setting it to true will make the ConfigMap available right away. * new k8s.core.v1.ConfigMap("foo", { * metadata: {namespace: namespaceName}, * data: {foo: "bar"} * }, {dependsOn: nginxIngress}) * ``` * ### Specify Helm Chart Values in File and Code * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as k8s from "@pulumi/kubernetes"; * import {FileAsset} from "@pulumi/pulumi/asset"; * * const release = new k8s.helm.v3.Release("redis", { * chart: "redis", * repositoryOpts: { * repo: "https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami", * }, * valueYamlFiles: [new FileAsset("./metrics.yml")], * values: { * cluster: { * enabled: true, * }, * rbac: { * create: true, * } * }, * }); * * // -- Contents of metrics.yml -- * // metrics: * // enabled: true * ``` * ### Query Kubernetes Resource Installed By Helm Chart * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as k8s from "@pulumi/kubernetes"; * import {FileAsset} from "@pulumi/pulumi/asset"; * * const redis = new k8s.helm.v3.Release("redis", { * chart: "redis", * repositoryOpts: { * repo: "https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami", * }, * values: { * cluster: { * enabled: true, * }, * rbac: { * create: true, * } * }, * }); * * // srv will only resolve after the redis chart is installed. * const srv = k8s.core.v1.Service.get("redis-master-svc", pulumi.interpolate`${redis.status.namespace}/${redis.status.name}-master`); * export const redisMasterClusterIP = srv.spec.clusterIP; * ``` * * ## Import * * An existing Helm Release resource can be imported using its `type token`, `name` and identifier, e.g. * * ```sh * $ pulumi import kubernetes:helm.sh/v3:Release myRelease <namespace>/<releaseName> * ``` */ class Release extends pulumi.CustomResource { /** * Get an existing Release resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, opts) { return new Release(name, undefined, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Release. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Release.__pulumiType; } /** * Create a Release resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name, args, opts) { let resourceInputs = {}; opts = opts || {}; if (!opts.id) { if ((!args || args.chart === undefined) && !opts.urn) { throw new Error("Missing required property 'chart'"); } resourceInputs["allowNullValues"] = args ? args.allowNullValues : undefined; resourceInputs["atomic"] = args ? args.atomic : undefined; resourceInputs["chart"] = args ? args.chart : undefined; resourceInputs["cleanupOnFail"] = args ? args.cleanupOnFail : undefined; resourceInputs["compat"] = "true"; resourceInputs["createNamespace"] = args ? args.createNamespace : undefined; resourceInputs["dependencyUpdate"] = args ? args.dependencyUpdate : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["devel"] = args ? args.devel : undefined; resourceInputs["disableCRDHooks"] = args ? args.disableCRDHooks : undefined; resourceInputs["disableOpenapiValidation"] = args ? args.disableOpenapiValidation : undefined; resourceInputs["disableWebhooks"] = args ? args.disableWebhooks : undefined; resourceInputs["forceUpdate"] = args ? args.forceUpdate : undefined; resourceInputs["keyring"] = args ? args.keyring : undefined; resourceInputs["lint"] = args ? args.lint : undefined; resourceInputs["manifest"] = args ? args.manifest : undefined; resourceInputs["maxHistory"] = args ? args.maxHistory : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["postrender"] = args ? args.postrender : undefined; resourceInputs["recreatePods"] = args ? args.recreatePods : undefined; resourceInputs["renderSubchartNotes"] = args ? args.renderSubchartNotes : undefined; resourceInputs["replace"] = args ? args.replace : undefined; resourceInputs["repositoryOpts"] = args ? args.repositoryOpts : undefined; resourceInputs["resetValues"] = args ? args.resetValues : undefined; resourceInputs["resourceNames"] = args ? args.resourceNames : undefined; resourceInputs["reuseValues"] = args ? args.reuseValues : undefined; resourceInputs["skipAwait"] = args ? args.skipAwait : undefined; resourceInputs["skipCrds"] = args ? args.skipCrds : undefined; resourceInputs["timeout"] = args ? args.timeout : undefined; resourceInputs["valueYamlFiles"] = args ? args.valueYamlFiles : undefined; resourceInputs["values"] = args ? args.values : undefined; resourceInputs["verify"] = args ? args.verify : undefined; resourceInputs["version"] = args ? args.version : undefined; resourceInputs["waitForJobs"] = args ? args.waitForJobs : undefined; resourceInputs["status"] = undefined /*out*/; } else { resourceInputs["allowNullValues"] = undefined /*out*/; resourceInputs["atomic"] = undefined /*out*/; resourceInputs["chart"] = undefined /*out*/; resourceInputs["cleanupOnFail"] = undefined /*out*/; resourceInputs["createNamespace"] = undefined /*out*/; resourceInputs["dependencyUpdate"] = undefined /*out*/; resourceInputs["description"] = undefined /*out*/; resourceInputs["devel"] = undefined /*out*/; resourceInputs["disableCRDHooks"] = undefined /*out*/; resourceInputs["disableOpenapiValidation"] = undefined /*out*/; resourceInputs["disableWebhooks"] = undefined /*out*/; resourceInputs["forceUpdate"] = undefined /*out*/; resourceInputs["keyring"] = undefined /*out*/; resourceInputs["lint"] = undefined /*out*/; resourceInputs["manifest"] = undefined /*out*/; resourceInputs["maxHistory"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["namespace"] = undefined /*out*/; resourceInputs["postrender"] = undefined /*out*/; resourceInputs["recreatePods"] = undefined /*out*/; resourceInputs["renderSubchartNotes"] = undefined /*out*/; resourceInputs["replace"] = undefined /*out*/; resourceInputs["repositoryOpts"] = undefined /*out*/; resourceInputs["resetValues"] = undefined /*out*/; resourceInputs["resourceNames"] = undefined /*out*/; resourceInputs["reuseValues"] = undefined /*out*/; resourceInputs["skipAwait"] = undefined /*out*/; resourceInputs["skipCrds"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["timeout"] = undefined /*out*/; resourceInputs["valueYamlFiles"] = undefined /*out*/; resourceInputs["values"] = undefined /*out*/; resourceInputs["verify"] = undefined /*out*/; resourceInputs["version"] = undefined /*out*/; resourceInputs["waitForJobs"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Release.__pulumiType, name, resourceInputs, opts); } } exports.Release = Release; /** @internal */ Release.__pulumiType = 'kubernetes:helm.sh/v3:Release'; //# sourceMappingURL=release.js.map