@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
328 lines • 15.6 kB
JavaScript
;
// *** 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.NodePool = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Add a node pool to a container cluster.
*
* ## Example Usage
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const clusterId = config.requireObject("clusterId");
* const keyPair = config.requireObject("keyPair");
* const availabilityZone = config.requireObject("availabilityZone");
* const nodePool = new huaweicloud.cce.NodePool("nodePool", {
* clusterId: clusterId,
* os: "EulerOS 2.5",
* initialNodeCount: 2,
* flavorId: "s3.large.4",
* availabilityZone: availabilityZone,
* keyPair: _var.keypair,
* scallEnable: true,
* minNodeCount: 1,
* maxNodeCount: 10,
* scaleDownCooldownTime: 100,
* priority: 1,
* type: "vm",
* rootVolume: {
* size: 40,
* volumetype: "SAS",
* },
* dataVolumes: [{
* size: 100,
* volumetype: "SAS",
* }],
* });
* ```
* ## Node pool with storage configuration
* ### PrePaid node pool
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const clusterId = config.requireObject("clusterId");
* const keyPair = config.requireObject("keyPair");
* const availabilityZone = config.requireObject("availabilityZone");
* const nodePool = new huaweicloud.cce.NodePool("nodePool", {
* clusterId: clusterId,
* os: "EulerOS 2.5",
* initialNodeCount: 2,
* flavorId: "s3.large.4",
* availabilityZone: availabilityZone,
* keyPair: _var.keypair,
* scallEnable: true,
* minNodeCount: 1,
* maxNodeCount: 10,
* scaleDownCooldownTime: 100,
* priority: 1,
* type: "vm",
* chargingMode: "prePaid",
* periodUnit: "month",
* period: 1,
* rootVolume: {
* size: 40,
* volumetype: "SAS",
* },
* dataVolumes: [{
* size: 100,
* volumetype: "SAS",
* }],
* });
* ```
*
* > You need to remove all nodes in the node pool on the console, before deleting a prepaid node pool.
*
* ## Node pool with extension scale groups
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const clusterId = config.requireObject("clusterId");
* const keyPair = config.requireObject("keyPair");
* const availabilityZone1 = config.requireObject("availabilityZone1");
* const availabilityZone2 = config.requireObject("availabilityZone2");
* const nodePool = new huaweicloud.cce.NodePool("nodePool", {
* clusterId: clusterId,
* os: "EulerOS 2.5",
* initialNodeCount: 2,
* flavorId: "s3.large.4",
* availabilityZone: availabilityZone1,
* keyPair: _var.keypair,
* scallEnable: true,
* minNodeCount: 1,
* maxNodeCount: 10,
* scaleDownCooldownTime: 100,
* priority: 1,
* type: "vm",
* rootVolume: {
* size: 40,
* volumetype: "SAS",
* },
* dataVolumes: [{
* size: 100,
* volumetype: "SAS",
* }],
* extensionScaleGroups: [
* {
* metadata: {
* name: "group1",
* },
* spec: {
* flavor: "s3.large.4",
* az: availabilityZone1,
* autoscaling: {
* extensionPriority: 1,
* enable: true,
* },
* },
* },
* {
* metadata: {
* name: "group2",
* },
* spec: {
* flavor: "s3.xlarge.4",
* az: availabilityZone1,
* autoscaling: {
* extensionPriority: 1,
* enable: true,
* },
* },
* },
* {
* metadata: {
* name: "group3",
* },
* spec: {
* flavor: "s3.xlarge.4",
* az: availabilityZone2,
* autoscaling: {
* extensionPriority: 1,
* enable: true,
* },
* },
* },
* ],
* });
* ```
*
* ## Import
*
* CCE node pool can be imported using the cluster ID and node pool ID separated by a slash, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Cce/nodePool:NodePool my_node_pool <cluster_id>/<id>
* ```
*
* 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`, `extend_params`, `taints`, `initial_node_count`, `pod_security_groups` and `extension_scale_groups`. It is generally recommended running `terraform plan` after importing a node pool. You can then decide if changes should be applied to the node pool, or the resource definition should be updated to align with the node pool. Also you can ignore changes as below. hcl resource "huaweicloud_cce_node_pool" "my_node_pool" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* password, extend_params,
*
* ]
*
* } }
*/
class NodePool extends pulumi.CustomResource {
/**
* Get an existing NodePool 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 NodePool(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NodePool. 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'] === NodePool.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined;
resourceInputs["billingMode"] = state ? state.billingMode : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["clusterId"] = state ? state.clusterId : undefined;
resourceInputs["currentNodeCount"] = state ? state.currentNodeCount : undefined;
resourceInputs["dataVolumes"] = state ? state.dataVolumes : undefined;
resourceInputs["ecsGroupId"] = state ? state.ecsGroupId : undefined;
resourceInputs["enableForceNew"] = state ? state.enableForceNew : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["extendParam"] = state ? state.extendParam : undefined;
resourceInputs["extendParams"] = state ? state.extendParams : undefined;
resourceInputs["extensionScaleGroups"] = state ? state.extensionScaleGroups : undefined;
resourceInputs["flavorId"] = state ? state.flavorId : undefined;
resourceInputs["hostnameConfig"] = state ? state.hostnameConfig : undefined;
resourceInputs["initialNodeCount"] = state ? state.initialNodeCount : undefined;
resourceInputs["initializedConditions"] = state ? state.initializedConditions : undefined;
resourceInputs["keyPair"] = state ? state.keyPair : undefined;
resourceInputs["labelPolicyOnExistingNodes"] = state ? state.labelPolicyOnExistingNodes : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["maxNodeCount"] = state ? state.maxNodeCount : undefined;
resourceInputs["maxPods"] = state ? state.maxPods : undefined;
resourceInputs["minNodeCount"] = state ? state.minNodeCount : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["os"] = state ? state.os : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["podSecurityGroups"] = state ? state.podSecurityGroups : undefined;
resourceInputs["postinstall"] = state ? state.postinstall : undefined;
resourceInputs["preinstall"] = state ? state.preinstall : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["rootVolume"] = state ? state.rootVolume : undefined;
resourceInputs["runtime"] = state ? state.runtime : undefined;
resourceInputs["scaleDownCooldownTime"] = state ? state.scaleDownCooldownTime : undefined;
resourceInputs["scallEnable"] = state ? state.scallEnable : undefined;
resourceInputs["securityGroups"] = state ? state.securityGroups : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["storage"] = state ? state.storage : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["subnetLists"] = state ? state.subnetLists : undefined;
resourceInputs["tagPolicyOnExistingNodes"] = state ? state.tagPolicyOnExistingNodes : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["taintPolicyOnExistingNodes"] = state ? state.taintPolicyOnExistingNodes : undefined;
resourceInputs["taints"] = state ? state.taints : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
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.initialNodeCount === undefined) && !opts.urn) {
throw new Error("Missing required property 'initialNodeCount'");
}
if ((!args || args.rootVolume === undefined) && !opts.urn) {
throw new Error("Missing required property 'rootVolume'");
}
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["clusterId"] = args ? args.clusterId : undefined;
resourceInputs["dataVolumes"] = args ? args.dataVolumes : undefined;
resourceInputs["ecsGroupId"] = args ? args.ecsGroupId : undefined;
resourceInputs["enableForceNew"] = args ? args.enableForceNew : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["extendParam"] = args ? args.extendParam : undefined;
resourceInputs["extendParams"] = args ? args.extendParams : undefined;
resourceInputs["extensionScaleGroups"] = args ? args.extensionScaleGroups : undefined;
resourceInputs["flavorId"] = args ? args.flavorId : undefined;
resourceInputs["hostnameConfig"] = args ? args.hostnameConfig : undefined;
resourceInputs["initialNodeCount"] = args ? args.initialNodeCount : undefined;
resourceInputs["initializedConditions"] = args ? args.initializedConditions : undefined;
resourceInputs["keyPair"] = args ? args.keyPair : undefined;
resourceInputs["labelPolicyOnExistingNodes"] = args ? args.labelPolicyOnExistingNodes : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["maxNodeCount"] = args ? args.maxNodeCount : undefined;
resourceInputs["maxPods"] = args ? args.maxPods : undefined;
resourceInputs["minNodeCount"] = args ? args.minNodeCount : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["os"] = args ? args.os : undefined;
resourceInputs["password"] = args ? args.password : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["podSecurityGroups"] = args ? args.podSecurityGroups : undefined;
resourceInputs["postinstall"] = args ? args.postinstall : undefined;
resourceInputs["preinstall"] = args ? args.preinstall : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["rootVolume"] = args ? args.rootVolume : undefined;
resourceInputs["runtime"] = args ? args.runtime : undefined;
resourceInputs["scaleDownCooldownTime"] = args ? args.scaleDownCooldownTime : undefined;
resourceInputs["scallEnable"] = args ? args.scallEnable : undefined;
resourceInputs["securityGroups"] = args ? args.securityGroups : undefined;
resourceInputs["storage"] = args ? args.storage : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["subnetLists"] = args ? args.subnetLists : undefined;
resourceInputs["tagPolicyOnExistingNodes"] = args ? args.tagPolicyOnExistingNodes : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["taintPolicyOnExistingNodes"] = args ? args.taintPolicyOnExistingNodes : undefined;
resourceInputs["taints"] = args ? args.taints : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["billingMode"] = undefined /*out*/;
resourceInputs["currentNodeCount"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NodePool.__pulumiType, name, resourceInputs, opts);
}
}
exports.NodePool = NodePool;
/** @internal */
NodePool.__pulumiType = 'huaweicloud:Cce/nodePool:NodePool';
//# sourceMappingURL=nodePool.js.map