import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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}} * ``` */ export declare 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: string, id: pulumi.Input, state?: NodePoolState, opts?: pulumi.CustomResourceOptions): 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: any): obj is NodePool; /** * Configuration required by cluster autoscaler to adjust * the size of the node pool to the current cluster usage. Structure is documented below. */ readonly autoscaling: pulumi.Output; /** * The cluster to create the node pool for. Cluster must be present in `location` provided for clusters. May be specified in the format `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}` or as just the name of the cluster. * * - - - */ readonly cluster: pulumi.Output; /** * The initial number of nodes for the pool. In * regional or multi-zonal clusters, this is the number of nodes per zone. Changing * this will force recreation of the resource. WARNING: Resizing your node pool manually * may change this value in your existing cluster, which will trigger destruction * and recreation on the next provider run (to rectify the discrepancy). If you don't * need this value, don't set it. If you do need it, you can use a lifecycle block to * ignore subsqeuent changes to this field. */ readonly initialNodeCount: pulumi.Output; /** * The resource URLs of the managed instance groups associated with this node pool. */ readonly instanceGroupUrls: pulumi.Output; /** * The location (region or zone) of the cluster. * * - - - */ readonly location: pulumi.Output; /** * List of instance group URLs which have been assigned to this node pool. */ readonly managedInstanceGroupUrls: pulumi.Output; /** * Node management configuration, wherein auto-repair and * auto-upgrade is configured. Structure is documented below. */ readonly management: pulumi.Output; /** * The maximum number of pods per node in this node pool. * Note that this does not work on node pools which are "route-based" - that is, node * pools belonging to clusters that do not have IP Aliasing enabled. * See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/flexible-pod-cidr) * for more information. */ readonly maxPodsPerNode: pulumi.Output; /** * The name of the node pool. If left blank, the provider will * auto-generate a unique name. */ readonly name: pulumi.Output; /** * Creates a unique name for the node pool beginning * with the specified prefix. Conflicts with `name`. */ readonly namePrefix: pulumi.Output; /** * The network configuration of the pool. Such as * configuration for [Adding Pod IP address ranges](https://cloud.google.com/kubernetes-engine/docs/how-to/multi-pod-cidr)) to the node pool. Or enabling private nodes. Structure is * documented below */ readonly networkConfig: pulumi.Output; /** * Parameters used in creating the node pool. See * gcp.container.Cluster for schema. */ readonly nodeConfig: pulumi.Output; /** * The number of nodes per instance group. This field can be used to * update the number of nodes per instance group but should not be used alongside `autoscaling`. */ readonly nodeCount: pulumi.Output; /** * The node drain configuration of the pool. Structure is documented below. */ readonly nodeDrainConfigs: pulumi.Output; /** * The list of zones in which the node pool's nodes should be located. Nodes must * be in the region of their regional cluster or in the same region as their * cluster's zone for zonal clusters. If unspecified, the cluster-level * `nodeLocations` will be used. * * > Note: `nodeLocations` will not revert to the cluster's default set of zones * upon being unset. You must manually reconcile the list of zones with your * cluster. */ readonly nodeLocations: pulumi.Output; readonly operation: pulumi.Output; /** * Specifies a custom placement policy for the * nodes. */ readonly placementPolicy: pulumi.Output; /** * The ID of the project in which to create the node pool. If blank, * the provider-configured project will be used. */ readonly project: pulumi.Output; /** * Specifies node pool-level settings of queued provisioning. * Structure is documented below. * * The `autoscaling` block supports (either total or per zone limits are required): */ readonly queuedProvisioning: pulumi.Output; /** * Specify node upgrade settings to change how GKE upgrades nodes. * The maximum number of nodes upgraded simultaneously is limited to 20. Structure is documented below. */ readonly upgradeSettings: pulumi.Output; /** * The Kubernetes version for the nodes in this pool. Note that if this field * and `autoUpgrade` are both specified, they will fight each other for what the node version should * be, so setting both is highly discouraged. While a fuzzy version can be specified, it's * recommended that you specify explicit versions as the provider will see spurious diffs * when fuzzy versions are used. See the `gcp.container.getEngineVersions` data source's * `versionPrefix` field to approximate fuzzy versions in a provider-compatible way. */ readonly version: pulumi.Output; /** * Create a NodePool 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: string, args: NodePoolArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering NodePool resources. */ export interface NodePoolState { /** * Configuration required by cluster autoscaler to adjust * the size of the node pool to the current cluster usage. Structure is documented below. */ autoscaling?: pulumi.Input; /** * The cluster to create the node pool for. Cluster must be present in `location` provided for clusters. May be specified in the format `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}` or as just the name of the cluster. * * - - - */ cluster?: pulumi.Input; /** * The initial number of nodes for the pool. In * regional or multi-zonal clusters, this is the number of nodes per zone. Changing * this will force recreation of the resource. WARNING: Resizing your node pool manually * may change this value in your existing cluster, which will trigger destruction * and recreation on the next provider run (to rectify the discrepancy). If you don't * need this value, don't set it. If you do need it, you can use a lifecycle block to * ignore subsqeuent changes to this field. */ initialNodeCount?: pulumi.Input; /** * The resource URLs of the managed instance groups associated with this node pool. */ instanceGroupUrls?: pulumi.Input[]>; /** * The location (region or zone) of the cluster. * * - - - */ location?: pulumi.Input; /** * List of instance group URLs which have been assigned to this node pool. */ managedInstanceGroupUrls?: pulumi.Input[]>; /** * Node management configuration, wherein auto-repair and * auto-upgrade is configured. Structure is documented below. */ management?: pulumi.Input; /** * The maximum number of pods per node in this node pool. * Note that this does not work on node pools which are "route-based" - that is, node * pools belonging to clusters that do not have IP Aliasing enabled. * See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/flexible-pod-cidr) * for more information. */ maxPodsPerNode?: pulumi.Input; /** * The name of the node pool. If left blank, the provider will * auto-generate a unique name. */ name?: pulumi.Input; /** * Creates a unique name for the node pool beginning * with the specified prefix. Conflicts with `name`. */ namePrefix?: pulumi.Input; /** * The network configuration of the pool. Such as * configuration for [Adding Pod IP address ranges](https://cloud.google.com/kubernetes-engine/docs/how-to/multi-pod-cidr)) to the node pool. Or enabling private nodes. Structure is * documented below */ networkConfig?: pulumi.Input; /** * Parameters used in creating the node pool. See * gcp.container.Cluster for schema. */ nodeConfig?: pulumi.Input; /** * The number of nodes per instance group. This field can be used to * update the number of nodes per instance group but should not be used alongside `autoscaling`. */ nodeCount?: pulumi.Input; /** * The node drain configuration of the pool. Structure is documented below. */ nodeDrainConfigs?: pulumi.Input[]>; /** * The list of zones in which the node pool's nodes should be located. Nodes must * be in the region of their regional cluster or in the same region as their * cluster's zone for zonal clusters. If unspecified, the cluster-level * `nodeLocations` will be used. * * > Note: `nodeLocations` will not revert to the cluster's default set of zones * upon being unset. You must manually reconcile the list of zones with your * cluster. */ nodeLocations?: pulumi.Input[]>; operation?: pulumi.Input; /** * Specifies a custom placement policy for the * nodes. */ placementPolicy?: pulumi.Input; /** * The ID of the project in which to create the node pool. If blank, * the provider-configured project will be used. */ project?: pulumi.Input; /** * Specifies node pool-level settings of queued provisioning. * Structure is documented below. * * The `autoscaling` block supports (either total or per zone limits are required): */ queuedProvisioning?: pulumi.Input; /** * Specify node upgrade settings to change how GKE upgrades nodes. * The maximum number of nodes upgraded simultaneously is limited to 20. Structure is documented below. */ upgradeSettings?: pulumi.Input; /** * The Kubernetes version for the nodes in this pool. Note that if this field * and `autoUpgrade` are both specified, they will fight each other for what the node version should * be, so setting both is highly discouraged. While a fuzzy version can be specified, it's * recommended that you specify explicit versions as the provider will see spurious diffs * when fuzzy versions are used. See the `gcp.container.getEngineVersions` data source's * `versionPrefix` field to approximate fuzzy versions in a provider-compatible way. */ version?: pulumi.Input; } /** * The set of arguments for constructing a NodePool resource. */ export interface NodePoolArgs { /** * Configuration required by cluster autoscaler to adjust * the size of the node pool to the current cluster usage. Structure is documented below. */ autoscaling?: pulumi.Input; /** * The cluster to create the node pool for. Cluster must be present in `location` provided for clusters. May be specified in the format `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}` or as just the name of the cluster. * * - - - */ cluster: pulumi.Input; /** * The initial number of nodes for the pool. In * regional or multi-zonal clusters, this is the number of nodes per zone. Changing * this will force recreation of the resource. WARNING: Resizing your node pool manually * may change this value in your existing cluster, which will trigger destruction * and recreation on the next provider run (to rectify the discrepancy). If you don't * need this value, don't set it. If you do need it, you can use a lifecycle block to * ignore subsqeuent changes to this field. */ initialNodeCount?: pulumi.Input; /** * The location (region or zone) of the cluster. * * - - - */ location?: pulumi.Input; /** * Node management configuration, wherein auto-repair and * auto-upgrade is configured. Structure is documented below. */ management?: pulumi.Input; /** * The maximum number of pods per node in this node pool. * Note that this does not work on node pools which are "route-based" - that is, node * pools belonging to clusters that do not have IP Aliasing enabled. * See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/flexible-pod-cidr) * for more information. */ maxPodsPerNode?: pulumi.Input; /** * The name of the node pool. If left blank, the provider will * auto-generate a unique name. */ name?: pulumi.Input; /** * Creates a unique name for the node pool beginning * with the specified prefix. Conflicts with `name`. */ namePrefix?: pulumi.Input; /** * The network configuration of the pool. Such as * configuration for [Adding Pod IP address ranges](https://cloud.google.com/kubernetes-engine/docs/how-to/multi-pod-cidr)) to the node pool. Or enabling private nodes. Structure is * documented below */ networkConfig?: pulumi.Input; /** * Parameters used in creating the node pool. See * gcp.container.Cluster for schema. */ nodeConfig?: pulumi.Input; /** * The number of nodes per instance group. This field can be used to * update the number of nodes per instance group but should not be used alongside `autoscaling`. */ nodeCount?: pulumi.Input; /** * The node drain configuration of the pool. Structure is documented below. */ nodeDrainConfigs?: pulumi.Input[]>; /** * The list of zones in which the node pool's nodes should be located. Nodes must * be in the region of their regional cluster or in the same region as their * cluster's zone for zonal clusters. If unspecified, the cluster-level * `nodeLocations` will be used. * * > Note: `nodeLocations` will not revert to the cluster's default set of zones * upon being unset. You must manually reconcile the list of zones with your * cluster. */ nodeLocations?: pulumi.Input[]>; /** * Specifies a custom placement policy for the * nodes. */ placementPolicy?: pulumi.Input; /** * The ID of the project in which to create the node pool. If blank, * the provider-configured project will be used. */ project?: pulumi.Input; /** * Specifies node pool-level settings of queued provisioning. * Structure is documented below. * * The `autoscaling` block supports (either total or per zone limits are required): */ queuedProvisioning?: pulumi.Input; /** * Specify node upgrade settings to change how GKE upgrades nodes. * The maximum number of nodes upgraded simultaneously is limited to 20. Structure is documented below. */ upgradeSettings?: pulumi.Input; /** * The Kubernetes version for the nodes in this pool. Note that if this field * and `autoUpgrade` are both specified, they will fight each other for what the node version should * be, so setting both is highly discouraged. While a fuzzy version can be specified, it's * recommended that you specify explicit versions as the provider will see spurious diffs * when fuzzy versions are used. See the `gcp.container.getEngineVersions` data source's * `versionPrefix` field to approximate fuzzy versions in a provider-compatible way. */ version?: pulumi.Input; }