UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

406 lines 20.5 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.Node = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Add a node to a CCE cluster. * * ## Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const clusterId = config.requireObject("clusterId"); * const nodeName = config.requireObject("nodeName"); * const keypairName = config.requireObject("keypairName"); * const myaz = huaweicloud.getAvailabilityZones({}); * const myflavors = myaz.then(myaz => huaweicloud.Ecs.getFlavors({ * availabilityZone: myaz.names?[0], * performanceType: "normal", * cpuCoreCount: 2, * memorySize: 4, * })); * const mykp = new huaweicloud.dew.Keypair("mykp", {publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLo1BCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAT9+OfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZquwhvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TAIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIFuu1p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB jrp-hp-pc"}); * const node = new huaweicloud.cce.Node("node", { * clusterId: clusterId, * flavorId: myflavors.then(myflavors => myflavors.ids?[0]), * availabilityZone: myaz.then(myaz => myaz.names?[0]), * keyPair: mykp.name, * rootVolume: { * size: 40, * volumetype: "SATA", * }, * dataVolumes: [{ * size: 100, * volumetype: "SATA", * }], * }); * ``` * * ## Node with Eip * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const clusterId = config.requireObject("clusterId"); * const nodeName = config.requireObject("nodeName"); * const keypairName = config.requireObject("keypairName"); * const myaz = huaweicloud.getAvailabilityZones({}); * const test = myaz.then(myaz => huaweicloud.Ecs.getFlavors({ * availabilityZone: myaz.names?[0], * performanceType: "normal", * cpuCoreCount: 2, * memorySize: 4, * })); * const mykp = new huaweicloud.dew.Keypair("mykp", {publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLo1BCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAT9+OfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZquwhvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TAIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIFuu1p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB jrp-hp-pc"}); * const mynode = new huaweicloud.cce.Node("mynode", { * clusterId: clusterId, * flavorId: data.huaweicloud_compute_flavors.myflavors.ids[0], * availabilityZone: myaz.then(myaz => myaz.names?[0]), * keyPair: mykp.name, * rootVolume: { * size: 40, * volumetype: "SATA", * }, * dataVolumes: [{ * size: 100, * volumetype: "SATA", * }], * iptype: "5_bgp", * bandwidthChargeMode: "traffic", * sharetype: "PER", * bandwidthSize: 100, * }); * ``` * * ## Node with Existing Eip * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const clusterId = config.requireObject("clusterId"); * const nodeName = config.requireObject("nodeName"); * const keypairName = config.requireObject("keypairName"); * const myaz = huaweicloud.getAvailabilityZones({}); * const test = myaz.then(myaz => huaweicloud.Ecs.getFlavors({ * availabilityZone: myaz.names?[0], * performanceType: "normal", * cpuCoreCount: 2, * memorySize: 4, * })); * const mykp = new huaweicloud.dew.Keypair("mykp", {publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLo1BCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAT9+OfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZquwhvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TAIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIFuu1p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB jrp-hp-pc"}); * const myeip = new huaweicloud.vpc.Eip("myeip", { * publicip: { * type: "5_bgp", * }, * bandwidth: { * name: "test", * size: 8, * shareType: "PER", * chargeMode: "traffic", * }, * }); * const mynode = new huaweicloud.cce.Node("mynode", { * clusterId: clusterId, * flavorId: data.huaweicloud_compute_flavors.myflavors.ids[0], * availabilityZone: myaz.then(myaz => myaz.names?[0]), * keyPair: mykp.name, * rootVolume: { * size: 40, * volumetype: "SATA", * }, * dataVolumes: [{ * size: 100, * volumetype: "SATA", * }], * eipId: myeip.id, * }); * ``` * * ## Node with storage configuration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const clusterId = config.requireObject("clusterId"); * const nodeName = config.requireObject("nodeName"); * const keypairName = config.requireObject("keypairName"); * const kmsKeyName = config.requireObject("kmsKeyName"); * const myaz = huaweicloud.getAvailabilityZones({}); * const test = myaz.then(myaz => huaweicloud.Ecs.getFlavors({ * availabilityZone: myaz.names?[0], * performanceType: "normal", * cpuCoreCount: 2, * memorySize: 4, * })); * const mykp = new huaweicloud.dew.Keypair("mykp", {publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLo1BCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAT9+OfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZquwhvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TAIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIFuu1p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB jrp-hp-pc"}); * const mykey = new huaweicloud.dew.Key("mykey", { * keyAlias: kmsKeyName, * pendingDays: "7", * }); * const mynode = new huaweicloud.cce.Node("mynode", { * clusterId: clusterId, * flavorId: data.huaweicloud_compute_flavors.myflavors.ids[0], * availabilityZone: myaz.then(myaz => myaz.names?[0]), * keyPair: mykp.name, * rootVolume: { * size: 40, * volumetype: "SSD", * }, * dataVolumes: [ * { * size: 100, * volumetype: "SSD", * }, * { * size: 100, * volumetype: "SSD", * kmsKeyId: mykey.id, * }, * ], * storage: { * selectors: [ * { * name: "cceUse", * type: "evs", * matchLabelSize: "100", * matchLabelCount: "1", * }, * { * name: "user", * type: "evs", * matchLabelSize: "100", * matchLabelMetadataEncrypted: "1", * matchLabelMetadataCmkid: mykey.id, * matchLabelCount: "1", * }, * ], * groups: [ * { * name: "vgpaas", * selectorNames: ["cceUse"], * cceManaged: true, * virtualSpaces: [ * { * name: "kubernetes", * size: `10%`, * lvmLvType: "linear", * }, * { * name: "runtime", * size: `90%`, * }, * ], * }, * { * name: "vguser", * selectorNames: ["user"], * virtualSpaces: [{ * name: "user", * size: `100%`, * lvmLvType: "linear", * lvmPath: "/workspace", * }], * }, * ], * }, * }); * ``` * * ## Import * * CCE node can be imported using the cluster ID and node ID separated by a slash, e.g.bash * * ```sh * $ pulumi import huaweicloud:Cce/node:Node my_node 5c20fdad-7288-11eb-b817-0255ac10158b/e9287dff-7288-11eb-b817-0255ac10158b * ``` * * 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`password`, `private_key`, `storage`, `fixed_ip`, `extension_nics`, `eip_id`, `iptype`, `bandwidth_charge_mode`, `bandwidth_size`, `share_type`, `extend_params`, `dedicated_host_id`, `initialized_conditions`, `labels`, `taints` and arguments for pre-paid. It is generally recommended running `terraform plan` after importing a node. You can then decide if changes should be applied to the node, or the resource definition should be updated to align with the node. Also you can ignore changes as below. hcl resource "huaweicloud_cce_node" "my_node" { * * ... * * lifecycle { * * ignore_changes = [ * * extend_params, labels, * * ] * * } } */ class Node extends pulumi.CustomResource { /** * Get an existing Node 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 Node(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Node. 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'] === Node.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["annotations"] = state ? state.annotations : undefined; resourceInputs["autoPay"] = state ? state.autoPay : undefined; resourceInputs["autoRenew"] = state ? state.autoRenew : undefined; resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined; resourceInputs["bandwidthChargeMode"] = state ? state.bandwidthChargeMode : undefined; resourceInputs["bandwidthSize"] = state ? state.bandwidthSize : undefined; resourceInputs["billingMode"] = state ? state.billingMode : undefined; resourceInputs["chargingMode"] = state ? state.chargingMode : undefined; resourceInputs["clusterId"] = state ? state.clusterId : undefined; resourceInputs["dataVolumes"] = state ? state.dataVolumes : undefined; resourceInputs["dedicatedHostId"] = state ? state.dedicatedHostId : undefined; resourceInputs["ecsGroupId"] = state ? state.ecsGroupId : undefined; resourceInputs["ecsPerformanceType"] = state ? state.ecsPerformanceType : undefined; resourceInputs["eipId"] = state ? state.eipId : undefined; resourceInputs["eipIds"] = state ? state.eipIds : undefined; resourceInputs["enableForceNew"] = state ? state.enableForceNew : undefined; resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined; resourceInputs["extendParam"] = state ? state.extendParam : undefined; resourceInputs["extendParamChargingMode"] = state ? state.extendParamChargingMode : undefined; resourceInputs["extendParams"] = state ? state.extendParams : undefined; resourceInputs["extensionNics"] = state ? state.extensionNics : undefined; resourceInputs["fixedIp"] = state ? state.fixedIp : undefined; resourceInputs["flavorId"] = state ? state.flavorId : undefined; resourceInputs["hostnameConfig"] = state ? state.hostnameConfig : undefined; resourceInputs["initializedConditions"] = state ? state.initializedConditions : undefined; resourceInputs["iptype"] = state ? state.iptype : undefined; resourceInputs["keepEcs"] = state ? state.keepEcs : undefined; resourceInputs["keyPair"] = state ? state.keyPair : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["maxPods"] = state ? state.maxPods : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["orderId"] = state ? state.orderId : undefined; resourceInputs["os"] = state ? state.os : undefined; resourceInputs["partition"] = state ? state.partition : undefined; resourceInputs["password"] = state ? state.password : undefined; resourceInputs["period"] = state ? state.period : undefined; resourceInputs["periodUnit"] = state ? state.periodUnit : undefined; resourceInputs["postinstall"] = state ? state.postinstall : undefined; resourceInputs["preinstall"] = state ? state.preinstall : undefined; resourceInputs["privateIp"] = state ? state.privateIp : undefined; resourceInputs["privateKey"] = state ? state.privateKey : undefined; resourceInputs["productId"] = state ? state.productId : undefined; resourceInputs["publicIp"] = state ? state.publicIp : undefined; resourceInputs["publicKey"] = state ? state.publicKey : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["rootVolume"] = state ? state.rootVolume : undefined; resourceInputs["runtime"] = state ? state.runtime : undefined; resourceInputs["serverId"] = state ? state.serverId : undefined; resourceInputs["sharetype"] = state ? state.sharetype : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["storage"] = state ? state.storage : undefined; resourceInputs["subnetId"] = state ? state.subnetId : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["taints"] = state ? state.taints : undefined; } else { const args = argsOrState; if ((!args || args.availabilityZone === undefined) && !opts.urn) { throw new Error("Missing required property 'availabilityZone'"); } if ((!args || args.clusterId === undefined) && !opts.urn) { throw new Error("Missing required property 'clusterId'"); } if ((!args || args.flavorId === undefined) && !opts.urn) { throw new Error("Missing required property 'flavorId'"); } if ((!args || args.rootVolume === undefined) && !opts.urn) { throw new Error("Missing required property 'rootVolume'"); } resourceInputs["annotations"] = args ? args.annotations : undefined; resourceInputs["autoPay"] = args ? args.autoPay : undefined; resourceInputs["autoRenew"] = args ? args.autoRenew : undefined; resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined; resourceInputs["bandwidthChargeMode"] = args ? args.bandwidthChargeMode : undefined; resourceInputs["bandwidthSize"] = args ? args.bandwidthSize : undefined; resourceInputs["billingMode"] = args ? args.billingMode : undefined; resourceInputs["chargingMode"] = args ? args.chargingMode : undefined; resourceInputs["clusterId"] = args ? args.clusterId : undefined; resourceInputs["dataVolumes"] = args ? args.dataVolumes : undefined; resourceInputs["dedicatedHostId"] = args ? args.dedicatedHostId : undefined; resourceInputs["ecsGroupId"] = args ? args.ecsGroupId : undefined; resourceInputs["ecsPerformanceType"] = args ? args.ecsPerformanceType : undefined; resourceInputs["eipId"] = args ? args.eipId : undefined; resourceInputs["eipIds"] = args ? args.eipIds : undefined; resourceInputs["enableForceNew"] = args ? args.enableForceNew : undefined; resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined; resourceInputs["extendParam"] = args ? args.extendParam : undefined; resourceInputs["extendParamChargingMode"] = args ? args.extendParamChargingMode : undefined; resourceInputs["extendParams"] = args ? args.extendParams : undefined; resourceInputs["extensionNics"] = args ? args.extensionNics : undefined; resourceInputs["fixedIp"] = args ? args.fixedIp : undefined; resourceInputs["flavorId"] = args ? args.flavorId : undefined; resourceInputs["hostnameConfig"] = args ? args.hostnameConfig : undefined; resourceInputs["initializedConditions"] = args ? args.initializedConditions : undefined; resourceInputs["iptype"] = args ? args.iptype : undefined; resourceInputs["keepEcs"] = args ? args.keepEcs : undefined; resourceInputs["keyPair"] = args ? args.keyPair : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["maxPods"] = args ? args.maxPods : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["orderId"] = args ? args.orderId : undefined; resourceInputs["os"] = args ? args.os : undefined; resourceInputs["partition"] = args ? args.partition : undefined; resourceInputs["password"] = args ? args.password : undefined; resourceInputs["period"] = args ? args.period : undefined; resourceInputs["periodUnit"] = args ? args.periodUnit : undefined; resourceInputs["postinstall"] = args ? args.postinstall : undefined; resourceInputs["preinstall"] = args ? args.preinstall : undefined; resourceInputs["privateKey"] = args ? args.privateKey : undefined; resourceInputs["productId"] = args ? args.productId : undefined; resourceInputs["publicKey"] = args ? args.publicKey : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["rootVolume"] = args ? args.rootVolume : undefined; resourceInputs["runtime"] = args ? args.runtime : undefined; resourceInputs["sharetype"] = args ? args.sharetype : undefined; resourceInputs["storage"] = args ? args.storage : undefined; resourceInputs["subnetId"] = args ? args.subnetId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["taints"] = args ? args.taints : undefined; resourceInputs["privateIp"] = undefined /*out*/; resourceInputs["publicIp"] = undefined /*out*/; resourceInputs["serverId"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Node.__pulumiType, name, resourceInputs, opts); } } exports.Node = Node; /** @internal */ Node.__pulumiType = 'huaweicloud:Cce/node:Node'; //# sourceMappingURL=node.js.map