@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
230 lines • 11.1 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.KubernetesNodePool = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* The `scaleway.kubernetes.Pool` resource allows you to create and manage Scaleway Kubernetes cluster pools.
*
* 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.
*
* ## Placement Group
*
* If you are working with cluster type `multicloud` please set the `zone` where your placement group is e.g:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const placementGroup = new scaleway.instance.PlacementGroup("placement_group", {
* name: "pool-placement-group",
* policyType: "max_availability",
* policyMode: "optional",
* zone: "nl-ams-1",
* });
* const cluster = new scaleway.kubernetes.Cluster("cluster", {
* name: "placement_group",
* cni: "kilo",
* version: "1.35.3",
* tags: [
* "terraform-test",
* "scaleway_k8s_cluster",
* "placement_group",
* ],
* region: "fr-par",
* type: "multicloud",
* });
* const pool = new scaleway.kubernetes.Pool("pool", {
* name: "placement_group",
* clusterId: cluster.id,
* version: cluster.version,
* nodeType: "gp1_xs",
* placementGroupId: placementGroup.id,
* size: 1,
* region: cluster.region,
* zone: placementGroup.zone,
* });
* ```
*
* ## Changing the node-type of a pool
*
* As your needs evolve, you can migrate your workflow from one pool to another.
* Pools have a unique name, and they also have an immutable node type.
* Just changing the pool node type will recreate a new pool which could lead to service disruption.
* To migrate your application with as little downtime as possible we recommend using the following workflow:
*
* ### General workflow to upgrade a pool
*
* - Create a new pool with a different name and the type you target.
* - Use [`kubectl drain`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#drain) on nodes composing your old pool to drain the remaining workflows of this pool.
* Normally it should transfer your workflows to the new pool. Check out the official documentation about [how to safely drain your nodes](https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/).
* - Delete the old pool from your terraform configuration.
*
* ### Using a composite name to force creation of a new pool when a variable updates
*
* If you want to have a new pool created when a variable changes, you can use a name derived from node type such as:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const kubernetesClusterWorkers1 = new scaleway.kubernetes.Pool("kubernetes_cluster_workers_1", {
* clusterId: kubernetesCluster.id,
* name: `${kubernetesClusterId}_${nodeType}_1`,
* nodeType: nodeType,
* autoscaling: true,
* autohealing: true,
* size: 5,
* minSize: 5,
* maxSize: 10,
* waitForPoolReady: true,
* });
* ```
*
* Thanks to [@deimosfr](https://github.com/deimosfr) for the contribution.
*
* ## Import
*
* Kubernetes pools can be imported using the `{region}/{id}`, e.g.
*
* ```sh
* $ pulumi import scaleway:index/kubernetesNodePool:KubernetesNodePool mypool fr-par/11111111-1111-1111-1111-111111111111
* ```
*
* @deprecated scaleway.index/kubernetesnodepool.KubernetesNodePool has been deprecated in favor of scaleway.kubernetes/pool.Pool
*/
class KubernetesNodePool extends pulumi.CustomResource {
/**
* Get an existing KubernetesNodePool 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, id, state, opts) {
pulumi.log.warn("KubernetesNodePool is deprecated: scaleway.index/kubernetesnodepool.KubernetesNodePool has been deprecated in favor of scaleway.kubernetes/pool.Pool");
return new KubernetesNodePool(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:index/kubernetesNodePool:KubernetesNodePool';
/**
* Returns true if the given object is an instance of KubernetesNodePool. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === KubernetesNodePool.__pulumiType;
}
/** @deprecated scaleway.index/kubernetesnodepool.KubernetesNodePool has been deprecated in favor of scaleway.kubernetes/pool.Pool */
constructor(name, argsOrState, opts) {
pulumi.log.warn("KubernetesNodePool is deprecated: scaleway.index/kubernetesnodepool.KubernetesNodePool has been deprecated in favor of scaleway.kubernetes/pool.Pool");
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autohealing"] = state?.autohealing;
resourceInputs["autoscaling"] = state?.autoscaling;
resourceInputs["clusterId"] = state?.clusterId;
resourceInputs["containerRuntime"] = state?.containerRuntime;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["currentSize"] = state?.currentSize;
resourceInputs["kubeletArgs"] = state?.kubeletArgs;
resourceInputs["labels"] = state?.labels;
resourceInputs["maxSize"] = state?.maxSize;
resourceInputs["minSize"] = state?.minSize;
resourceInputs["name"] = state?.name;
resourceInputs["nodeType"] = state?.nodeType;
resourceInputs["nodes"] = state?.nodes;
resourceInputs["placementGroupId"] = state?.placementGroupId;
resourceInputs["publicIpDisabled"] = state?.publicIpDisabled;
resourceInputs["region"] = state?.region;
resourceInputs["rootVolumeSizeInGb"] = state?.rootVolumeSizeInGb;
resourceInputs["rootVolumeType"] = state?.rootVolumeType;
resourceInputs["securityGroupId"] = state?.securityGroupId;
resourceInputs["size"] = state?.size;
resourceInputs["startupTaints"] = state?.startupTaints;
resourceInputs["status"] = state?.status;
resourceInputs["tags"] = state?.tags;
resourceInputs["taints"] = state?.taints;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["upgradePolicy"] = state?.upgradePolicy;
resourceInputs["version"] = state?.version;
resourceInputs["waitForPoolReady"] = state?.waitForPoolReady;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.clusterId === undefined && !opts.urn) {
throw new Error("Missing required property 'clusterId'");
}
if (args?.nodeType === undefined && !opts.urn) {
throw new Error("Missing required property 'nodeType'");
}
if (args?.size === undefined && !opts.urn) {
throw new Error("Missing required property 'size'");
}
resourceInputs["autohealing"] = args?.autohealing;
resourceInputs["autoscaling"] = args?.autoscaling;
resourceInputs["clusterId"] = args?.clusterId;
resourceInputs["containerRuntime"] = args?.containerRuntime;
resourceInputs["kubeletArgs"] = args?.kubeletArgs;
resourceInputs["labels"] = args?.labels;
resourceInputs["maxSize"] = args?.maxSize;
resourceInputs["minSize"] = args?.minSize;
resourceInputs["name"] = args?.name;
resourceInputs["nodeType"] = args?.nodeType;
resourceInputs["placementGroupId"] = args?.placementGroupId;
resourceInputs["publicIpDisabled"] = args?.publicIpDisabled;
resourceInputs["region"] = args?.region;
resourceInputs["rootVolumeSizeInGb"] = args?.rootVolumeSizeInGb;
resourceInputs["rootVolumeType"] = args?.rootVolumeType;
resourceInputs["securityGroupId"] = args?.securityGroupId;
resourceInputs["size"] = args?.size;
resourceInputs["startupTaints"] = args?.startupTaints;
resourceInputs["tags"] = args?.tags;
resourceInputs["taints"] = args?.taints;
resourceInputs["upgradePolicy"] = args?.upgradePolicy;
resourceInputs["version"] = args?.version;
resourceInputs["waitForPoolReady"] = args?.waitForPoolReady;
resourceInputs["zone"] = args?.zone;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["currentSize"] = undefined /*out*/;
resourceInputs["nodes"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(KubernetesNodePool.__pulumiType, name, resourceInputs, opts);
}
}
exports.KubernetesNodePool = KubernetesNodePool;
//# sourceMappingURL=kubernetesNodePool.js.map