UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

649 lines 26.9 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * The `scaleway.kubernetes.Cluster` resource allows you to create and manage Scaleway Kubernetes clusters. * * Refer to the Kubernetes [documentation](https://www.scaleway.com/en/docs/compute/kubernetes/) and [API documentation](https://www.scaleway.com/en/developers/api/kubernetes/) for more information. * * ## Example Usage * * ### Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const pn = new scaleway.network.PrivateNetwork("pn", {}); * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * version: "1.35.3", * cni: "cilium", * privateNetworkId: pn.id, * deleteAdditionalResources: false, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * version: cluster.version, * name: "tf-pool", * nodeType: "DEV1-M", * size: 1, * }); * ``` * * ### Using autoscalerConfig * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const pn = new scaleway.network.PrivateNetwork("pn", {}); * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * description: "cluster made in terraform", * version: "1.35.3", * cni: "calico", * tags: ["terraform"], * privateNetworkId: pn.id, * deleteAdditionalResources: false, * autoscalerConfig: { * disableScaleDown: false, * scaleDownDelayAfterAdd: "5m", * estimator: "binpacking", * expander: "random", * ignoreDaemonsetsUtilization: true, * balanceSimilarNodeGroups: true, * expendablePodsPriorityCutoff: -5, * }, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * version: cluster.version, * name: "tf-pool", * nodeType: "DEV1-M", * size: 3, * autoscaling: true, * autohealing: true, * minSize: 1, * maxSize: 5, * }); * ``` * * ### With the Helm provider * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as _null from "@pulumi/null"; * import * as kubernetes from "@pulumi/kubernetes"; * import * as scaleway from "@pulumiverse/scaleway"; * * const pn = new scaleway.network.PrivateNetwork("pn", {}); * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * version: "1.35.3", * cni: "cilium", * deleteAdditionalResources: false, * privateNetworkId: pn.id, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * version: cluster.version, * name: "tf-pool", * nodeType: "DEV1-M", * size: 1, * }); * const kubeconfig = new _null.Resource("kubeconfig", {triggers: { * host: cluster.kubeconfigs.apply(kubeconfigs => kubeconfigs[0].host), * token: cluster.kubeconfigs.apply(kubeconfigs => kubeconfigs[0].token), * clusterCaCertificate: cluster.kubeconfigs.apply(kubeconfigs => kubeconfigs[0].clusterCaCertificate), * }}, { * dependsOn: [pool], * }); * const nginxIp = new scaleway.loadbalancers.Ip("nginx_ip", { * zone: "fr-par-1", * projectId: cluster.projectId, * }); * const nginxIngress = new kubernetes.helm.sh/v3.Release("nginx_ingress", { * name: "nginx-ingress", * namespace: "kube-system", * repositoryOpts: { * repo: "https://kubernetes.github.io/ingress-nginx", * }, * chart: "ingress-nginx", * values: { * "controller.service.loadBalancerIP": nginxIp.ipAddress, * "controller.config.use-proxy-protocol": "true", * "controller.service.annotations.service\\.beta\\.kubernetes\\.io/scw-loadbalancer-proxy-protocol-v2": "true", * "controller.service.annotations.service\\.beta\\.kubernetes\\.io/scw-loadbalancer-zone": nginxIp.zone, * "controller.service.externalTrafficPolicy": "Local", * }, * }); * ``` * * ### With the Kubernetes provider * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as _null from "@pulumi/null"; * import * as scaleway from "@pulumiverse/scaleway"; * * const pn = new scaleway.network.PrivateNetwork("pn", {}); * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * version: "1.35.3", * cni: "cilium", * privateNetworkId: pn.id, * deleteAdditionalResources: false, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * version: cluster.version, * name: "tf-pool", * nodeType: "DEV1-M", * size: 1, * }); * // The `null_resource` is needed because when the cluster is created, its status is `pool_required`, but the kubeconfig can already be downloaded. * // It leads the `kubernetes` provider to start creating its objects, but the DNS entry for the Kubernetes master is not yet ready, that's why it's needed to wait for at least a pool. * const kubeconfig = new _null.Resource("kubeconfig", {triggers: { * host: cluster.kubeconfigs.apply(kubeconfigs => kubeconfigs[0].host), * token: cluster.kubeconfigs.apply(kubeconfigs => kubeconfigs[0].token), * clusterCaCertificate: cluster.kubeconfigs.apply(kubeconfigs => kubeconfigs[0].clusterCaCertificate), * }}, { * dependsOn: [pool], * }); * ``` * * ### Multicloud * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * // For a detailed example of how to add or run Elastic Metal servers instead of Instances on your cluster, please refer to [this guide](../guides/multicloud_cluster_with_baremetal_servers.md). * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * type: "multicloud", * version: "1.35.3", * cni: "kilo", * deleteAdditionalResources: false, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * version: cluster.version, * name: "tf-pool", * nodeType: "external", * size: 0, * minSize: 0, * }); * ``` * * ## Deprecation of defaultPool * * `defaultPool` is deprecated in favour the `scaleway.kubernetes.Pool` resource. Here is a migration example. * * Before: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * version: "1.18.0", * cni: "cilium", * defaultPool: [{ * nodeType: "DEV1-M", * size: 1, * }], * }); * ``` * * After: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * version: "1.18.0", * cni: "cilium", * }); * const _default = new scaleway.kubernetes.Pool("default", { * clusterId: jack.id, * name: "default", * nodeType: "DEV1-M", * size: 1, * }); * ``` * * Once you have moved all the `defaultPool` into their own object, you will need to import them. If your pool had the ID 11111111-1111-1111-1111-111111111111 in the `fr-par` region, you can import it by typing: * * Then you will only need to type `pulumi up` to have a smooth migration. * * ## Import * * Kubernetes clusters can be imported using the `{region}/{id}`, e.g. * * ```sh * $ pulumi import scaleway:kubernetes/cluster:Cluster mycluster fr-par/11111111-1111-1111-1111-111111111111 * ``` */ export declare class Cluster extends pulumi.CustomResource { /** * Get an existing Cluster 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?: ClusterState, opts?: pulumi.CustomResourceOptions): Cluster; /** * Returns true if the given object is an instance of Cluster. 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 Cluster; /** * The list of [admission plugins](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) to enable on the cluster. */ readonly admissionPlugins: pulumi.Output<string[] | undefined>; /** * Additional Subject Alternative Names for the Kubernetes API server certificate */ readonly apiserverCertSans: pulumi.Output<string[] | undefined>; /** * The URL of the Kubernetes API server. */ readonly apiserverUrl: pulumi.Output<string>; /** * The auto upgrade configuration. */ readonly autoUpgrade: pulumi.Output<outputs.kubernetes.ClusterAutoUpgrade>; /** * The configuration options for the [Kubernetes cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). */ readonly autoscalerConfig: pulumi.Output<outputs.kubernetes.ClusterAutoscalerConfig>; /** * The Container Network Interface (CNI) for the Kubernetes cluster. * > **Important:** Updates to this field will recreate a new resource. */ readonly cni: pulumi.Output<string>; /** * The creation date of the cluster. */ readonly createdAt: pulumi.Output<string>; /** * Delete additional resources like block volumes, load-balancers and the cluster's private network (if empty) that were created in Kubernetes on cluster deletion. * > **Important:** Setting this field to `true` means that you will lose all your cluster data and network configuration when you delete your cluster. * If you prefer keeping it, you should instead set it as `false`. */ readonly deleteAdditionalResources: pulumi.Output<boolean>; /** * A description for the Kubernetes cluster. */ readonly description: pulumi.Output<string | undefined>; /** * The list of [feature gates](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/) to enable on the cluster. */ readonly featureGates: pulumi.Output<string[] | undefined>; /** * The kubeconfig configuration file of the Kubernetes cluster */ readonly kubeconfigs: pulumi.Output<outputs.kubernetes.ClusterKubeconfig[]>; /** * The name for the Kubernetes cluster. */ readonly name: pulumi.Output<string>; /** * The OpenID Connect configuration of the cluster */ readonly openIdConnectConfig: pulumi.Output<outputs.kubernetes.ClusterOpenIdConnectConfig>; /** * The organization ID the cluster is associated with. */ readonly organizationId: pulumi.Output<string>; /** * The subnet used for the Pod CIDR. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ readonly podCidr: pulumi.Output<string>; /** * The ID of the private network of the cluster. * * > **Important:** Changes to this field will recreate a new resource. * * > **Important:** Private Networks are now mandatory with Kapsule Clusters. If you have a legacy cluster (no `privateNetworkId` set), * you can still set it now. In this case it will not destroy and recreate your cluster but migrate it to the Private Network. */ readonly privateNetworkId: pulumi.Output<string | undefined>; /** * `projectId`) The ID of the project the cluster is associated with. */ readonly projectId: pulumi.Output<string>; /** * `region`) The region in which the cluster should be created. */ readonly region: pulumi.Output<string | undefined>; /** * The subnet used for the Service CIDR. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ readonly serviceCidr: pulumi.Output<string>; /** * The IP used for the DNS Service. If unset, defaults to Service CIDR's network + 10. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ readonly serviceDnsIp: pulumi.Output<string>; /** * The status of the Kubernetes cluster. */ readonly status: pulumi.Output<string>; /** * The tags associated with the Kubernetes cluster. */ readonly tags: pulumi.Output<string[] | undefined>; /** * The type of Kubernetes cluster. Possible values are: * * - for mutualized clusters: `kapsule` or `multicloud` * * - for dedicated Kapsule clusters: `kapsule-dedicated-4`, `kapsule-dedicated-8` or `kapsule-dedicated-16`. * * - for dedicated Kosmos clusters: `multicloud-dedicated-4`, `multicloud-dedicated-8` or `multicloud-dedicated-16`. */ readonly type: pulumi.Output<string>; /** * The last update date of the cluster. */ readonly updatedAt: pulumi.Output<string>; /** * Set to `true` if a newer Kubernetes version is available. */ readonly upgradeAvailable: pulumi.Output<boolean>; /** * Whether the pools should be automatically upgraded alongside the cluster, or have to be upgraded separately. * If `false` (cluster and pool version are independent of each other), pool upgrades can be conducted by setting the `version` field in the pool resource. * If `true`, upgrading a cluster also performs an upgrade on the pools, but this change is made outside of Terraform, as the config of the pool resource may stay the same. * In that case, refreshing the state will be required for the pool to be read again and the version changes to be shown in the state. */ readonly upgradePools: pulumi.Output<boolean | undefined>; /** * The version of the Kubernetes cluster. */ readonly version: pulumi.Output<string>; /** * The DNS wildcard that points to all ready nodes. */ readonly wildcardDns: pulumi.Output<string>; /** * Create a Cluster 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: ClusterArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Cluster resources. */ export interface ClusterState { /** * The list of [admission plugins](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) to enable on the cluster. */ admissionPlugins?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * Additional Subject Alternative Names for the Kubernetes API server certificate */ apiserverCertSans?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The URL of the Kubernetes API server. */ apiserverUrl?: pulumi.Input<string | undefined>; /** * The auto upgrade configuration. */ autoUpgrade?: pulumi.Input<inputs.kubernetes.ClusterAutoUpgrade | undefined>; /** * The configuration options for the [Kubernetes cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). */ autoscalerConfig?: pulumi.Input<inputs.kubernetes.ClusterAutoscalerConfig | undefined>; /** * The Container Network Interface (CNI) for the Kubernetes cluster. * > **Important:** Updates to this field will recreate a new resource. */ cni?: pulumi.Input<string | undefined>; /** * The creation date of the cluster. */ createdAt?: pulumi.Input<string | undefined>; /** * Delete additional resources like block volumes, load-balancers and the cluster's private network (if empty) that were created in Kubernetes on cluster deletion. * > **Important:** Setting this field to `true` means that you will lose all your cluster data and network configuration when you delete your cluster. * If you prefer keeping it, you should instead set it as `false`. */ deleteAdditionalResources?: pulumi.Input<boolean | undefined>; /** * A description for the Kubernetes cluster. */ description?: pulumi.Input<string | undefined>; /** * The list of [feature gates](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/) to enable on the cluster. */ featureGates?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The kubeconfig configuration file of the Kubernetes cluster */ kubeconfigs?: pulumi.Input<pulumi.Input<inputs.kubernetes.ClusterKubeconfig>[] | undefined>; /** * The name for the Kubernetes cluster. */ name?: pulumi.Input<string | undefined>; /** * The OpenID Connect configuration of the cluster */ openIdConnectConfig?: pulumi.Input<inputs.kubernetes.ClusterOpenIdConnectConfig | undefined>; /** * The organization ID the cluster is associated with. */ organizationId?: pulumi.Input<string | undefined>; /** * The subnet used for the Pod CIDR. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ podCidr?: pulumi.Input<string | undefined>; /** * The ID of the private network of the cluster. * * > **Important:** Changes to this field will recreate a new resource. * * > **Important:** Private Networks are now mandatory with Kapsule Clusters. If you have a legacy cluster (no `privateNetworkId` set), * you can still set it now. In this case it will not destroy and recreate your cluster but migrate it to the Private Network. */ privateNetworkId?: pulumi.Input<string | undefined>; /** * `projectId`) The ID of the project the cluster is associated with. */ projectId?: pulumi.Input<string | undefined>; /** * `region`) The region in which the cluster should be created. */ region?: pulumi.Input<string | undefined>; /** * The subnet used for the Service CIDR. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ serviceCidr?: pulumi.Input<string | undefined>; /** * The IP used for the DNS Service. If unset, defaults to Service CIDR's network + 10. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ serviceDnsIp?: pulumi.Input<string | undefined>; /** * The status of the Kubernetes cluster. */ status?: pulumi.Input<string | undefined>; /** * The tags associated with the Kubernetes cluster. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The type of Kubernetes cluster. Possible values are: * * - for mutualized clusters: `kapsule` or `multicloud` * * - for dedicated Kapsule clusters: `kapsule-dedicated-4`, `kapsule-dedicated-8` or `kapsule-dedicated-16`. * * - for dedicated Kosmos clusters: `multicloud-dedicated-4`, `multicloud-dedicated-8` or `multicloud-dedicated-16`. */ type?: pulumi.Input<string | undefined>; /** * The last update date of the cluster. */ updatedAt?: pulumi.Input<string | undefined>; /** * Set to `true` if a newer Kubernetes version is available. */ upgradeAvailable?: pulumi.Input<boolean | undefined>; /** * Whether the pools should be automatically upgraded alongside the cluster, or have to be upgraded separately. * If `false` (cluster and pool version are independent of each other), pool upgrades can be conducted by setting the `version` field in the pool resource. * If `true`, upgrading a cluster also performs an upgrade on the pools, but this change is made outside of Terraform, as the config of the pool resource may stay the same. * In that case, refreshing the state will be required for the pool to be read again and the version changes to be shown in the state. */ upgradePools?: pulumi.Input<boolean | undefined>; /** * The version of the Kubernetes cluster. */ version?: pulumi.Input<string | undefined>; /** * The DNS wildcard that points to all ready nodes. */ wildcardDns?: pulumi.Input<string | undefined>; } /** * The set of arguments for constructing a Cluster resource. */ export interface ClusterArgs { /** * The list of [admission plugins](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) to enable on the cluster. */ admissionPlugins?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * Additional Subject Alternative Names for the Kubernetes API server certificate */ apiserverCertSans?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The auto upgrade configuration. */ autoUpgrade?: pulumi.Input<inputs.kubernetes.ClusterAutoUpgrade | undefined>; /** * The configuration options for the [Kubernetes cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). */ autoscalerConfig?: pulumi.Input<inputs.kubernetes.ClusterAutoscalerConfig | undefined>; /** * The Container Network Interface (CNI) for the Kubernetes cluster. * > **Important:** Updates to this field will recreate a new resource. */ cni: pulumi.Input<string>; /** * Delete additional resources like block volumes, load-balancers and the cluster's private network (if empty) that were created in Kubernetes on cluster deletion. * > **Important:** Setting this field to `true` means that you will lose all your cluster data and network configuration when you delete your cluster. * If you prefer keeping it, you should instead set it as `false`. */ deleteAdditionalResources: pulumi.Input<boolean>; /** * A description for the Kubernetes cluster. */ description?: pulumi.Input<string | undefined>; /** * The list of [feature gates](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/) to enable on the cluster. */ featureGates?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The name for the Kubernetes cluster. */ name?: pulumi.Input<string | undefined>; /** * The OpenID Connect configuration of the cluster */ openIdConnectConfig?: pulumi.Input<inputs.kubernetes.ClusterOpenIdConnectConfig | undefined>; /** * The subnet used for the Pod CIDR. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ podCidr?: pulumi.Input<string | undefined>; /** * The ID of the private network of the cluster. * * > **Important:** Changes to this field will recreate a new resource. * * > **Important:** Private Networks are now mandatory with Kapsule Clusters. If you have a legacy cluster (no `privateNetworkId` set), * you can still set it now. In this case it will not destroy and recreate your cluster but migrate it to the Private Network. */ privateNetworkId?: pulumi.Input<string | undefined>; /** * `projectId`) The ID of the project the cluster is associated with. */ projectId?: pulumi.Input<string | undefined>; /** * `region`) The region in which the cluster should be created. */ region?: pulumi.Input<string | undefined>; /** * The subnet used for the Service CIDR. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ serviceCidr?: pulumi.Input<string | undefined>; /** * The IP used for the DNS Service. If unset, defaults to Service CIDR's network + 10. * * > **Important:** Changes to this field will recreate a new resource. However once it has been set to a custom value, * unsetting it to go back to the default value will not have any effect. */ serviceDnsIp?: pulumi.Input<string | undefined>; /** * The tags associated with the Kubernetes cluster. */ tags?: pulumi.Input<pulumi.Input<string>[] | undefined>; /** * The type of Kubernetes cluster. Possible values are: * * - for mutualized clusters: `kapsule` or `multicloud` * * - for dedicated Kapsule clusters: `kapsule-dedicated-4`, `kapsule-dedicated-8` or `kapsule-dedicated-16`. * * - for dedicated Kosmos clusters: `multicloud-dedicated-4`, `multicloud-dedicated-8` or `multicloud-dedicated-16`. */ type?: pulumi.Input<string | undefined>; /** * Whether the pools should be automatically upgraded alongside the cluster, or have to be upgraded separately. * If `false` (cluster and pool version are independent of each other), pool upgrades can be conducted by setting the `version` field in the pool resource. * If `true`, upgrading a cluster also performs an upgrade on the pools, but this change is made outside of Terraform, as the config of the pool resource may stay the same. * In that case, refreshing the state will be required for the pool to be read again and the version changes to be shown in the state. */ upgradePools?: pulumi.Input<boolean | undefined>; /** * The version of the Kubernetes cluster. */ version: pulumi.Input<string>; } //# sourceMappingURL=cluster.d.ts.map