UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

496 lines • 24.6 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; import * as enums from "./types/enums"; /** * Provides a DigitalOcean Kubernetes cluster resource. This can be used to create, delete, and modify clusters. For more information see the [official documentation](https://www.digitalocean.com/docs/kubernetes/). * * ## 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: "latest", * nodePool: { * name: "worker-pool", * size: "s-2vcpu-2gb", * nodeCount: 3, * 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 foo = new digitalocean.KubernetesCluster("foo", { * name: "foo", * region: digitalocean.Region.NYC1, * version: "1.22.8-do.1", * nodePool: { * name: "autoscale-worker-pool", * size: "s-2vcpu-2gb", * autoScale: true, * minNodes: 1, * maxNodes: 5, * }, * }); * ``` * * Note that, currently, each node pool must always have at least one node and when using autoscaling the minNodes must be greater than or equal to 1. * > Autoscaling to zero (`min_nodes=0`) is in [private preview](https://docs.digitalocean.com/release-notes/kubernetes/#2025-01-07) and not available for public use. * * ### Auto Upgrade Example * * DigitalOcean Kubernetes clusters may also be configured to [auto upgrade](https://www.digitalocean.com/docs/kubernetes/how-to/upgrade-cluster/#automatically) patch versions. You may explicitly specify the maintenance window policy. * For example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = digitalocean.getKubernetesVersions({ * versionPrefix: "1.22.", * }); * const foo = new digitalocean.KubernetesCluster("foo", { * name: "foo", * region: digitalocean.Region.NYC1, * autoUpgrade: true, * version: example.then(example => example.latestVersion), * maintenancePolicy: { * startTime: "04:00", * day: "sunday", * }, * nodePool: { * name: "default", * size: "s-1vcpu-2gb", * nodeCount: 3, * }, * }); * ``` * * Note that a data source is used to supply the version. This is needed to prevent configuration diff whenever a cluster is upgraded. * * ### Kubernetes Terraform Provider Example * * The cluster's kubeconfig is exported as an attribute allowing you to use it with * the Kubernetes Terraform provider. * * > When using interpolation to pass credentials from a `digitalocean.KubernetesCluster` * resource to the Kubernetes provider, the cluster resource generally should not * be created in the same Terraform module where Kubernetes provider resources are * also used. This can lead to unpredictable errors which are hard to debug and * diagnose. The root issue lies with the order in which Terraform itself evaluates * the provider blocks vs. actual resources. * * When using the Kubernetes provider with a cluster created in a separate Terraform * module or configuration, use the `digitalocean.KubernetesCluster` data-source * to access the cluster's credentials. See here for a full example. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const example = digitalocean.getKubernetesCluster({ * name: "prod-cluster-01", * }); * ``` * * ### Exec credential plugin * * Another method to ensure that the Kubernetes provider is receiving valid credentials * is to use an exec plugin. In order to use use this approach, the DigitalOcean * CLI (`doctl`) must be present. `doctl` will renew the token if needed before * initializing the provider. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * ``` * * ## Import * * Before importing a Kubernetes cluster, the cluster's default node pool must be tagged with * the `terraform:default-node-pool` tag. The provider will automatically add this tag if * the cluster only has a single node pool. Clusters with more than one node pool, however, will require * that you manually add the `terraform:default-node-pool` tag to the node pool that you intend to be * the default node pool. * * Then the Kubernetes cluster and its default node pool can be imported using the cluster's `id`, e.g. * * ```sh * $ pulumi import digitalocean:index/kubernetesCluster:KubernetesCluster mycluster 1b8b2100-0e9f-4e8f-ad78-9eb578c2a0af * ``` * * Additional node pools must be imported separately as `digitalocean.KubernetesCluster` * resources, e.g. * * ```sh * $ pulumi import digitalocean:index/kubernetesCluster:KubernetesCluster mynodepool 9d76f410-9284-4436-9633-4066852442c8 * ``` */ export declare class KubernetesCluster extends pulumi.CustomResource { /** * Get an existing KubernetesCluster 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<pulumi.ID>, state?: KubernetesClusterState, opts?: pulumi.CustomResourceOptions): KubernetesCluster; /** * Returns true if the given object is an instance of KubernetesCluster. 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 KubernetesCluster; /** * Block containing options for the AMD GPU device metrics exporter component. */ readonly amdGpuDeviceMetricsExporterPlugin: pulumi.Output<outputs.KubernetesClusterAmdGpuDeviceMetricsExporterPlugin>; /** * Block containing options for the AMD GPU device plugin component. If not specified, the component will be enabled by default for clusters with AMD GPU nodes. */ readonly amdGpuDevicePlugin: pulumi.Output<outputs.KubernetesClusterAmdGpuDevicePlugin>; /** * A boolean value indicating whether the cluster will be automatically upgraded to new patch releases during its maintenance window. */ readonly autoUpgrade: pulumi.Output<boolean | undefined>; /** * Block containing options for cluster auto-scaling. */ readonly clusterAutoscalerConfigurations: pulumi.Output<outputs.KubernetesClusterClusterAutoscalerConfiguration[] | undefined>; /** * The range of IP addresses in the overlay network of the Kubernetes cluster. For more information, see [here](https://docs.digitalocean.com/products/kubernetes/how-to/create-clusters/#create-with-vpc-native). */ readonly clusterSubnet: pulumi.Output<string>; /** * The uniform resource name (URN) for the Kubernetes cluster. */ readonly clusterUrn: pulumi.Output<string>; /** * A block representing the cluster's control plane firewall */ readonly controlPlaneFirewall: pulumi.Output<outputs.KubernetesClusterControlPlaneFirewall>; /** * The date and time when the node was created. */ readonly createdAt: pulumi.Output<string>; /** * **Use with caution.** When set to true, all associated DigitalOcean resources created via the Kubernetes API (load balancers, volumes, and volume snapshots) will be destroyed along with the cluster when it is destroyed. */ readonly destroyAllAssociatedResources: pulumi.Output<boolean | undefined>; /** * The base URL of the API server on the Kubernetes master node. */ readonly endpoint: pulumi.Output<string>; /** * Enable/disable the high availability control plane for a cluster. Once enabled for a cluster, high availability cannot be disabled. Default: true (for 1.36.0 and later) */ readonly ha: pulumi.Output<boolean>; /** * The public IPv4 address of the Kubernetes master node. This will not be set if high availability is configured on the cluster (v1.21+) */ readonly ipv4Address: pulumi.Output<string>; /** * A representation of the Kubernetes cluster's kubeconfig with the following attributes: */ readonly kubeConfigs: pulumi.Output<outputs.KubernetesClusterKubeConfig[]>; /** * The duration in seconds that the returned Kubernetes credentials will be valid. If not set or 0, the credentials will have a 7 day expiry. */ readonly kubeconfigExpireSeconds: pulumi.Output<number | undefined>; /** * A block representing the cluster's maintenance window. Updates will be applied within this window. If not specified, a default maintenance window will be chosen. `autoUpgrade` must be set to `true` for this to have an effect. */ readonly maintenancePolicy: pulumi.Output<outputs.KubernetesClusterMaintenancePolicy>; /** * A name for the Kubernetes cluster. */ readonly name: pulumi.Output<string>; /** * A block representing the cluster's default node pool. Additional node pools may be added to the cluster using the `digitalocean.KubernetesNodePool` resource. The following arguments may be specified: */ readonly nodePool: pulumi.Output<outputs.KubernetesClusterNodePool>; /** * Block containing options for the NVIDIA GPU device plugin component. If not specified, the component will be enabled by default for clusters with NVIDIA GPU nodes. */ readonly nvidiaGpuDevicePlugin: pulumi.Output<outputs.KubernetesClusterNvidiaGpuDevicePlugin>; readonly rdmaSharedDevicePlugin: pulumi.Output<outputs.KubernetesClusterRdmaSharedDevicePlugin>; /** * The slug identifier for the region where the Kubernetes cluster will be created. */ readonly region: pulumi.Output<string>; /** * Enables or disables the DigitalOcean container registry integration for the cluster. This requires that a container registry has first been created for the account. Default: false */ readonly registryIntegration: pulumi.Output<boolean | undefined>; /** * Block containing options for the routing-agent component. If not specified, the routing-agent component will not be installed in the cluster. */ readonly routingAgent: pulumi.Output<outputs.KubernetesClusterRoutingAgent>; /** * The range of assignable IP addresses for services running in the Kubernetes cluster. For more information, see [here](https://docs.digitalocean.com/products/kubernetes/how-to/create-clusters/#create-with-vpc-native). */ readonly serviceSubnet: pulumi.Output<string>; readonly ssos: pulumi.Output<outputs.KubernetesClusterSso[]>; /** * A string indicating the current status of the individual node. */ readonly status: pulumi.Output<string>; /** * Enable/disable surge upgrades for a cluster. Default: true */ readonly surgeUpgrade: pulumi.Output<boolean | undefined>; /** * A list of tag names to be applied to the Kubernetes cluster. */ readonly tags: pulumi.Output<string[] | undefined>; /** * The date and time when the node was last updated. */ readonly updatedAt: pulumi.Output<string>; /** * The slug identifier for the version of Kubernetes used for the cluster. Use [doctl](https://github.com/digitalocean/doctl) to find the available versions `doctl kubernetes options versions`. (**Note:** A cluster may only be upgraded to newer versions in-place. If the version is decreased, a new resource will be created.) */ readonly version: pulumi.Output<string>; /** * The ID of the VPC where the Kubernetes cluster will be located. */ readonly vpcUuid: pulumi.Output<string>; /** * Create a KubernetesCluster 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: KubernetesClusterArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering KubernetesCluster resources. */ export interface KubernetesClusterState { /** * Block containing options for the AMD GPU device metrics exporter component. */ amdGpuDeviceMetricsExporterPlugin?: pulumi.Input<inputs.KubernetesClusterAmdGpuDeviceMetricsExporterPlugin | undefined>; /** * Block containing options for the AMD GPU device plugin component. If not specified, the component will be enabled by default for clusters with AMD GPU nodes. */ amdGpuDevicePlugin?: pulumi.Input<inputs.KubernetesClusterAmdGpuDevicePlugin | undefined>; /** * A boolean value indicating whether the cluster will be automatically upgraded to new patch releases during its maintenance window. */ autoUpgrade?: pulumi.Input<boolean | undefined>; /** * Block containing options for cluster auto-scaling. */ clusterAutoscalerConfigurations?: pulumi.Input<pulumi.Input<inputs.KubernetesClusterClusterAutoscalerConfiguration>[] | undefined>; /** * The range of IP addresses in the overlay network of the Kubernetes cluster. For more information, see [here](https://docs.digitalocean.com/products/kubernetes/how-to/create-clusters/#create-with-vpc-native). */ clusterSubnet?: pulumi.Input<string | undefined>; /** * The uniform resource name (URN) for the Kubernetes cluster. */ clusterUrn?: pulumi.Input<string | undefined>; /** * A block representing the cluster's control plane firewall */ controlPlaneFirewall?: pulumi.Input<inputs.KubernetesClusterControlPlaneFirewall | undefined>; /** * The date and time when the node was created. */ createdAt?: pulumi.Input<string | undefined>; /** * **Use with caution.** When set to true, all associated DigitalOcean resources created via the Kubernetes API (load balancers, volumes, and volume snapshots) will be destroyed along with the cluster when it is destroyed. */ destroyAllAssociatedResources?: pulumi.Input<boolean | undefined>; /** * The base URL of the API server on the Kubernetes master node. */ endpoint?: pulumi.Input<string | undefined>; /** * Enable/disable the high availability control plane for a cluster. Once enabled for a cluster, high availability cannot be disabled. Default: true (for 1.36.0 and later) */ ha?: pulumi.Input<boolean | undefined>; /** * The public IPv4 address of the Kubernetes master node. This will not be set if high availability is configured on the cluster (v1.21+) */ ipv4Address?: pulumi.Input<string | undefined>; /** * A representation of the Kubernetes cluster's kubeconfig with the following attributes: */ kubeConfigs?: pulumi.Input<pulumi.Input<inputs.KubernetesClusterKubeConfig>[] | undefined>; /** * The duration in seconds that the returned Kubernetes credentials will be valid. If not set or 0, the credentials will have a 7 day expiry. */ kubeconfigExpireSeconds?: pulumi.Input<number | undefined>; /** * A block representing the cluster's maintenance window. Updates will be applied within this window. If not specified, a default maintenance window will be chosen. `autoUpgrade` must be set to `true` for this to have an effect. */ maintenancePolicy?: pulumi.Input<inputs.KubernetesClusterMaintenancePolicy | undefined>; /** * A name for the Kubernetes cluster. */ name?: pulumi.Input<string | undefined>; /** * A block representing the cluster's default node pool. Additional node pools may be added to the cluster using the `digitalocean.KubernetesNodePool` resource. The following arguments may be specified: */ nodePool?: pulumi.Input<inputs.KubernetesClusterNodePool | undefined>; /** * Block containing options for the NVIDIA GPU device plugin component. If not specified, the component will be enabled by default for clusters with NVIDIA GPU nodes. */ nvidiaGpuDevicePlugin?: pulumi.Input<inputs.KubernetesClusterNvidiaGpuDevicePlugin | undefined>; rdmaSharedDevicePlugin?: pulumi.Input<inputs.KubernetesClusterRdmaSharedDevicePlugin | undefined>; /** * The slug identifier for the region where the Kubernetes cluster will be created. */ region?: pulumi.Input<string | enums.Region | undefined>; /** * Enables or disables the DigitalOcean container registry integration for the cluster. This requires that a container registry has first been created for the account. Default: false */ registryIntegration?: pulumi.Input<boolean | undefined>; /** * Block containing options for the routing-agent component. If not specified, the routing-agent component will not be installed in the cluster. */ routingAgent?: pulumi.Input<inputs.KubernetesClusterRoutingAgent | undefined>; /** * The range of assignable IP addresses for services running in the Kubernetes cluster. For more information, see [here](https://docs.digitalocean.com/products/kubernetes/how-to/create-clusters/#create-with-vpc-native). */ serviceSubnet?: pulumi.Input<string | undefined>; ssos?: pulumi.Input<pulumi.Input<inputs.KubernetesClusterSso>[] | undefined>; /** * A string indicating the current status of the individual node. */ status?: pulumi.Input<string | undefined>; /** * Enable/disable surge upgrades for a cluster. Default: true */ surgeUpgrade?: pulumi.Input<boolean | undefined>; /** * A list of tag names to be applied to the Kubernetes cluster. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The date and time when the node was last updated. */ updatedAt?: pulumi.Input<string | undefined>; /** * The slug identifier for the version of Kubernetes used for the cluster. Use [doctl](https://github.com/digitalocean/doctl) to find the available versions `doctl kubernetes options versions`. (**Note:** A cluster may only be upgraded to newer versions in-place. If the version is decreased, a new resource will be created.) */ version?: pulumi.Input<string | undefined>; /** * The ID of the VPC where the Kubernetes cluster will be located. */ vpcUuid?: pulumi.Input<string | undefined>; } /** * The set of arguments for constructing a KubernetesCluster resource. */ export interface KubernetesClusterArgs { /** * Block containing options for the AMD GPU device metrics exporter component. */ amdGpuDeviceMetricsExporterPlugin?: pulumi.Input<inputs.KubernetesClusterAmdGpuDeviceMetricsExporterPlugin | undefined>; /** * Block containing options for the AMD GPU device plugin component. If not specified, the component will be enabled by default for clusters with AMD GPU nodes. */ amdGpuDevicePlugin?: pulumi.Input<inputs.KubernetesClusterAmdGpuDevicePlugin | undefined>; /** * A boolean value indicating whether the cluster will be automatically upgraded to new patch releases during its maintenance window. */ autoUpgrade?: pulumi.Input<boolean | undefined>; /** * Block containing options for cluster auto-scaling. */ clusterAutoscalerConfigurations?: pulumi.Input<pulumi.Input<inputs.KubernetesClusterClusterAutoscalerConfiguration>[] | undefined>; /** * The range of IP addresses in the overlay network of the Kubernetes cluster. For more information, see [here](https://docs.digitalocean.com/products/kubernetes/how-to/create-clusters/#create-with-vpc-native). */ clusterSubnet?: pulumi.Input<string | undefined>; /** * A block representing the cluster's control plane firewall */ controlPlaneFirewall?: pulumi.Input<inputs.KubernetesClusterControlPlaneFirewall | undefined>; /** * **Use with caution.** When set to true, all associated DigitalOcean resources created via the Kubernetes API (load balancers, volumes, and volume snapshots) will be destroyed along with the cluster when it is destroyed. */ destroyAllAssociatedResources?: pulumi.Input<boolean | undefined>; /** * Enable/disable the high availability control plane for a cluster. Once enabled for a cluster, high availability cannot be disabled. Default: true (for 1.36.0 and later) */ ha?: pulumi.Input<boolean | undefined>; /** * The duration in seconds that the returned Kubernetes credentials will be valid. If not set or 0, the credentials will have a 7 day expiry. */ kubeconfigExpireSeconds?: pulumi.Input<number | undefined>; /** * A block representing the cluster's maintenance window. Updates will be applied within this window. If not specified, a default maintenance window will be chosen. `autoUpgrade` must be set to `true` for this to have an effect. */ maintenancePolicy?: pulumi.Input<inputs.KubernetesClusterMaintenancePolicy | undefined>; /** * A name for the Kubernetes cluster. */ name?: pulumi.Input<string | undefined>; /** * A block representing the cluster's default node pool. Additional node pools may be added to the cluster using the `digitalocean.KubernetesNodePool` resource. The following arguments may be specified: */ nodePool: pulumi.Input<inputs.KubernetesClusterNodePool>; /** * Block containing options for the NVIDIA GPU device plugin component. If not specified, the component will be enabled by default for clusters with NVIDIA GPU nodes. */ nvidiaGpuDevicePlugin?: pulumi.Input<inputs.KubernetesClusterNvidiaGpuDevicePlugin | undefined>; rdmaSharedDevicePlugin?: pulumi.Input<inputs.KubernetesClusterRdmaSharedDevicePlugin | undefined>; /** * The slug identifier for the region where the Kubernetes cluster will be created. */ region: pulumi.Input<string | enums.Region>; /** * Enables or disables the DigitalOcean container registry integration for the cluster. This requires that a container registry has first been created for the account. Default: false */ registryIntegration?: pulumi.Input<boolean | undefined>; /** * Block containing options for the routing-agent component. If not specified, the routing-agent component will not be installed in the cluster. */ routingAgent?: pulumi.Input<inputs.KubernetesClusterRoutingAgent | undefined>; /** * The range of assignable IP addresses for services running in the Kubernetes cluster. For more information, see [here](https://docs.digitalocean.com/products/kubernetes/how-to/create-clusters/#create-with-vpc-native). */ serviceSubnet?: pulumi.Input<string | undefined>; ssos?: pulumi.Input<pulumi.Input<inputs.KubernetesClusterSso>[] | undefined>; /** * Enable/disable surge upgrades for a cluster. Default: true */ surgeUpgrade?: pulumi.Input<boolean | undefined>; /** * A list of tag names to be applied to the Kubernetes cluster. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The slug identifier for the version of Kubernetes used for the cluster. Use [doctl](https://github.com/digitalocean/doctl) to find the available versions `doctl kubernetes options versions`. (**Note:** A cluster may only be upgraded to newer versions in-place. If the version is decreased, a new resource will be created.) */ version: pulumi.Input<string>; /** * The ID of the VPC where the Kubernetes cluster will be located. */ vpcUuid?: pulumi.Input<string | undefined>; } //# sourceMappingURL=kubernetesCluster.d.ts.map