UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

534 lines (533 loc) 20.4 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Creates and manages Scaleway Kubernetes clusters. For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/kubernetes/). * * ## 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.29.1", * cni: "cilium", * privateNetworkId: pn.id, * deleteAdditionalResources: false, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * name: "tf-pool", * nodeType: "DEV1-M", * size: 1, * }); * ``` * * ### Multicloud * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const cluster = new scaleway.kubernetes.Cluster("cluster", { * name: "tf-cluster", * type: "multicloud", * version: "1.29.1", * cni: "kilo", * deleteAdditionalResources: false, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * name: "tf-pool", * nodeType: "external", * size: 0, * minSize: 0, * }); * ``` * * For a detailed example of how to add or run Elastic Metal servers instead of Instances on your cluster, please refer to this guide. * * ### With additional configuration * * ```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.29.1", * 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, * name: "tf-pool", * nodeType: "DEV1-M", * size: 3, * autoscaling: true, * autohealing: true, * minSize: 1, * maxSize: 5, * }); * ``` * * ### 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.29.1", * cni: "cilium", * privateNetworkId: pn.id, * deleteAdditionalResources: false, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * 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), * cluster_ca_certificate: cluster.kubeconfigs.apply(kubeconfigs => kubeconfigs[0].clusterCaCertificate), * }}, { * dependsOn: [pool], * }); * ``` * * The `nullResource` is needed because when the cluster is created, its status is `poolRequired`, 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. * * ### With the Helm provider * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as _null from "@pulumi/null"; * import * as helm from "@pulumi/helm"; * 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.29.1", * cni: "cilium", * deleteAdditionalResources: false, * privateNetworkId: pn.id, * }); * const pool = new scaleway.kubernetes.Pool("pool", { * clusterId: cluster.id, * 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), * cluster_ca_certificate: 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 helm.index.Release("nginx_ingress", { * name: "nginx-ingress", * namespace: "kube-system", * repository: "https://kubernetes.github.io/ingress-nginx", * chart: "ingress-nginx", * set: [ * { * name: "controller.service.loadBalancerIP", * value: nginxIp.ipAddress, * }, * { * name: "controller.config.use-proxy-protocol", * value: "true", * }, * { * name: "controller.service.annotations.service\\.beta\\.kubernetes\\.io/scw-loadbalancer-proxy-protocol-v2", * value: "true", * }, * { * name: "controller.service.annotations.service\\.beta\\.kubernetes\\.io/scw-loadbalancer-zone", * value: nginxIp.zone, * }, * { * name: "controller.service.externalTrafficPolicy", * value: "Local", * }, * ], * }); * ``` * * ## Import * * Kubernetes clusters can be imported using the `{region}/{id}`, e.g. * * bash * * ```sh * $ pulumi import scaleway:index/kubernetesCluster:KubernetesCluster mycluster fr-par/11111111-1111-1111-1111-111111111111 * ``` * * @deprecated scaleway.index/kubernetescluster.KubernetesCluster has been deprecated in favor of scaleway.kubernetes/cluster.Cluster */ 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; /** * 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.KubernetesClusterAutoUpgrade>; /** * The configuration options for the [Kubernetes cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). */ readonly autoscalerConfig: pulumi.Output<outputs.KubernetesClusterAutoscalerConfig>; /** * 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.KubernetesClusterKubeconfig[]>; /** * The name for the Kubernetes cluster. */ readonly name: pulumi.Output<string>; /** * The OpenID Connect configuration of the cluster */ readonly openIdConnectConfig: pulumi.Output<outputs.KubernetesClusterOpenIdConnectConfig>; /** * The organization ID the cluster is associated with. */ readonly organizationId: 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>; /** * 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>; /** * 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 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. */ /** @deprecated scaleway.index/kubernetescluster.KubernetesCluster has been deprecated in favor of scaleway.kubernetes/cluster.Cluster */ constructor(name: string, args: KubernetesClusterArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering KubernetesCluster resources. */ export interface KubernetesClusterState { /** * 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>[]>; /** * Additional Subject Alternative Names for the Kubernetes API server certificate */ apiserverCertSans?: pulumi.Input<pulumi.Input<string>[]>; /** * The URL of the Kubernetes API server. */ apiserverUrl?: pulumi.Input<string>; /** * The auto upgrade configuration. */ autoUpgrade?: pulumi.Input<inputs.KubernetesClusterAutoUpgrade>; /** * The configuration options for the [Kubernetes cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). */ autoscalerConfig?: pulumi.Input<inputs.KubernetesClusterAutoscalerConfig>; /** * The Container Network Interface (CNI) for the Kubernetes cluster. * > **Important:** Updates to this field will recreate a new resource. */ cni?: pulumi.Input<string>; /** * The creation date of the cluster. */ createdAt?: 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>; /** * 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>[]>; /** * The kubeconfig configuration file of the Kubernetes cluster */ kubeconfigs?: pulumi.Input<pulumi.Input<inputs.KubernetesClusterKubeconfig>[]>; /** * The name for the Kubernetes cluster. */ name?: pulumi.Input<string>; /** * The OpenID Connect configuration of the cluster */ openIdConnectConfig?: pulumi.Input<inputs.KubernetesClusterOpenIdConnectConfig>; /** * The organization ID the cluster is associated with. */ organizationId?: pulumi.Input<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. */ privateNetworkId?: pulumi.Input<string>; /** * `projectId`) The ID of the project the cluster is associated with. */ projectId?: pulumi.Input<string>; /** * `region`) The region in which the cluster should be created. */ region?: pulumi.Input<string>; /** * The status of the Kubernetes cluster. */ status?: pulumi.Input<string>; /** * The tags associated with the Kubernetes cluster. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * 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>; /** * The last update date of the cluster. */ updatedAt?: pulumi.Input<string>; /** * Set to `true` if a newer Kubernetes version is available. */ upgradeAvailable?: pulumi.Input<boolean>; /** * The version of the Kubernetes cluster. */ version?: pulumi.Input<string>; /** * The DNS wildcard that points to all ready nodes. */ wildcardDns?: pulumi.Input<string>; } /** * The set of arguments for constructing a KubernetesCluster resource. */ export interface KubernetesClusterArgs { /** * 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>[]>; /** * Additional Subject Alternative Names for the Kubernetes API server certificate */ apiserverCertSans?: pulumi.Input<pulumi.Input<string>[]>; /** * The auto upgrade configuration. */ autoUpgrade?: pulumi.Input<inputs.KubernetesClusterAutoUpgrade>; /** * The configuration options for the [Kubernetes cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). */ autoscalerConfig?: pulumi.Input<inputs.KubernetesClusterAutoscalerConfig>; /** * 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>; /** * 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>[]>; /** * The name for the Kubernetes cluster. */ name?: pulumi.Input<string>; /** * The OpenID Connect configuration of the cluster */ openIdConnectConfig?: pulumi.Input<inputs.KubernetesClusterOpenIdConnectConfig>; /** * 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>; /** * `projectId`) The ID of the project the cluster is associated with. */ projectId?: pulumi.Input<string>; /** * `region`) The region in which the cluster should be created. */ region?: pulumi.Input<string>; /** * The tags associated with the Kubernetes cluster. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * 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>; /** * The version of the Kubernetes cluster. */ version: pulumi.Input<string>; }