UNPKG

@ediri/vultr

Version:

A Pulumi package for creating and managing Vultr cloud resources.

167 lines 7.47 kB
"use strict"; // *** 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.Kubernetes = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * Create a new VKE cluster: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vultr from "@ediri/vultr"; * * const k8 = new vultr.Kubernetes("k8", { * label: "vke-test", * nodePools: { * autoScaler: true, * label: "vke-nodepool", * labels: { * "my-label": "a-label-on-all-nodes", * "my-second-label": "another-label-on-all-nodes", * }, * maxNodes: 2, * minNodes: 1, * nodeQuantity: 1, * plan: "vc2-1c-2gb", * taints: [{ * effect: "NoExecute", * key: "a-taint", * value: "is-tainted", * }], * }, * region: "ewr", * version: "v1.28.2+1", * }); * ``` * * A default node pool is required when first creating the resource but it can be removed at a later point so long as there is a separate `vultr.KubernetesNodePools` resource attached. For example: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vultr from "@ediri/vultr"; * * const k8 = new vultr.Kubernetes("k8", { * region: "ewr", * label: "vke-test", * version: "v1.28.2+1", * }); * // This resource must be created and attached to the cluster * // before removing the default node from the vultr_kubernetes resource * const np = new vultr.KubernetesNodePools("np", { * clusterId: k8.id, * nodeQuantity: 1, * plan: "vc2-1c-2gb", * label: "vke-nodepool", * autoScaler: true, * minNodes: 1, * maxNodes: 2, * }); * ``` * * There is still a requirement that there be one node pool attached to the cluster but this should allow more flexibility about which node pool that is. * * ## Import * * A kubernetes cluster created outside of terraform can be imported into the * * terraform state using the UUID. One thing to note is that all kubernetes * * resources have a default node pool with a tag of `tf-vke-default`. In order to * * avoid errors, ensure that there is a node pool with that tag set. * * ```sh * $ pulumi import vultr:index/kubernetes:Kubernetes my-k8s 7365a98b-5a43-450f-bd27-d768827100e5 * ``` */ class Kubernetes extends pulumi.CustomResource { /** * Get an existing Kubernetes 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 Kubernetes(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Kubernetes. 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'] === Kubernetes.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["clientCertificate"] = state ? state.clientCertificate : undefined; resourceInputs["clientKey"] = state ? state.clientKey : undefined; resourceInputs["clusterCaCertificate"] = state ? state.clusterCaCertificate : undefined; resourceInputs["clusterSubnet"] = state ? state.clusterSubnet : undefined; resourceInputs["dateCreated"] = state ? state.dateCreated : undefined; resourceInputs["enableFirewall"] = state ? state.enableFirewall : undefined; resourceInputs["endpoint"] = state ? state.endpoint : undefined; resourceInputs["firewallGroupId"] = state ? state.firewallGroupId : undefined; resourceInputs["haControlplanes"] = state ? state.haControlplanes : undefined; resourceInputs["ip"] = state ? state.ip : undefined; resourceInputs["kubeConfig"] = state ? state.kubeConfig : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["nodePools"] = state ? state.nodePools : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["serviceSubnet"] = state ? state.serviceSubnet : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["version"] = state ? state.version : undefined; resourceInputs["vpcId"] = state ? state.vpcId : undefined; } else { const args = argsOrState; if ((!args || args.label === undefined) && !opts.urn) { throw new Error("Missing required property 'label'"); } if ((!args || args.region === undefined) && !opts.urn) { throw new Error("Missing required property 'region'"); } if ((!args || args.version === undefined) && !opts.urn) { throw new Error("Missing required property 'version'"); } resourceInputs["enableFirewall"] = args ? args.enableFirewall : undefined; resourceInputs["haControlplanes"] = args ? args.haControlplanes : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["nodePools"] = args ? args.nodePools : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["version"] = args ? args.version : undefined; resourceInputs["vpcId"] = args ? args.vpcId : undefined; resourceInputs["clientCertificate"] = undefined /*out*/; resourceInputs["clientKey"] = undefined /*out*/; resourceInputs["clusterCaCertificate"] = undefined /*out*/; resourceInputs["clusterSubnet"] = undefined /*out*/; resourceInputs["dateCreated"] = undefined /*out*/; resourceInputs["endpoint"] = undefined /*out*/; resourceInputs["firewallGroupId"] = undefined /*out*/; resourceInputs["ip"] = undefined /*out*/; resourceInputs["kubeConfig"] = undefined /*out*/; resourceInputs["serviceSubnet"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["clientCertificate", "clientKey", "clusterCaCertificate", "kubeConfig"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Kubernetes.__pulumiType, name, resourceInputs, opts); } } exports.Kubernetes = Kubernetes; /** @internal */ Kubernetes.__pulumiType = 'vultr:index/kubernetes:Kubernetes'; //# sourceMappingURL=kubernetes.js.map