Skip to content

fix(tke): [123456789] tencentcloud_kubernetes_cluster support set instance_delete_mode #2949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2949.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_cluster: support set `instance_delete_mode`
```
10 changes: 10 additions & 0 deletions tencentcloud/services/tke/resource_tc_kubernetes_cluster.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions tencentcloud/services/tke/resource_tc_kubernetes_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Provide a resource to create a kubernetes cluster.
~> **NOTE:** We recommend this usage that uses the `tencentcloud_kubernetes_cluster` resource to create a cluster without any `worker_config`, then adds nodes by the `tencentcloud_kubernetes_node_pool` resource.
It's more flexible than managing worker config directly with `tencentcloud_kubernetes_cluster`, `tencentcloud_kubernetes_scale_worker`, or existing node management of `tencentcloud_kubernetes_attachment`. The reason is that `worker_config` is unchangeable and may cause the whole cluster resource to `ForceNew`.

~> **NOTE:** Executing `terraform destroy` to destroy the resource will default to deleting the node resource, If it is necessary to preserve node instance resources, Please set `instance_delete_mode` to `retain`.

Example Usage

Create a basic cluster with two worker nodes
Expand Down Expand Up @@ -397,7 +399,6 @@ resource "tencentcloud_kubernetes_cluster_endpoint" "example" {
tencentcloud_kubernetes_node_pool.example
]
}

````

Use Kubelet
Expand Down Expand Up @@ -699,6 +700,7 @@ resource "tencentcloud_kubernetes_cluster" "test_node_pool_global_config" {
```

Using VPC-CNI network type

```hcl
variable "availability_zone" {
default = "ap-guangzhou-1"
Expand Down Expand Up @@ -756,6 +758,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
```

Using ops options

```
resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
# ...your basic fields
Expand Down Expand Up @@ -868,5 +871,5 @@ Import
tke cluster can be imported, e.g.

```
$ terraform import tencentcloud_kubernetes_cluster.test cls-xxx
$ terraform import tencentcloud_kubernetes_cluster.example cls-n2h4jbtk
```
5 changes: 4 additions & 1 deletion website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Provide a resource to create a kubernetes cluster.
~> **NOTE:** We recommend this usage that uses the `tencentcloud_kubernetes_cluster` resource to create a cluster without any `worker_config`, then adds nodes by the `tencentcloud_kubernetes_node_pool` resource.
It's more flexible than managing worker config directly with `tencentcloud_kubernetes_cluster`, `tencentcloud_kubernetes_scale_worker`, or existing node management of `tencentcloud_kubernetes_attachment`. The reason is that `worker_config` is unchangeable and may cause the whole cluster resource to `ForceNew`.

~> **NOTE:** Executing `terraform destroy` to destroy the resource will default to deleting the node resource, If it is necessary to preserve node instance resources, Please set `instance_delete_mode` to `retain`.

## Example Usage

### Create a basic cluster with two worker nodes
Expand Down Expand Up @@ -917,6 +919,7 @@ The following arguments are supported:
* `globe_desired_pod_num` - (Optional, Int, ForceNew) Indicate to set desired pod number in node. valid when enable_customized_pod_cidr=true, and it takes effect for all nodes.
* `ignore_cluster_cidr_conflict` - (Optional, Bool, ForceNew) Indicates whether to ignore the cluster cidr conflict error. Default is false.
* `ignore_service_cidr_conflict` - (Optional, Bool, ForceNew) Indicates whether to ignore the service cidr conflict error. Only valid in `VPC-CNI` mode.
* `instance_delete_mode` - (Optional, String) The strategy for deleting cluster instances: terminate (destroy instances, only support pay as you go cloud host instances) retain (remove only, keep instances), Default is terminate.
* `is_non_static_ip_mode` - (Optional, Bool, ForceNew) Indicates whether non-static ip mode is enabled. Default is false.
* `kube_proxy_mode` - (Optional, String) Cluster kube-proxy mode, the available values include: 'kube-proxy-bpf'. Default is not set.When set to kube-proxy-bpf, cluster version greater than 1.14 and with Tencent Linux 2.4 is required.
* `labels` - (Optional, Map, ForceNew) Labels of tke cluster nodes.
Expand Down Expand Up @@ -1116,6 +1119,6 @@ In addition to all arguments above, the following attributes are exported:
tke cluster can be imported, e.g.

```
$ terraform import tencentcloud_kubernetes_cluster.test cls-xxx
$ terraform import tencentcloud_kubernetes_cluster.example cls-n2h4jbtk
```

Loading