UNPKG

@pulumi/kubernetes

Version:

[![Actions Status](https://github.com/pulumi/pulumi-kubernetes/workflows/main/badge.svg)](https://github.com/pulumi/pulumi-kubernetes/actions) [![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM version](https:/

317 lines • 13 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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Release = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(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; * ``` * ### Take Ownership of Existing Resources * * ```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", * }, * takeOwnership: true, * }); * ``` * * ## 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, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'kubernetes:helm.sh/v3:Release'; /** * 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?.chart === undefined && !opts.urn) { throw new Error("Missing required property 'chart'"); } resourceInputs["allowNullValues"] = args?.allowNullValues; resourceInputs["atomic"] = args?.atomic; resourceInputs["chart"] = args?.chart; resourceInputs["cleanupOnFail"] = args?.cleanupOnFail; resourceInputs["compat"] = "true"; resourceInputs["createNamespace"] = args?.createNamespace; resourceInputs["dependencyUpdate"] = args?.dependencyUpdate; resourceInputs["description"] = args?.description; resourceInputs["devel"] = args?.devel; resourceInputs["disableCRDHooks"] = args?.disableCRDHooks; resourceInputs["disableOpenapiValidation"] = args?.disableOpenapiValidation; resourceInputs["disableWebhooks"] = args?.disableWebhooks; resourceInputs["forceUpdate"] = args?.forceUpdate; resourceInputs["keyring"] = args?.keyring; resourceInputs["lint"] = args?.lint; resourceInputs["manifest"] = args?.manifest; resourceInputs["maxHistory"] = args?.maxHistory; resourceInputs["name"] = args?.name; resourceInputs["namespace"] = args?.namespace; resourceInputs["postrender"] = args?.postrender; resourceInputs["recreatePods"] = args?.recreatePods; resourceInputs["renderSubchartNotes"] = args?.renderSubchartNotes; resourceInputs["replace"] = args?.replace; resourceInputs["repositoryOpts"] = args?.repositoryOpts; resourceInputs["resetValues"] = args?.resetValues; resourceInputs["resourceNames"] = args?.resourceNames; resourceInputs["reuseValues"] = args?.reuseValues; resourceInputs["skipAwait"] = args?.skipAwait; resourceInputs["skipCrds"] = args?.skipCrds; resourceInputs["takeOwnership"] = args?.takeOwnership; resourceInputs["timeout"] = args?.timeout; resourceInputs["valueYamlFiles"] = args?.valueYamlFiles; resourceInputs["values"] = args?.values; resourceInputs["verify"] = args?.verify; resourceInputs["version"] = args?.version; resourceInputs["waitForJobs"] = args?.waitForJobs; 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["takeOwnership"] = 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; //# sourceMappingURL=release.js.map