UNPKG

@volcengine/pulumi

Version:

A Pulumi package for creating and managing volcengine cloud resources.

393 lines (392 loc) 13.7 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Provides a resource to manage vke cluster * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as volcengine from "@pulumi/volcengine"; * import * as volcengine from "@volcengine/pulumi"; * * const fooZones = volcengine.ecs.getZones({}); * // create vpc * const fooVpc = new volcengine.vpc.Vpc("fooVpc", { * vpcName: "acc-test-vpc", * cidrBlock: "172.16.0.0/16", * }); * // create subnet * const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", { * subnetName: "acc-test-subnet", * cidrBlock: "172.16.0.0/24", * zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id), * vpcId: fooVpc.id, * }); * // create security group * const fooSecurityGroup = new volcengine.vpc.SecurityGroup("fooSecurityGroup", { * securityGroupName: "acc-test-security-group", * vpcId: fooVpc.id, * }); * // create vke cluster * const fooCluster = new volcengine.vke.Cluster("fooCluster", { * description: "created by terraform", * projectName: "default", * deleteProtectionEnabled: false, * irsaEnabled: false, * clusterConfig: { * subnetIds: [fooSubnet.id], * apiServerPublicAccessEnabled: true, * apiServerPublicAccessConfig: { * publicAccessNetworkConfig: { * billingType: "PostPaidByBandwidth", * bandwidth: 1, * }, * }, * resourcePublicAccessDefaultEnabled: true, * }, * podsConfig: { * podNetworkMode: "VpcCniShared", * vpcCniConfig: { * subnetIds: [fooSubnet.id], * }, * }, * servicesConfig: { * serviceCidrsv4s: ["172.30.0.0/18"], * }, * loggingConfig: { * logSetups: [ * { * logType: "ClusterAutoscaler", * enabled: true, * logTtl: 60, * }, * { * logType: "Etcd", * enabled: false, * logTtl: 60, * }, * ], * }, * tags: [{ * key: "tf-k1", * value: "tf-v1", * }], * }); * const fooImages = volcengine.ecs.getImages({ * nameRegex: "veLinux 1.0 CentOS Compatible 64 bit", * }); * // create vke node pool * const fooNodePool = new volcengine.vke.NodePool("fooNodePool", { * clusterId: fooCluster.id, * management: { * enabled: false, * }, * autoScaling: { * enabled: true, * minReplicas: 0, * maxReplicas: 5, * desiredReplicas: 0, * priority: 5, * subnetPolicy: "ZoneBalance", * }, * nodeConfig: { * instanceTypeIds: ["ecs.g1ie.xlarge"], * subnetIds: [fooSubnet.id], * imageId: fooImages.then(fooImages => .filter(image => image.imageName == "veLinux 1.0 CentOS Compatible 64 bit").map(image => (image.imageId))[0]), * systemVolume: { * type: "ESSD_PL0", * size: 80, * }, * dataVolumes: [ * { * type: "ESSD_PL0", * size: 80, * mountPoint: "/tf1", * }, * { * type: "ESSD_PL0", * size: 60, * mountPoint: "/tf2", * }, * ], * initializeScript: "ZWNobyBoZWxsbyB0ZXJyYWZvcm0h", * security: { * login: { * password: "UHdkMTIzNDU2", * }, * securityStrategies: ["Hids"], * securityGroupIds: [fooSecurityGroup.id], * }, * additionalContainerStorageEnabled: false, * instanceChargeType: "PostPaid", * namePrefix: "acc-test", * projectName: "default", * ecsTags: [{ * key: "ecs_k1", * value: "ecs_v1", * }], * }, * kubernetesConfig: { * labels: [{ * key: "label1", * value: "value1", * }], * taints: [{ * key: "taint-key/node-type", * value: "taint-value", * effect: "NoSchedule", * }], * cordon: true, * autoSyncDisabled: false, * }, * tags: [{ * key: "node-pool-k1", * value: "node-pool-v1", * }], * }); * // create ecs instance * const fooInstance = new volcengine.ecs.Instance("fooInstance", { * instanceName: "acc-test-ecs", * hostName: "tf-acc-test", * imageId: fooImages.then(fooImages => .filter(image => image.imageName == "veLinux 1.0 CentOS Compatible 64 bit").map(image => (image.imageId))[0]), * instanceType: "ecs.g1ie.xlarge", * password: "93f0cb0614Aab12", * instanceChargeType: "PostPaid", * systemVolumeType: "ESSD_PL0", * systemVolumeSize: 50, * subnetId: fooSubnet.id, * securityGroupIds: [fooSecurityGroup.id], * projectName: "default", * tags: [{ * key: "k1", * value: "v1", * }], * }); * // add the ecs instance to the vke node pool * const fooNode = new volcengine.vke.Node("fooNode", { * clusterId: fooCluster.id, * instanceId: fooInstance.id, * nodePoolId: fooNodePool.id, * }); * ``` * * ## Import * * VkeCluster can be imported using the id, e.g. * * ```sh * $ pulumi import volcengine:vke/cluster:Cluster default cc9l74mvqtofjnoj5**** * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: ClusterState, opts?: pulumi.CustomResourceOptions): Cluster; /** * 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: any): obj is Cluster; /** * ClientToken is a case-sensitive string of no more than 64 ASCII characters passed in by the caller. */ readonly clientToken: pulumi.Output<string | undefined>; /** * The config of the cluster. */ readonly clusterConfig: pulumi.Output<outputs.vke.ClusterClusterConfig>; /** * The delete protection of the cluster, the value is `true` or `false`. */ readonly deleteProtectionEnabled: pulumi.Output<boolean | undefined>; /** * The description of the cluster. */ readonly description: pulumi.Output<string | undefined>; /** * Eip allocation Id. */ readonly eipAllocationId: pulumi.Output<string>; /** * The IRSA configuration. */ readonly irsaConfigs: pulumi.Output<outputs.vke.ClusterIrsaConfig[]>; /** * Whether to enable IRSA for the cluster. This field is valid only when modifying the cluster. */ readonly irsaEnabled: pulumi.Output<boolean | undefined>; /** * Kubeconfig data with private network access, returned in BASE64 encoding, it is suggested to use vkeKubeconfig instead. */ readonly kubeconfigPrivate: pulumi.Output<string>; /** * Kubeconfig data with public network access, returned in BASE64 encoding, it is suggested to use vkeKubeconfig instead. */ readonly kubeconfigPublic: pulumi.Output<string>; /** * The version of Kubernetes specified when creating a VKE cluster (specified to patch version), with an example value of `1.24`. If not specified, the latest Kubernetes version supported by VKE is used by default, which is a 3-segment version format starting with a lowercase v, that is, KubernetesVersion with IsLatestVersion=True in the return value of ListSupportedVersions. */ readonly kubernetesVersion: pulumi.Output<string>; /** * Cluster log configuration information. */ readonly loggingConfig: pulumi.Output<outputs.vke.ClusterLoggingConfig | undefined>; /** * The name of the cluster. */ readonly name: pulumi.Output<string>; /** * The config of the pods. */ readonly podsConfig: pulumi.Output<outputs.vke.ClusterPodsConfig>; /** * The project name of the cluster. */ readonly projectName: pulumi.Output<string>; /** * The config of the services. */ readonly servicesConfig: pulumi.Output<outputs.vke.ClusterServicesConfig>; /** * Tags. */ readonly tags: pulumi.Output<outputs.vke.ClusterTag[] | undefined>; /** * Create a Cluster resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ClusterArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Cluster resources. */ export interface ClusterState { /** * ClientToken is a case-sensitive string of no more than 64 ASCII characters passed in by the caller. */ clientToken?: pulumi.Input<string>; /** * The config of the cluster. */ clusterConfig?: pulumi.Input<inputs.vke.ClusterClusterConfig>; /** * The delete protection of the cluster, the value is `true` or `false`. */ deleteProtectionEnabled?: pulumi.Input<boolean>; /** * The description of the cluster. */ description?: pulumi.Input<string>; /** * Eip allocation Id. */ eipAllocationId?: pulumi.Input<string>; /** * The IRSA configuration. */ irsaConfigs?: pulumi.Input<pulumi.Input<inputs.vke.ClusterIrsaConfig>[]>; /** * Whether to enable IRSA for the cluster. This field is valid only when modifying the cluster. */ irsaEnabled?: pulumi.Input<boolean>; /** * Kubeconfig data with private network access, returned in BASE64 encoding, it is suggested to use vkeKubeconfig instead. */ kubeconfigPrivate?: pulumi.Input<string>; /** * Kubeconfig data with public network access, returned in BASE64 encoding, it is suggested to use vkeKubeconfig instead. */ kubeconfigPublic?: pulumi.Input<string>; /** * The version of Kubernetes specified when creating a VKE cluster (specified to patch version), with an example value of `1.24`. If not specified, the latest Kubernetes version supported by VKE is used by default, which is a 3-segment version format starting with a lowercase v, that is, KubernetesVersion with IsLatestVersion=True in the return value of ListSupportedVersions. */ kubernetesVersion?: pulumi.Input<string>; /** * Cluster log configuration information. */ loggingConfig?: pulumi.Input<inputs.vke.ClusterLoggingConfig>; /** * The name of the cluster. */ name?: pulumi.Input<string>; /** * The config of the pods. */ podsConfig?: pulumi.Input<inputs.vke.ClusterPodsConfig>; /** * The project name of the cluster. */ projectName?: pulumi.Input<string>; /** * The config of the services. */ servicesConfig?: pulumi.Input<inputs.vke.ClusterServicesConfig>; /** * Tags. */ tags?: pulumi.Input<pulumi.Input<inputs.vke.ClusterTag>[]>; } /** * The set of arguments for constructing a Cluster resource. */ export interface ClusterArgs { /** * ClientToken is a case-sensitive string of no more than 64 ASCII characters passed in by the caller. */ clientToken?: pulumi.Input<string>; /** * The config of the cluster. */ clusterConfig: pulumi.Input<inputs.vke.ClusterClusterConfig>; /** * The delete protection of the cluster, the value is `true` or `false`. */ deleteProtectionEnabled?: pulumi.Input<boolean>; /** * The description of the cluster. */ description?: pulumi.Input<string>; /** * Whether to enable IRSA for the cluster. This field is valid only when modifying the cluster. */ irsaEnabled?: pulumi.Input<boolean>; /** * The version of Kubernetes specified when creating a VKE cluster (specified to patch version), with an example value of `1.24`. If not specified, the latest Kubernetes version supported by VKE is used by default, which is a 3-segment version format starting with a lowercase v, that is, KubernetesVersion with IsLatestVersion=True in the return value of ListSupportedVersions. */ kubernetesVersion?: pulumi.Input<string>; /** * Cluster log configuration information. */ loggingConfig?: pulumi.Input<inputs.vke.ClusterLoggingConfig>; /** * The name of the cluster. */ name?: pulumi.Input<string>; /** * The config of the pods. */ podsConfig: pulumi.Input<inputs.vke.ClusterPodsConfig>; /** * The project name of the cluster. */ projectName?: pulumi.Input<string>; /** * The config of the services. */ servicesConfig: pulumi.Input<inputs.vke.ClusterServicesConfig>; /** * Tags. */ tags?: pulumi.Input<pulumi.Input<inputs.vke.ClusterTag>[]>; }