UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

204 lines • 9.01 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! *** 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.NodePool = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Manages a node pool in a Google Kubernetes Engine (GKE) cluster separately from * the cluster control plane. For more information see [the official documentation](https://cloud.google.com/container-engine/docs/node-pools) * and [the API reference](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters.nodePools). * * ## Example Usage * * ### Using A Separately Managed Node Pool (Recommended) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.serviceaccount.Account("default", { * accountId: "service-account-id", * displayName: "Service Account", * }); * const primary = new gcp.container.Cluster("primary", { * name: "my-gke-cluster", * location: "us-central1", * removeDefaultNodePool: true, * initialNodeCount: 1, * }); * const primaryPreemptibleNodes = new gcp.container.NodePool("primary_preemptible_nodes", { * name: "my-node-pool", * cluster: primary.id, * nodeCount: 1, * nodeConfig: { * preemptible: true, * machineType: "e2-medium", * serviceAccount: _default.email, * oauthScopes: ["https://www.googleapis.com/auth/cloud-platform"], * }, * }); * ``` * * ### 2 Node Pools, 1 Separately Managed + The Default Node Pool * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.serviceaccount.Account("default", { * accountId: "service-account-id", * displayName: "Service Account", * }); * const primary = new gcp.container.Cluster("primary", { * name: "marcellus-wallace", * location: "us-central1-a", * initialNodeCount: 3, * nodeLocations: ["us-central1-c"], * nodeConfig: { * serviceAccount: _default.email, * oauthScopes: ["https://www.googleapis.com/auth/cloud-platform"], * guestAccelerators: [{ * type: "nvidia-tesla-k80", * count: 1, * }], * }, * }); * const np = new gcp.container.NodePool("np", { * name: "my-node-pool", * cluster: primary.id, * nodeConfig: { * machineType: "e2-medium", * serviceAccount: _default.email, * oauthScopes: ["https://www.googleapis.com/auth/cloud-platform"], * }, * }); * ``` * * ## Import * * Node pools can be imported using the `project`, `location`, `cluster` and `name`. If * the project is omitted, the project value in the provider configuration will be used. Examples: * * * `{{project_id}}/{{location}}/{{cluster_id}}/{{pool_id}}` * * `{{location}}/{{cluster_id}}/{{pool_id}}` * * When using the `pulumi import` command, node pools can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:container/nodePool:NodePool default {{project_id}}/{{location}}/{{cluster_id}}/{{pool_id}} * * $ pulumi import gcp:container/nodePool:NodePool default {{location}}/{{cluster_id}}/{{pool_id}} * ``` */ class NodePool extends pulumi.CustomResource { /** * Get an existing NodePool 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 NodePool(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:container/nodePool:NodePool'; /** * Returns true if the given object is an instance of NodePool. 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'] === NodePool.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["autoscaling"] = state?.autoscaling; resourceInputs["cluster"] = state?.cluster; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["initialNodeCount"] = state?.initialNodeCount; resourceInputs["instanceGroupUrls"] = state?.instanceGroupUrls; resourceInputs["location"] = state?.location; resourceInputs["managedInstanceGroupUrls"] = state?.managedInstanceGroupUrls; resourceInputs["management"] = state?.management; resourceInputs["maxPodsPerNode"] = state?.maxPodsPerNode; resourceInputs["name"] = state?.name; resourceInputs["namePrefix"] = state?.namePrefix; resourceInputs["networkConfig"] = state?.networkConfig; resourceInputs["nodeConfig"] = state?.nodeConfig; resourceInputs["nodeCount"] = state?.nodeCount; resourceInputs["nodeDrainConfigs"] = state?.nodeDrainConfigs; resourceInputs["nodeLocations"] = state?.nodeLocations; resourceInputs["operation"] = state?.operation; resourceInputs["placementPolicy"] = state?.placementPolicy; resourceInputs["project"] = state?.project; resourceInputs["queuedProvisioning"] = state?.queuedProvisioning; resourceInputs["upgradeSettings"] = state?.upgradeSettings; resourceInputs["version"] = state?.version; } else { const args = argsOrState; if (args?.cluster === undefined && !opts.urn) { throw new Error("Missing required property 'cluster'"); } resourceInputs["autoscaling"] = args?.autoscaling; resourceInputs["cluster"] = args?.cluster; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["initialNodeCount"] = args?.initialNodeCount; resourceInputs["location"] = args?.location; resourceInputs["management"] = args?.management; resourceInputs["maxPodsPerNode"] = args?.maxPodsPerNode; resourceInputs["name"] = args?.name; resourceInputs["namePrefix"] = args?.namePrefix; resourceInputs["networkConfig"] = args?.networkConfig; resourceInputs["nodeConfig"] = args?.nodeConfig; resourceInputs["nodeCount"] = args?.nodeCount; resourceInputs["nodeDrainConfigs"] = args?.nodeDrainConfigs; resourceInputs["nodeLocations"] = args?.nodeLocations; resourceInputs["placementPolicy"] = args?.placementPolicy; resourceInputs["project"] = args?.project; resourceInputs["queuedProvisioning"] = args?.queuedProvisioning; resourceInputs["upgradeSettings"] = args?.upgradeSettings; resourceInputs["version"] = args?.version; resourceInputs["instanceGroupUrls"] = undefined /*out*/; resourceInputs["managedInstanceGroupUrls"] = undefined /*out*/; resourceInputs["operation"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(NodePool.__pulumiType, name, resourceInputs, opts); } } exports.NodePool = NodePool; //# sourceMappingURL=nodePool.js.map