UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

153 lines 6 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.KubernetesNodePool = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a DigitalOcean Kubernetes node pool resource. While the default node pool must be defined in the `digitalocean.KubernetesCluster` resource, this resource can be used to add additional ones to a cluster. * * ## Example Usage * * ### Basic Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const foo = new digitalocean.KubernetesCluster("foo", { * name: "foo", * region: digitalocean.Region.NYC1, * version: "1.22.8-do.1", * nodePool: { * name: "front-end-pool", * size: "s-2vcpu-2gb", * nodeCount: 3, * }, * }); * const bar = new digitalocean.KubernetesNodePool("bar", { * clusterId: foo.id, * name: "backend-pool", * size: digitalocean.DropletSlug.DropletC2, * nodeCount: 2, * tags: ["backend"], * labels: { * service: "backend", * priority: "high", * }, * taints: [{ * key: "workloadKind", * value: "database", * effect: "NoSchedule", * }], * }); * ``` * * ### Autoscaling Example * * Node pools may also be configured to [autoscale](https://www.digitalocean.com/docs/kubernetes/how-to/autoscale/). * For example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const autoscale_pool_01 = new digitalocean.KubernetesNodePool("autoscale-pool-01", { * clusterId: foo.id, * name: "autoscale-pool-01", * size: digitalocean.DropletSlug.DropletS1VCPU2GB, * autoScale: true, * minNodes: 1, * maxNodes: 5, * }); * ``` * * ## Import * * If you are importing an existing Kubernetes cluster with a single node pool, just * * import the cluster. Additional node pools can be imported by using their `id`, e.g. * * ```sh * $ pulumi import digitalocean:index/kubernetesNodePool:KubernetesNodePool mynodepool 9d76f410-9284-4436-9633-4066852442c8 * ``` * * Note: If the node pool has the `terraform:default-node-pool` tag, then it is a default node pool for an * * existing cluster. The provider will refuse to import the node pool in that case because the node pool * * is managed by the `digitalocean_kubernetes_cluster` resource and not by this * * `digitalocean_kubernetes_node_pool` resource. */ class KubernetesNodePool extends pulumi.CustomResource { /** * Get an existing KubernetesNodePool 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 state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new KubernetesNodePool(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of KubernetesNodePool. 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'] === KubernetesNodePool.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["actualNodeCount"] = state?.actualNodeCount; resourceInputs["autoScale"] = state?.autoScale; resourceInputs["clusterId"] = state?.clusterId; resourceInputs["labels"] = state?.labels; resourceInputs["maxNodes"] = state?.maxNodes; resourceInputs["minNodes"] = state?.minNodes; resourceInputs["name"] = state?.name; resourceInputs["nodeCount"] = state?.nodeCount; resourceInputs["nodes"] = state?.nodes; resourceInputs["size"] = state?.size; resourceInputs["tags"] = state?.tags; resourceInputs["taints"] = state?.taints; } else { const args = argsOrState; if (args?.clusterId === undefined && !opts.urn) { throw new Error("Missing required property 'clusterId'"); } if (args?.size === undefined && !opts.urn) { throw new Error("Missing required property 'size'"); } resourceInputs["autoScale"] = args?.autoScale; resourceInputs["clusterId"] = args?.clusterId; resourceInputs["labels"] = args?.labels; resourceInputs["maxNodes"] = args?.maxNodes; resourceInputs["minNodes"] = args?.minNodes; resourceInputs["name"] = args?.name; resourceInputs["nodeCount"] = args?.nodeCount; resourceInputs["size"] = args?.size; resourceInputs["tags"] = args?.tags; resourceInputs["taints"] = args?.taints; resourceInputs["actualNodeCount"] = undefined /*out*/; resourceInputs["nodes"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(KubernetesNodePool.__pulumiType, name, resourceInputs, opts); } } exports.KubernetesNodePool = KubernetesNodePool; /** @internal */ KubernetesNodePool.__pulumiType = 'digitalocean:index/kubernetesNodePool:KubernetesNodePool'; //# sourceMappingURL=kubernetesNodePool.js.map