@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
151 lines • 6.21 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.KubernetesNodeGroup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource represents a [Managed Kubernetes](https://upcloud.com/products/managed-kubernetes) cluster.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* // Create a network for the Kubernetes cluster
* const example = new upcloud.Network("example", {
* name: "example-network",
* zone: "de-fra1",
* ipNetwork: {
* address: "172.16.1.0/24",
* dhcp: true,
* family: "IPv4",
* },
* });
* // Create a Kubernetes cluster
* const exampleKubernetesCluster = new upcloud.KubernetesCluster("example", {
* controlPlaneIpFilters: ["0.0.0.0/0"],
* name: "exampleapp",
* network: example.id,
* zone: "de-fra1",
* });
* // Create a Kubernetes cluster node group
* const group = new upcloud.KubernetesNodeGroup("group", {
* cluster: upcloudKubernetesCluster.example.id,
* nodeCount: 2,
* name: "medium",
* plan: "2xCPU-4GB",
* labels: {
* managedBy: "terraform",
* },
* taints: [{
* effect: "NoExecute",
* key: "taintKey",
* value: "taintValue",
* }],
* });
* // Create a Kubernetes cluster node group with a GPU plan, with a custom storage size
* const groupGpu = new upcloud.KubernetesNodeGroup("group_gpu", {
* cluster: upcloudKubernetesCluster.example.id,
* nodeCount: 2,
* name: "gpu-workers",
* plan: "GPU-8xCPU-64GB-1xL40S",
* gpuPlan: {
* storageSize: 250,
* },
* labels: {
* gpu: "NVIDIA-L40S",
* },
* });
* // Create a Kubernetes cluster node group with a Cloud Native plan, with a custom storage size and tier
* const groupCloudNative = new upcloud.KubernetesNodeGroup("group_cloud_native", {
* cluster: upcloudKubernetesCluster.example.id,
* nodeCount: 4,
* name: "cloud-native-workers",
* plan: "CLOUDNATIVE-4xCPU-8GB",
* cloudNativePlan: {
* storageSize: 100,
* storageTier: "standard",
* },
* });
* ```
*/
class KubernetesNodeGroup extends pulumi.CustomResource {
/**
* Get an existing KubernetesNodeGroup 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) {
return new KubernetesNodeGroup(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of KubernetesNodeGroup. 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'] === KubernetesNodeGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["antiAffinity"] = state?.antiAffinity;
resourceInputs["cloudNativePlan"] = state?.cloudNativePlan;
resourceInputs["cluster"] = state?.cluster;
resourceInputs["customPlan"] = state?.customPlan;
resourceInputs["gpuPlan"] = state?.gpuPlan;
resourceInputs["kubeletArgs"] = state?.kubeletArgs;
resourceInputs["labels"] = state?.labels;
resourceInputs["name"] = state?.name;
resourceInputs["nodeCount"] = state?.nodeCount;
resourceInputs["plan"] = state?.plan;
resourceInputs["sshKeys"] = state?.sshKeys;
resourceInputs["storageEncryption"] = state?.storageEncryption;
resourceInputs["taints"] = state?.taints;
resourceInputs["utilityNetworkAccess"] = state?.utilityNetworkAccess;
}
else {
const args = argsOrState;
if (args?.cluster === undefined && !opts.urn) {
throw new Error("Missing required property 'cluster'");
}
if (args?.nodeCount === undefined && !opts.urn) {
throw new Error("Missing required property 'nodeCount'");
}
if (args?.plan === undefined && !opts.urn) {
throw new Error("Missing required property 'plan'");
}
resourceInputs["antiAffinity"] = args?.antiAffinity;
resourceInputs["cloudNativePlan"] = args?.cloudNativePlan;
resourceInputs["cluster"] = args?.cluster;
resourceInputs["customPlan"] = args?.customPlan;
resourceInputs["gpuPlan"] = args?.gpuPlan;
resourceInputs["kubeletArgs"] = args?.kubeletArgs;
resourceInputs["labels"] = args?.labels;
resourceInputs["name"] = args?.name;
resourceInputs["nodeCount"] = args?.nodeCount;
resourceInputs["plan"] = args?.plan;
resourceInputs["sshKeys"] = args?.sshKeys;
resourceInputs["storageEncryption"] = args?.storageEncryption;
resourceInputs["taints"] = args?.taints;
resourceInputs["utilityNetworkAccess"] = args?.utilityNetworkAccess;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(KubernetesNodeGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.KubernetesNodeGroup = KubernetesNodeGroup;
/** @internal */
KubernetesNodeGroup.__pulumiType = 'upcloud:index/kubernetesNodeGroup:KubernetesNodeGroup';
//# sourceMappingURL=kubernetesNodeGroup.js.map