All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.container.kotlin.NodePoolArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.container.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.container.NodePoolArgs.builder
import com.pulumi.gcp.container.kotlin.inputs.NodePoolAutoscalingArgs
import com.pulumi.gcp.container.kotlin.inputs.NodePoolAutoscalingArgsBuilder
import com.pulumi.gcp.container.kotlin.inputs.NodePoolManagementArgs
import com.pulumi.gcp.container.kotlin.inputs.NodePoolManagementArgsBuilder
import com.pulumi.gcp.container.kotlin.inputs.NodePoolNetworkConfigArgs
import com.pulumi.gcp.container.kotlin.inputs.NodePoolNetworkConfigArgsBuilder
import com.pulumi.gcp.container.kotlin.inputs.NodePoolNodeConfigArgs
import com.pulumi.gcp.container.kotlin.inputs.NodePoolNodeConfigArgsBuilder
import com.pulumi.gcp.container.kotlin.inputs.NodePoolPlacementPolicyArgs
import com.pulumi.gcp.container.kotlin.inputs.NodePoolPlacementPolicyArgsBuilder
import com.pulumi.gcp.container.kotlin.inputs.NodePoolQueuedProvisioningArgs
import com.pulumi.gcp.container.kotlin.inputs.NodePoolQueuedProvisioningArgsBuilder
import com.pulumi.gcp.container.kotlin.inputs.NodePoolUpgradeSettingsArgs
import com.pulumi.gcp.container.kotlin.inputs.NodePoolUpgradeSettingsArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * 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"],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.serviceaccount.Account("default",
 *     account_id="service-account-id",
 *     display_name="Service Account")
 * primary = gcp.container.Cluster("primary",
 *     name="my-gke-cluster",
 *     location="us-central1",
 *     remove_default_node_pool=True,
 *     initial_node_count=1)
 * primary_preemptible_nodes = gcp.container.NodePool("primary_preemptible_nodes",
 *     name="my-node-pool",
 *     cluster=primary.id,
 *     node_count=1,
 *     node_config=gcp.container.NodePoolNodeConfigArgs(
 *         preemptible=True,
 *         machine_type="e2-medium",
 *         service_account=default.email,
 *         oauth_scopes=["https://www.googleapis.com/auth/cloud-platform"],
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.ServiceAccount.Account("default", new()
 *     {
 *         AccountId = "service-account-id",
 *         DisplayName = "Service Account",
 *     });
 *     var primary = new Gcp.Container.Cluster("primary", new()
 *     {
 *         Name = "my-gke-cluster",
 *         Location = "us-central1",
 *         RemoveDefaultNodePool = true,
 *         InitialNodeCount = 1,
 *     });
 *     var primaryPreemptibleNodes = new Gcp.Container.NodePool("primary_preemptible_nodes", new()
 *     {
 *         Name = "my-node-pool",
 *         Cluster = primary.Id,
 *         NodeCount = 1,
 *         NodeConfig = new Gcp.Container.Inputs.NodePoolNodeConfigArgs
 *         {
 *             Preemptible = true,
 *             MachineType = "e2-medium",
 *             ServiceAccount = @default.Email,
 *             OauthScopes = new[]
 *             {
 *                 "https://www.googleapis.com/auth/cloud-platform",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
 * 			AccountId:   pulumi.String("service-account-id"),
 * 			DisplayName: pulumi.String("Service Account"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
 * 			Name:                  pulumi.String("my-gke-cluster"),
 * 			Location:              pulumi.String("us-central1"),
 * 			RemoveDefaultNodePool: pulumi.Bool(true),
 * 			InitialNodeCount:      pulumi.Int(1),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = container.NewNodePool(ctx, "primary_preemptible_nodes", &container.NodePoolArgs{
 * 			Name:      pulumi.String("my-node-pool"),
 * 			Cluster:   primary.ID(),
 * 			NodeCount: pulumi.Int(1),
 * 			NodeConfig: &container.NodePoolNodeConfigArgs{
 * 				Preemptible:    pulumi.Bool(true),
 * 				MachineType:    pulumi.String("e2-medium"),
 * 				ServiceAccount: _default.Email,
 * 				OauthScopes: pulumi.StringArray{
 * 					pulumi.String("https://www.googleapis.com/auth/cloud-platform"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.serviceaccount.Account;
 * import com.pulumi.gcp.serviceaccount.AccountArgs;
 * import com.pulumi.gcp.container.Cluster;
 * import com.pulumi.gcp.container.ClusterArgs;
 * import com.pulumi.gcp.container.NodePool;
 * import com.pulumi.gcp.container.NodePoolArgs;
 * import com.pulumi.gcp.container.inputs.NodePoolNodeConfigArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var default_ = new Account("default", AccountArgs.builder()
 *             .accountId("service-account-id")
 *             .displayName("Service Account")
 *             .build());
 *         var primary = new Cluster("primary", ClusterArgs.builder()
 *             .name("my-gke-cluster")
 *             .location("us-central1")
 *             .removeDefaultNodePool(true)
 *             .initialNodeCount(1)
 *             .build());
 *         var primaryPreemptibleNodes = new NodePool("primaryPreemptibleNodes", NodePoolArgs.builder()
 *             .name("my-node-pool")
 *             .cluster(primary.id())
 *             .nodeCount(1)
 *             .nodeConfig(NodePoolNodeConfigArgs.builder()
 *                 .preemptible(true)
 *                 .machineType("e2-medium")
 *                 .serviceAccount(default_.email())
 *                 .oauthScopes("https://www.googleapis.com/auth/cloud-platform")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:serviceaccount:Account
 *     properties:
 *       accountId: service-account-id
 *       displayName: Service Account
 *   primary:
 *     type: gcp:container:Cluster
 *     properties:
 *       name: my-gke-cluster
 *       location: us-central1
 *       removeDefaultNodePool: true
 *       initialNodeCount: 1
 *   primaryPreemptibleNodes:
 *     type: gcp:container:NodePool
 *     name: primary_preemptible_nodes
 *     properties:
 *       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"],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.serviceaccount.Account("default",
 *     account_id="service-account-id",
 *     display_name="Service Account")
 * primary = gcp.container.Cluster("primary",
 *     name="marcellus-wallace",
 *     location="us-central1-a",
 *     initial_node_count=3,
 *     node_locations=["us-central1-c"],
 *     node_config=gcp.container.ClusterNodeConfigArgs(
 *         service_account=default.email,
 *         oauth_scopes=["https://www.googleapis.com/auth/cloud-platform"],
 *         guest_accelerators=[gcp.container.ClusterNodeConfigGuestAcceleratorArgs(
 *             type="nvidia-tesla-k80",
 *             count=1,
 *         )],
 *     ))
 * np = gcp.container.NodePool("np",
 *     name="my-node-pool",
 *     cluster=primary.id,
 *     node_config=gcp.container.NodePoolNodeConfigArgs(
 *         machine_type="e2-medium",
 *         service_account=default.email,
 *         oauth_scopes=["https://www.googleapis.com/auth/cloud-platform"],
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.ServiceAccount.Account("default", new()
 *     {
 *         AccountId = "service-account-id",
 *         DisplayName = "Service Account",
 *     });
 *     var primary = new Gcp.Container.Cluster("primary", new()
 *     {
 *         Name = "marcellus-wallace",
 *         Location = "us-central1-a",
 *         InitialNodeCount = 3,
 *         NodeLocations = new[]
 *         {
 *             "us-central1-c",
 *         },
 *         NodeConfig = new Gcp.Container.Inputs.ClusterNodeConfigArgs
 *         {
 *             ServiceAccount = @default.Email,
 *             OauthScopes = new[]
 *             {
 *                 "https://www.googleapis.com/auth/cloud-platform",
 *             },
 *             GuestAccelerators = new[]
 *             {
 *                 new Gcp.Container.Inputs.ClusterNodeConfigGuestAcceleratorArgs
 *                 {
 *                     Type = "nvidia-tesla-k80",
 *                     Count = 1,
 *                 },
 *             },
 *         },
 *     });
 *     var np = new Gcp.Container.NodePool("np", new()
 *     {
 *         Name = "my-node-pool",
 *         Cluster = primary.Id,
 *         NodeConfig = new Gcp.Container.Inputs.NodePoolNodeConfigArgs
 *         {
 *             MachineType = "e2-medium",
 *             ServiceAccount = @default.Email,
 *             OauthScopes = new[]
 *             {
 *                 "https://www.googleapis.com/auth/cloud-platform",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
 * 			AccountId:   pulumi.String("service-account-id"),
 * 			DisplayName: pulumi.String("Service Account"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
 * 			Name:             pulumi.String("marcellus-wallace"),
 * 			Location:         pulumi.String("us-central1-a"),
 * 			InitialNodeCount: pulumi.Int(3),
 * 			NodeLocations: pulumi.StringArray{
 * 				pulumi.String("us-central1-c"),
 * 			},
 * 			NodeConfig: &container.ClusterNodeConfigArgs{
 * 				ServiceAccount: _default.Email,
 * 				OauthScopes: pulumi.StringArray{
 * 					pulumi.String("https://www.googleapis.com/auth/cloud-platform"),
 * 				},
 * 				GuestAccelerators: container.ClusterNodeConfigGuestAcceleratorArray{
 * 					&container.ClusterNodeConfigGuestAcceleratorArgs{
 * 						Type:  pulumi.String("nvidia-tesla-k80"),
 * 						Count: pulumi.Int(1),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = container.NewNodePool(ctx, "np", &container.NodePoolArgs{
 * 			Name:    pulumi.String("my-node-pool"),
 * 			Cluster: primary.ID(),
 * 			NodeConfig: &container.NodePoolNodeConfigArgs{
 * 				MachineType:    pulumi.String("e2-medium"),
 * 				ServiceAccount: _default.Email,
 * 				OauthScopes: pulumi.StringArray{
 * 					pulumi.String("https://www.googleapis.com/auth/cloud-platform"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.serviceaccount.Account;
 * import com.pulumi.gcp.serviceaccount.AccountArgs;
 * import com.pulumi.gcp.container.Cluster;
 * import com.pulumi.gcp.container.ClusterArgs;
 * import com.pulumi.gcp.container.inputs.ClusterNodeConfigArgs;
 * import com.pulumi.gcp.container.NodePool;
 * import com.pulumi.gcp.container.NodePoolArgs;
 * import com.pulumi.gcp.container.inputs.NodePoolNodeConfigArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var default_ = new Account("default", AccountArgs.builder()
 *             .accountId("service-account-id")
 *             .displayName("Service Account")
 *             .build());
 *         var primary = new Cluster("primary", ClusterArgs.builder()
 *             .name("marcellus-wallace")
 *             .location("us-central1-a")
 *             .initialNodeCount(3)
 *             .nodeLocations("us-central1-c")
 *             .nodeConfig(ClusterNodeConfigArgs.builder()
 *                 .serviceAccount(default_.email())
 *                 .oauthScopes("https://www.googleapis.com/auth/cloud-platform")
 *                 .guestAccelerators(ClusterNodeConfigGuestAcceleratorArgs.builder()
 *                     .type("nvidia-tesla-k80")
 *                     .count(1)
 *                     .build())
 *                 .build())
 *             .build());
 *         var np = new NodePool("np", NodePoolArgs.builder()
 *             .name("my-node-pool")
 *             .cluster(primary.id())
 *             .nodeConfig(NodePoolNodeConfigArgs.builder()
 *                 .machineType("e2-medium")
 *                 .serviceAccount(default_.email())
 *                 .oauthScopes("https://www.googleapis.com/auth/cloud-platform")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:serviceaccount:Account
 *     properties:
 *       accountId: service-account-id
 *       displayName: Service Account
 *   np:
 *     type: gcp:container:NodePool
 *     properties:
 *       name: my-node-pool
 *       cluster: ${primary.id}
 *       nodeConfig:
 *         machineType: e2-medium
 *         serviceAccount: ${default.email}
 *         oauthScopes:
 *           - https://www.googleapis.com/auth/cloud-platform
 *   primary:
 *     type: gcp:container:Cluster
 *     properties:
 *       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
 * ```
 * 
 * ## 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}}
 * ```
 * @property autoscaling Configuration required by cluster autoscaler to adjust
 * the size of the node pool to the current cluster usage. Structure is documented below.
 * @property cluster 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.
 * - - -
 * @property initialNodeCount 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.
 * @property location The location (region or zone) of the cluster.
 * - - -
 * @property management Node management configuration, wherein auto-repair and
 * auto-upgrade is configured. Structure is documented below.
 * @property maxPodsPerNode 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.
 * @property name The name of the node pool. If left blank, the provider will
 * auto-generate a unique name.
 * @property namePrefix Creates a unique name for the node pool beginning
 * with the specified prefix. Conflicts with `name`.
 * @property networkConfig 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
 * @property nodeConfig Parameters used in creating the node pool. See
 * gcp.container.Cluster for schema.
 * @property nodeCount 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`.
 * @property nodeLocations 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
 * `node_locations` will be used.
 * > Note: `node_locations` 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.
 * @property placementPolicy Specifies a custom placement policy for the
 * nodes.
 * @property project The ID of the project in which to create the node pool. If blank,
 * the provider-configured project will be used.
 * @property queuedProvisioning Specifies node pool-level settings of queued provisioning.
 * Structure is documented below.
 * The `autoscaling` block supports (either total or per zone limits are required):
 * @property upgradeSettings 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.
 * @property version The Kubernetes version for the nodes in this pool. Note that if this field
 * and `auto_upgrade` 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
 * `version_prefix` field to approximate fuzzy versions in a provider-compatible way.
 */
public data class NodePoolArgs(
    public val autoscaling: Output? = null,
    public val cluster: Output? = null,
    public val initialNodeCount: Output? = null,
    public val location: Output? = null,
    public val management: Output? = null,
    public val maxPodsPerNode: Output? = null,
    public val name: Output? = null,
    public val namePrefix: Output? = null,
    public val networkConfig: Output? = null,
    public val nodeConfig: Output? = null,
    public val nodeCount: Output? = null,
    public val nodeLocations: Output>? = null,
    public val placementPolicy: Output? = null,
    public val project: Output? = null,
    public val queuedProvisioning: Output? = null,
    public val upgradeSettings: Output? = null,
    public val version: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.container.NodePoolArgs =
        com.pulumi.gcp.container.NodePoolArgs.builder()
            .autoscaling(autoscaling?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .cluster(cluster?.applyValue({ args0 -> args0 }))
            .initialNodeCount(initialNodeCount?.applyValue({ args0 -> args0 }))
            .location(location?.applyValue({ args0 -> args0 }))
            .management(management?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .maxPodsPerNode(maxPodsPerNode?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .namePrefix(namePrefix?.applyValue({ args0 -> args0 }))
            .networkConfig(networkConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .nodeConfig(nodeConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .nodeCount(nodeCount?.applyValue({ args0 -> args0 }))
            .nodeLocations(nodeLocations?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .placementPolicy(placementPolicy?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .project(project?.applyValue({ args0 -> args0 }))
            .queuedProvisioning(
                queuedProvisioning?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .upgradeSettings(upgradeSettings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .version(version?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [NodePoolArgs].
 */
@PulumiTagMarker
public class NodePoolArgsBuilder internal constructor() {
    private var autoscaling: Output? = null

    private var cluster: Output? = null

    private var initialNodeCount: Output? = null

    private var location: Output? = null

    private var management: Output? = null

    private var maxPodsPerNode: Output? = null

    private var name: Output? = null

    private var namePrefix: Output? = null

    private var networkConfig: Output? = null

    private var nodeConfig: Output? = null

    private var nodeCount: Output? = null

    private var nodeLocations: Output>? = null

    private var placementPolicy: Output? = null

    private var project: Output? = null

    private var queuedProvisioning: Output? = null

    private var upgradeSettings: Output? = null

    private var version: Output? = null

    /**
     * @param value Configuration required by cluster autoscaler to adjust
     * the size of the node pool to the current cluster usage. Structure is documented below.
     */
    @JvmName("nwutpijwegsyvswb")
    public suspend fun autoscaling(`value`: Output) {
        this.autoscaling = value
    }

    /**
     * @param value 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.
     * - - -
     */
    @JvmName("qstfxnfddrehnibp")
    public suspend fun cluster(`value`: Output) {
        this.cluster = value
    }

    /**
     * @param value 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.
     */
    @JvmName("gguyxfauiyqychub")
    public suspend fun initialNodeCount(`value`: Output) {
        this.initialNodeCount = value
    }

    /**
     * @param value The location (region or zone) of the cluster.
     * - - -
     */
    @JvmName("vjhjfqrncrbvmdde")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Node management configuration, wherein auto-repair and
     * auto-upgrade is configured. Structure is documented below.
     */
    @JvmName("hykvprjrndufcorf")
    public suspend fun management(`value`: Output) {
        this.management = value
    }

    /**
     * @param value 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.
     */
    @JvmName("boixcgdiwjheaffb")
    public suspend fun maxPodsPerNode(`value`: Output) {
        this.maxPodsPerNode = value
    }

    /**
     * @param value The name of the node pool. If left blank, the provider will
     * auto-generate a unique name.
     */
    @JvmName("yfvgjfjnrfcgpeev")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Creates a unique name for the node pool beginning
     * with the specified prefix. Conflicts with `name`.
     */
    @JvmName("mcyapdcyjrjywvkf")
    public suspend fun namePrefix(`value`: Output) {
        this.namePrefix = value
    }

    /**
     * @param value 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
     */
    @JvmName("afrgkjobmtjbnocu")
    public suspend fun networkConfig(`value`: Output) {
        this.networkConfig = value
    }

    /**
     * @param value Parameters used in creating the node pool. See
     * gcp.container.Cluster for schema.
     */
    @JvmName("hsnfqgspfxmwoylf")
    public suspend fun nodeConfig(`value`: Output) {
        this.nodeConfig = value
    }

    /**
     * @param value 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`.
     */
    @JvmName("hhbactwikirxnwrv")
    public suspend fun nodeCount(`value`: Output) {
        this.nodeCount = value
    }

    /**
     * @param value 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
     * `node_locations` will be used.
     * > Note: `node_locations` 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.
     */
    @JvmName("yfvmcpamiqgywsjl")
    public suspend fun nodeLocations(`value`: Output>) {
        this.nodeLocations = value
    }

    @JvmName("dmohhuwhnykosykm")
    public suspend fun nodeLocations(vararg values: Output) {
        this.nodeLocations = Output.all(values.asList())
    }

    /**
     * @param values 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
     * `node_locations` will be used.
     * > Note: `node_locations` 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.
     */
    @JvmName("qpxppsfjdoakbjvw")
    public suspend fun nodeLocations(values: List>) {
        this.nodeLocations = Output.all(values)
    }

    /**
     * @param value Specifies a custom placement policy for the
     * nodes.
     */
    @JvmName("hamsjqrivqtymbtu")
    public suspend fun placementPolicy(`value`: Output) {
        this.placementPolicy = value
    }

    /**
     * @param value The ID of the project in which to create the node pool. If blank,
     * the provider-configured project will be used.
     */
    @JvmName("fwpfdbcnmblihtmw")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Specifies node pool-level settings of queued provisioning.
     * Structure is documented below.
     * The `autoscaling` block supports (either total or per zone limits are required):
     */
    @JvmName("krxxwgwxonynrxhf")
    public suspend fun queuedProvisioning(`value`: Output) {
        this.queuedProvisioning = value
    }

    /**
     * @param value 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.
     */
    @JvmName("enaaoxudamehcxio")
    public suspend fun upgradeSettings(`value`: Output) {
        this.upgradeSettings = value
    }

    /**
     * @param value The Kubernetes version for the nodes in this pool. Note that if this field
     * and `auto_upgrade` 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
     * `version_prefix` field to approximate fuzzy versions in a provider-compatible way.
     */
    @JvmName("lbwtayarhhmoiprm")
    public suspend fun version(`value`: Output) {
        this.version = value
    }

    /**
     * @param value Configuration required by cluster autoscaler to adjust
     * the size of the node pool to the current cluster usage. Structure is documented below.
     */
    @JvmName("krxqgphxkqwvypiu")
    public suspend fun autoscaling(`value`: NodePoolAutoscalingArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.autoscaling = mapped
    }

    /**
     * @param argument Configuration required by cluster autoscaler to adjust
     * the size of the node pool to the current cluster usage. Structure is documented below.
     */
    @JvmName("ojcxbiixpvfedkwy")
    public suspend fun autoscaling(argument: suspend NodePoolAutoscalingArgsBuilder.() -> Unit) {
        val toBeMapped = NodePoolAutoscalingArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.autoscaling = mapped
    }

    /**
     * @param value 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.
     * - - -
     */
    @JvmName("tgnetmfqvddafnxa")
    public suspend fun cluster(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.cluster = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("hfqieiyktyqaqnvu")
    public suspend fun initialNodeCount(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.initialNodeCount = mapped
    }

    /**
     * @param value The location (region or zone) of the cluster.
     * - - -
     */
    @JvmName("cduymutkhbrnufrr")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Node management configuration, wherein auto-repair and
     * auto-upgrade is configured. Structure is documented below.
     */
    @JvmName("qcuvawveqqtkojvu")
    public suspend fun management(`value`: NodePoolManagementArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.management = mapped
    }

    /**
     * @param argument Node management configuration, wherein auto-repair and
     * auto-upgrade is configured. Structure is documented below.
     */
    @JvmName("spsusnphdjmpbpdu")
    public suspend fun management(argument: suspend NodePoolManagementArgsBuilder.() -> Unit) {
        val toBeMapped = NodePoolManagementArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.management = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("kwjlatqglqjktbto")
    public suspend fun maxPodsPerNode(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maxPodsPerNode = mapped
    }

    /**
     * @param value The name of the node pool. If left blank, the provider will
     * auto-generate a unique name.
     */
    @JvmName("dhogycfyoepvhbrs")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Creates a unique name for the node pool beginning
     * with the specified prefix. Conflicts with `name`.
     */
    @JvmName("eljakinxcsywmeim")
    public suspend fun namePrefix(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.namePrefix = mapped
    }

    /**
     * @param value 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
     */
    @JvmName("wkaxrkrhltwncqsj")
    public suspend fun networkConfig(`value`: NodePoolNetworkConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.networkConfig = mapped
    }

    /**
     * @param argument 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
     */
    @JvmName("gljjbtaxterjxocf")
    public suspend fun networkConfig(argument: suspend NodePoolNetworkConfigArgsBuilder.() -> Unit) {
        val toBeMapped = NodePoolNetworkConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.networkConfig = mapped
    }

    /**
     * @param value Parameters used in creating the node pool. See
     * gcp.container.Cluster for schema.
     */
    @JvmName("nyqyftvexklfxmmv")
    public suspend fun nodeConfig(`value`: NodePoolNodeConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodeConfig = mapped
    }

    /**
     * @param argument Parameters used in creating the node pool. See
     * gcp.container.Cluster for schema.
     */
    @JvmName("egbateqkbxhnouhm")
    public suspend fun nodeConfig(argument: suspend NodePoolNodeConfigArgsBuilder.() -> Unit) {
        val toBeMapped = NodePoolNodeConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.nodeConfig = mapped
    }

    /**
     * @param value 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`.
     */
    @JvmName("lhohigvhelbmmtew")
    public suspend fun nodeCount(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodeCount = mapped
    }

    /**
     * @param value 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
     * `node_locations` will be used.
     * > Note: `node_locations` 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.
     */
    @JvmName("irtciuyoftwabana")
    public suspend fun nodeLocations(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.nodeLocations = mapped
    }

    /**
     * @param values 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
     * `node_locations` will be used.
     * > Note: `node_locations` 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.
     */
    @JvmName("uttgkpuxketitrtu")
    public suspend fun nodeLocations(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.nodeLocations = mapped
    }

    /**
     * @param value Specifies a custom placement policy for the
     * nodes.
     */
    @JvmName("qwymjviuflyufoig")
    public suspend fun placementPolicy(`value`: NodePoolPlacementPolicyArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.placementPolicy = mapped
    }

    /**
     * @param argument Specifies a custom placement policy for the
     * nodes.
     */
    @JvmName("klhutiyanatdliqh")
    public suspend fun placementPolicy(argument: suspend NodePoolPlacementPolicyArgsBuilder.() -> Unit) {
        val toBeMapped = NodePoolPlacementPolicyArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.placementPolicy = mapped
    }

    /**
     * @param value The ID of the project in which to create the node pool. If blank,
     * the provider-configured project will be used.
     */
    @JvmName("fjkgxfajsxsbdqjh")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value Specifies node pool-level settings of queued provisioning.
     * Structure is documented below.
     * The `autoscaling` block supports (either total or per zone limits are required):
     */
    @JvmName("qauvwutfkcaqmmbo")
    public suspend fun queuedProvisioning(`value`: NodePoolQueuedProvisioningArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.queuedProvisioning = mapped
    }

    /**
     * @param argument Specifies node pool-level settings of queued provisioning.
     * Structure is documented below.
     * The `autoscaling` block supports (either total or per zone limits are required):
     */
    @JvmName("oktoauqiwexsiaqw")
    public suspend fun queuedProvisioning(argument: suspend NodePoolQueuedProvisioningArgsBuilder.() -> Unit) {
        val toBeMapped = NodePoolQueuedProvisioningArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.queuedProvisioning = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("ktxckxoashourkrk")
    public suspend fun upgradeSettings(`value`: NodePoolUpgradeSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.upgradeSettings = mapped
    }

    /**
     * @param argument 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.
     */
    @JvmName("xbboocexojvoinfx")
    public suspend fun upgradeSettings(argument: suspend NodePoolUpgradeSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = NodePoolUpgradeSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.upgradeSettings = mapped
    }

    /**
     * @param value The Kubernetes version for the nodes in this pool. Note that if this field
     * and `auto_upgrade` 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
     * `version_prefix` field to approximate fuzzy versions in a provider-compatible way.
     */
    @JvmName("tgapxsfwvdkjagge")
    public suspend fun version(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.version = mapped
    }

    internal fun build(): NodePoolArgs = NodePoolArgs(
        autoscaling = autoscaling,
        cluster = cluster,
        initialNodeCount = initialNodeCount,
        location = location,
        management = management,
        maxPodsPerNode = maxPodsPerNode,
        name = name,
        namePrefix = namePrefix,
        networkConfig = networkConfig,
        nodeConfig = nodeConfig,
        nodeCount = nodeCount,
        nodeLocations = nodeLocations,
        placementPolicy = placementPolicy,
        project = project,
        queuedProvisioning = queuedProvisioning,
        upgradeSettings = upgradeSettings,
        version = version,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy