UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

302 lines 15.8 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Cluster = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a CCE cluster resource. * * ## Example Usage * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const myvpc = new huaweicloud.vpc.Vpc("myvpc", {cidr: "192.168.0.0/16"}); * const mysubnet = new huaweicloud.vpc.Subnet("mysubnet", { * cidr: "192.168.0.0/16", * gatewayIp: "192.168.0.1", * primaryDns: "100.125.1.250", * secondaryDns: "100.125.21.250", * vpcId: myvpc.id, * }); * const cluster = new huaweicloud.cce.Cluster("cluster", { * flavorId: "cce.s1.small", * vpcId: myvpc.id, * subnetId: mysubnet.id, * containerNetworkType: "overlay_l2", * }); * ``` * ### Cluster With EIP * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const myvpc = new huaweicloud.vpc.Vpc("myvpc", {cidr: "192.168.0.0/16"}); * const mysubnet = new huaweicloud.vpc.Subnet("mysubnet", { * cidr: "192.168.0.0/16", * gatewayIp: "192.168.0.1", * primaryDns: "100.125.1.250", * secondaryDns: "100.125.21.250", * vpcId: myvpc.id, * }); * const myeip = new huaweicloud.vpc.Eip("myeip", { * publicip: { * type: "5_bgp", * }, * bandwidth: { * name: "test", * size: 8, * shareType: "PER", * chargeMode: "traffic", * }, * }); * const cluster = new huaweicloud.cce.Cluster("cluster", { * clusterType: "VirtualMachine", * flavorId: "cce.s1.small", * vpcId: myvpc.id, * subnetId: mysubnet.id, * containerNetworkType: "overlay_l2", * authenticationMode: "rbac", * eip: myeip.address, * }); * ``` * ### CCE HA Cluster * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const vpcId = config.requireObject("vpcId"); * const subnetId = config.requireObject("subnetId"); * const cluster = new huaweicloud.cce.Cluster("cluster", { * flavorId: "cce.s2.small", * vpcId: vpcId, * subnetId: subnetId, * containerNetworkType: "overlay_l2", * masters: [ * { * availabilityZone: "cn-north-4a", * }, * { * availabilityZone: "cn-north-4b", * }, * { * availabilityZone: "cn-north-4c", * }, * ], * }); * ``` * ### Cluster with Component Configurations * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const vpcId = config.requireObject("vpcId"); * const subnetId = config.requireObject("subnetId"); * const cluster = new huaweicloud.cce.Cluster("cluster", { * flavorId: "cce.s1.small", * vpcId: vpcId, * subnetId: subnetId, * containerNetworkType: "overlay_l2", * componentConfigurations: [{ * name: "kube-apiserver", * configurations: JSON.stringify([{ * name: "default-not-ready-toleration-seconds", * value: "100", * }]), * }], * }); * ``` * * ## Import * * Cluster can be imported using the cluster ID, e.g. * * ```sh * $ pulumi import huaweicloud:Cce/cluster:Cluster huaweicloud_cce_cluster.cluster_1 4779ab1c-7c1a-44b1-a02e-93dfc361b32d * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`delete_efs`, `delete_eni`, `delete_evs`, `delete_net`, `delete_obs`, `delete_sfs` and `delete_all`. It is generally recommended running `terraform plan` after importing an CCE cluster. You can then decide if changes should be applied to the cluster, or the resource definition should be updated to align with the cluster. Also you can ignore changes as below. hcl resource "huaweicloud_cce_cluster" "cluster_1" { * * ... * * lifecycle { * * ignore_changes = [ * * delete_efs, delete_obs, * * ] * * } } */ class Cluster extends pulumi.CustomResource { /** * Get an existing Cluster 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 Cluster(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Cluster. 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'] === Cluster.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["alias"] = state ? state.alias : undefined; resourceInputs["annotations"] = state ? state.annotations : undefined; resourceInputs["authenticatingProxyCa"] = state ? state.authenticatingProxyCa : undefined; resourceInputs["authenticatingProxyCert"] = state ? state.authenticatingProxyCert : undefined; resourceInputs["authenticatingProxyPrivateKey"] = state ? state.authenticatingProxyPrivateKey : undefined; resourceInputs["authenticationMode"] = state ? state.authenticationMode : undefined; resourceInputs["autoPay"] = state ? state.autoPay : undefined; resourceInputs["autoRenew"] = state ? state.autoRenew : undefined; resourceInputs["billingMode"] = state ? state.billingMode : undefined; resourceInputs["category"] = state ? state.category : undefined; resourceInputs["certificateClusters"] = state ? state.certificateClusters : undefined; resourceInputs["certificateUsers"] = state ? state.certificateUsers : undefined; resourceInputs["chargingMode"] = state ? state.chargingMode : undefined; resourceInputs["clusterType"] = state ? state.clusterType : undefined; resourceInputs["clusterVersion"] = state ? state.clusterVersion : undefined; resourceInputs["componentConfigurations"] = state ? state.componentConfigurations : undefined; resourceInputs["containerNetworkCidr"] = state ? state.containerNetworkCidr : undefined; resourceInputs["containerNetworkType"] = state ? state.containerNetworkType : undefined; resourceInputs["customSans"] = state ? state.customSans : undefined; resourceInputs["deleteAll"] = state ? state.deleteAll : undefined; resourceInputs["deleteEfs"] = state ? state.deleteEfs : undefined; resourceInputs["deleteEni"] = state ? state.deleteEni : undefined; resourceInputs["deleteEvs"] = state ? state.deleteEvs : undefined; resourceInputs["deleteNet"] = state ? state.deleteNet : undefined; resourceInputs["deleteObs"] = state ? state.deleteObs : undefined; resourceInputs["deleteSfs"] = state ? state.deleteSfs : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["eip"] = state ? state.eip : undefined; resourceInputs["enableDistributeManagement"] = state ? state.enableDistributeManagement : undefined; resourceInputs["eniSubnetCidr"] = state ? state.eniSubnetCidr : undefined; resourceInputs["eniSubnetId"] = state ? state.eniSubnetId : undefined; resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined; resourceInputs["extendParam"] = state ? state.extendParam : undefined; resourceInputs["extendParams"] = state ? state.extendParams : undefined; resourceInputs["flavorId"] = state ? state.flavorId : undefined; resourceInputs["hibernate"] = state ? state.hibernate : undefined; resourceInputs["highwaySubnetId"] = state ? state.highwaySubnetId : undefined; resourceInputs["ipv6Enable"] = state ? state.ipv6Enable : undefined; resourceInputs["kubeConfigRaw"] = state ? state.kubeConfigRaw : undefined; resourceInputs["kubeProxyMode"] = state ? state.kubeProxyMode : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["ltsReclaimPolicy"] = state ? state.ltsReclaimPolicy : undefined; resourceInputs["masters"] = state ? state.masters : undefined; resourceInputs["multiAz"] = state ? state.multiAz : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["period"] = state ? state.period : undefined; resourceInputs["periodUnit"] = state ? state.periodUnit : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["securityGroupId"] = state ? state.securityGroupId : undefined; resourceInputs["serviceNetworkCidr"] = state ? state.serviceNetworkCidr : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["subnetId"] = state ? state.subnetId : undefined; resourceInputs["supportIstio"] = state ? state.supportIstio : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["vpcId"] = state ? state.vpcId : undefined; } else { const args = argsOrState; if ((!args || args.containerNetworkType === undefined) && !opts.urn) { throw new Error("Missing required property 'containerNetworkType'"); } if ((!args || args.flavorId === undefined) && !opts.urn) { throw new Error("Missing required property 'flavorId'"); } if ((!args || args.subnetId === undefined) && !opts.urn) { throw new Error("Missing required property 'subnetId'"); } if ((!args || args.vpcId === undefined) && !opts.urn) { throw new Error("Missing required property 'vpcId'"); } resourceInputs["alias"] = args ? args.alias : undefined; resourceInputs["annotations"] = args ? args.annotations : undefined; resourceInputs["authenticatingProxyCa"] = args ? args.authenticatingProxyCa : undefined; resourceInputs["authenticatingProxyCert"] = args ? args.authenticatingProxyCert : undefined; resourceInputs["authenticatingProxyPrivateKey"] = args ? args.authenticatingProxyPrivateKey : undefined; resourceInputs["authenticationMode"] = args ? args.authenticationMode : undefined; resourceInputs["autoPay"] = args ? args.autoPay : undefined; resourceInputs["autoRenew"] = args ? args.autoRenew : undefined; resourceInputs["billingMode"] = args ? args.billingMode : undefined; resourceInputs["chargingMode"] = args ? args.chargingMode : undefined; resourceInputs["clusterType"] = args ? args.clusterType : undefined; resourceInputs["clusterVersion"] = args ? args.clusterVersion : undefined; resourceInputs["componentConfigurations"] = args ? args.componentConfigurations : undefined; resourceInputs["containerNetworkCidr"] = args ? args.containerNetworkCidr : undefined; resourceInputs["containerNetworkType"] = args ? args.containerNetworkType : undefined; resourceInputs["customSans"] = args ? args.customSans : undefined; resourceInputs["deleteAll"] = args ? args.deleteAll : undefined; resourceInputs["deleteEfs"] = args ? args.deleteEfs : undefined; resourceInputs["deleteEni"] = args ? args.deleteEni : undefined; resourceInputs["deleteEvs"] = args ? args.deleteEvs : undefined; resourceInputs["deleteNet"] = args ? args.deleteNet : undefined; resourceInputs["deleteObs"] = args ? args.deleteObs : undefined; resourceInputs["deleteSfs"] = args ? args.deleteSfs : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["eip"] = args ? args.eip : undefined; resourceInputs["enableDistributeManagement"] = args ? args.enableDistributeManagement : undefined; resourceInputs["eniSubnetCidr"] = args ? args.eniSubnetCidr : undefined; resourceInputs["eniSubnetId"] = args ? args.eniSubnetId : undefined; resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined; resourceInputs["extendParam"] = args ? args.extendParam : undefined; resourceInputs["extendParams"] = args ? args.extendParams : undefined; resourceInputs["flavorId"] = args ? args.flavorId : undefined; resourceInputs["hibernate"] = args ? args.hibernate : undefined; resourceInputs["highwaySubnetId"] = args ? args.highwaySubnetId : undefined; resourceInputs["ipv6Enable"] = args ? args.ipv6Enable : undefined; resourceInputs["kubeProxyMode"] = args ? args.kubeProxyMode : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["ltsReclaimPolicy"] = args ? args.ltsReclaimPolicy : undefined; resourceInputs["masters"] = args ? args.masters : undefined; resourceInputs["multiAz"] = args ? args.multiAz : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["period"] = args ? args.period : undefined; resourceInputs["periodUnit"] = args ? args.periodUnit : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["securityGroupId"] = args ? args.securityGroupId : undefined; resourceInputs["serviceNetworkCidr"] = args ? args.serviceNetworkCidr : undefined; resourceInputs["subnetId"] = args ? args.subnetId : undefined; resourceInputs["supportIstio"] = args ? args.supportIstio : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["vpcId"] = args ? args.vpcId : undefined; resourceInputs["category"] = undefined /*out*/; resourceInputs["certificateClusters"] = undefined /*out*/; resourceInputs["certificateUsers"] = undefined /*out*/; resourceInputs["kubeConfigRaw"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; /** @internal */ Cluster.__pulumiType = 'huaweicloud:Cce/cluster:Cluster'; //# sourceMappingURL=cluster.js.map