UNPKG

@pulumi/gcp

Version:

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

181 lines • 8.43 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.NodePool = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = 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}} * ``` * * ```sh * $ 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.autoscaling : undefined; resourceInputs["cluster"] = state ? state.cluster : undefined; resourceInputs["initialNodeCount"] = state ? state.initialNodeCount : undefined; resourceInputs["instanceGroupUrls"] = state ? state.instanceGroupUrls : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["managedInstanceGroupUrls"] = state ? state.managedInstanceGroupUrls : undefined; resourceInputs["management"] = state ? state.management : undefined; resourceInputs["maxPodsPerNode"] = state ? state.maxPodsPerNode : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namePrefix"] = state ? state.namePrefix : undefined; resourceInputs["networkConfig"] = state ? state.networkConfig : undefined; resourceInputs["nodeConfig"] = state ? state.nodeConfig : undefined; resourceInputs["nodeCount"] = state ? state.nodeCount : undefined; resourceInputs["nodeLocations"] = state ? state.nodeLocations : undefined; resourceInputs["operation"] = state ? state.operation : undefined; resourceInputs["placementPolicy"] = state ? state.placementPolicy : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["queuedProvisioning"] = state ? state.queuedProvisioning : undefined; resourceInputs["upgradeSettings"] = state ? state.upgradeSettings : undefined; resourceInputs["version"] = state ? state.version : undefined; } else { const args = argsOrState; if ((!args || args.cluster === undefined) && !opts.urn) { throw new Error("Missing required property 'cluster'"); } resourceInputs["autoscaling"] = args ? args.autoscaling : undefined; resourceInputs["cluster"] = args ? args.cluster : undefined; resourceInputs["initialNodeCount"] = args ? args.initialNodeCount : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["management"] = args ? args.management : undefined; resourceInputs["maxPodsPerNode"] = args ? args.maxPodsPerNode : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namePrefix"] = args ? args.namePrefix : undefined; resourceInputs["networkConfig"] = args ? args.networkConfig : undefined; resourceInputs["nodeConfig"] = args ? args.nodeConfig : undefined; resourceInputs["nodeCount"] = args ? args.nodeCount : undefined; resourceInputs["nodeLocations"] = args ? args.nodeLocations : undefined; resourceInputs["placementPolicy"] = args ? args.placementPolicy : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["queuedProvisioning"] = args ? args.queuedProvisioning : undefined; resourceInputs["upgradeSettings"] = args ? args.upgradeSettings : undefined; resourceInputs["version"] = args ? args.version : undefined; 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; /** @internal */ NodePool.__pulumiType = 'gcp:container/nodePool:NodePool'; //# sourceMappingURL=nodePool.js.map