@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
312 lines • 10.4 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.LkeCluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Manages an LKE cluster.
* For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-lke-cluster).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_cluster = new linode.LkeCluster("my-cluster", {
* label: "my-cluster",
* k8sVersion: "1.32",
* region: "us-central",
* tags: ["prod"],
* pools: [{
* type: "g6-standard-2",
* count: 3,
* }],
* });
* ```
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const test = new linode.LkeCluster("test", {
* label: "lke-e-cluster",
* region: "us-lax",
* k8sVersion: "v1.31.8+lke5",
* tags: ["test"],
* tier: "enterprise",
* pools: [{
* type: "g7-premium-2",
* count: 3,
* tags: ["test"],
* }],
* });
* ```
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_cluster = new linode.LkeCluster("my-cluster", {
* label: "my-cluster",
* k8sVersion: "1.32",
* region: "us-central",
* tags: ["prod"],
* pools: [{
* type: "g6-standard-2",
* autoscaler: {
* min: 3,
* max: 10,
* },
* }],
* });
* ```
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const test = new linode.LkeCluster("test", {
* label: "my-cluster",
* k8sVersion: "1.32",
* region: "us-central",
* tags: ["prod"],
* controlPlane: {
* highAvailability: true,
* acl: {
* enabled: true,
* addresses: [{
* ipv4s: ["0.0.0.0/0"],
* ipv6s: ["2001:db8::/32"],
* }],
* },
* },
* pools: [{
* type: "g6-standard-2",
* count: 1,
* }],
* });
* ```
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_cluster = new linode.LkeCluster("my-cluster", {
* label: "my-cluster",
* k8sVersion: "1.32",
* region: "us-central",
* tags: ["prod"],
* pools: [
* {
* type: "g6-standard-2",
* count: 2,
* label: "db-pool",
* },
* {
* type: "g6-standard-1",
* count: 3,
* label: "app-pool",
* },
* ],
* });
* ```
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_cluster = new linode.LkeCluster("my-cluster", {
* label: "my-cluster",
* k8sVersion: "1.32",
* region: "us-central",
* tags: ["prod"],
* pools: [{
* type: "g6-standard-2",
* count: 2,
* label: "db-pool",
* firewallId: 12345,
* }],
* });
* ```
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_cluster = new linode.LkeCluster("my-cluster", {
* label: "my-cluster",
* k8sVersion: "1.32",
* region: "us-central",
* tags: ["prod"],
* pools: [
* {
* type: "g6-standard-2",
* count: 2,
* labels: {
* role: "database",
* environment: "production",
* },
* },
* {
* type: "g6-standard-1",
* count: 3,
* labels: {
* role: "application",
* environment: "production",
* },
* },
* ],
* });
* ```
*
* ## Nested Node Pool Caveats
*
* Due to limitations in the provider there are some minor caveats that may cause unexpected behavior when updating
* nested `pool` blocks in this resource.
* Primarily, the order of `pool` blocks is significant because the ID of each pool is resolved from
* the Terraform state.
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_cluster = new linode.LkeCluster("my-cluster", {pools: [
* {
* type: "g6-standard-1",
* count: 2,
* },
* {
* type: "g6-standard-2",
* count: 3,
* },
* ]});
* ```
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const my_cluster = new linode.LkeCluster("my-cluster", {pools: [{
* type: "g6-standard-2",
* count: 3,
* }]});
* ```
* ## Externally Managed Node Pools
*
* By default, the `linode.LkeCluster` resource will account for all node pools under the corresponding cluster, meaning
* any node pools created externally or managed by other resources will be removed on subsequent applies.
*
* To signal the provider to ignore externally managed node pools, the `externalPoolTags` attribute can be defined with
* tags matching a tag on an externally managed node pool.
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const externalPoolTag = "external";
* const my_cluster = new linode.LkeCluster("my-cluster", {
* label: "my-cluster",
* k8sVersion: "1.32",
* region: "us-mia",
* externalPoolTags: [externalPoolTag],
* pools: [{
* type: "g6-standard-1",
* count: 1,
* }],
* });
* const my_pool = new linode.LkeNodePool("my-pool", {
* clusterId: my_cluster.id,
* type: "g6-standard-2",
* nodeCount: 3,
* tags: [externalPoolTag],
* });
* ```
*
* ## Import
*
* LKE Clusters can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import linode:index/lkeCluster:LkeCluster my_cluster 12345
* ```
*/
class LkeCluster extends pulumi.CustomResource {
/**
* Get an existing LkeCluster 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 LkeCluster(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of LkeCluster. 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'] === LkeCluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["apiEndpoints"] = state?.apiEndpoints;
resourceInputs["aplEnabled"] = state?.aplEnabled;
resourceInputs["controlPlane"] = state?.controlPlane;
resourceInputs["dashboardUrl"] = state?.dashboardUrl;
resourceInputs["externalPoolTags"] = state?.externalPoolTags;
resourceInputs["k8sVersion"] = state?.k8sVersion;
resourceInputs["kubeconfig"] = state?.kubeconfig;
resourceInputs["label"] = state?.label;
resourceInputs["pools"] = state?.pools;
resourceInputs["region"] = state?.region;
resourceInputs["stackType"] = state?.stackType;
resourceInputs["status"] = state?.status;
resourceInputs["subnetId"] = state?.subnetId;
resourceInputs["tags"] = state?.tags;
resourceInputs["tier"] = state?.tier;
resourceInputs["vpcId"] = state?.vpcId;
}
else {
const args = argsOrState;
if (args?.k8sVersion === undefined && !opts.urn) {
throw new Error("Missing required property 'k8sVersion'");
}
if (args?.label === undefined && !opts.urn) {
throw new Error("Missing required property 'label'");
}
if (args?.pools === undefined && !opts.urn) {
throw new Error("Missing required property 'pools'");
}
if (args?.region === undefined && !opts.urn) {
throw new Error("Missing required property 'region'");
}
resourceInputs["aplEnabled"] = args?.aplEnabled;
resourceInputs["controlPlane"] = args?.controlPlane;
resourceInputs["externalPoolTags"] = args?.externalPoolTags;
resourceInputs["k8sVersion"] = args?.k8sVersion;
resourceInputs["label"] = args?.label;
resourceInputs["pools"] = args?.pools;
resourceInputs["region"] = args?.region;
resourceInputs["stackType"] = args?.stackType;
resourceInputs["subnetId"] = args?.subnetId;
resourceInputs["tags"] = args?.tags;
resourceInputs["tier"] = args?.tier;
resourceInputs["vpcId"] = args?.vpcId;
resourceInputs["apiEndpoints"] = undefined /*out*/;
resourceInputs["dashboardUrl"] = undefined /*out*/;
resourceInputs["kubeconfig"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["kubeconfig"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(LkeCluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.LkeCluster = LkeCluster;
/** @internal */
LkeCluster.__pulumiType = 'linode:index/lkeCluster:LkeCluster';
//# sourceMappingURL=lkeCluster.js.map