Skip to content

Commit 6dc0c5f

Browse files
authored
fix(tke): [128235859] tencentcloud_kubernetes_cluster support disable_addons (#3576)
* add * add * add
1 parent 1e9c9e0 commit 6dc0c5f

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

.changelog/3576.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_kubernetes_cluster: support `disable_addons`
3+
```

tencentcloud/services/tke/resource_tc_kubernetes_cluster.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,15 @@ func ResourceTencentCloudKubernetesCluster() *schema.Resource {
15611561
Optional: true,
15621562
Description: "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.",
15631563
},
1564+
1565+
"disable_addons": {
1566+
Type: schema.TypeList,
1567+
Optional: true,
1568+
Description: "To prevent the installation of a specific Addon component, enter the corresponding AddonName.",
1569+
Elem: &schema.Schema{
1570+
Type: schema.TypeString,
1571+
},
1572+
},
15641573
},
15651574
}
15661575
}
@@ -1731,6 +1740,14 @@ func resourceTencentCloudKubernetesClusterCreate(d *schema.ResourceData, meta in
17311740
}
17321741
}
17331742

1743+
if v, ok := d.GetOk("disable_addons"); ok {
1744+
for _, item := range v.([]interface{}) {
1745+
if disableAddon, ok := item.(string); ok {
1746+
request.DisableAddons = append(request.DisableAddons, &disableAddon)
1747+
}
1748+
}
1749+
}
1750+
17341751
if err := resourceTencentCloudKubernetesClusterCreatePostFillRequest0(ctx, request); err != nil {
17351752
return err
17361753
}
@@ -1975,7 +1992,7 @@ func resourceTencentCloudKubernetesClusterUpdate(d *schema.ResourceData, meta in
19751992

19761993
ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta)
19771994

1978-
immutableArgs := []string{"cdc_id", "extension_addon"}
1995+
immutableArgs := []string{"cdc_id", "extension_addon", "disable_addons"}
19791996
for _, v := range immutableArgs {
19801997
if d.HasChange(v) {
19811998
return fmt.Errorf("argument `%s` cannot be changed", v)

tencentcloud/services/tke/resource_tc_kubernetes_cluster.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,28 @@ resource "tencentcloud_kubernetes_cluster" "example" {
751751
}
752752
```
753753

754+
Using disable addons
755+
756+
```hcl
757+
resource "tencentcloud_kubernetes_cluster" "example" {
758+
vpc_id = "vpc-i5yyodl9"
759+
cluster_max_pod_num = 32
760+
cluster_name = "tf-example"
761+
cluster_desc = "cluster desc."
762+
cluster_max_service_num = 256
763+
cluster_version = "1.30.0"
764+
cluster_deploy_type = "MANAGED_CLUSTER"
765+
container_runtime = "containerd"
766+
runtime_version = "1.6.9"
767+
instance_delete_mode = "terminate"
768+
upgrade_instances_follow_cluster = true
769+
network_type = "VPC-CNI"
770+
eni_subnet_ids = ["subnet-hhi88a58"]
771+
service_cidr = "10.1.0.0/24"
772+
disable_addons = ["ip-masq-agent"]
773+
}
774+
```
775+
754776
Import
755777

756778
tke cluster can be imported, e.g.

website/docs/r/kubernetes_cluster.html.markdown

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,28 @@ resource "tencentcloud_kubernetes_cluster" "example" {
762762
}
763763
```
764764

765+
### Using disable addons
766+
767+
```hcl
768+
resource "tencentcloud_kubernetes_cluster" "example" {
769+
vpc_id = "vpc-i5yyodl9"
770+
cluster_max_pod_num = 32
771+
cluster_name = "tf-example"
772+
cluster_desc = "cluster desc."
773+
cluster_max_service_num = 256
774+
cluster_version = "1.30.0"
775+
cluster_deploy_type = "MANAGED_CLUSTER"
776+
container_runtime = "containerd"
777+
runtime_version = "1.6.9"
778+
instance_delete_mode = "terminate"
779+
upgrade_instances_follow_cluster = true
780+
network_type = "VPC-CNI"
781+
eni_subnet_ids = ["subnet-hhi88a58"]
782+
service_cidr = "10.1.0.0/24"
783+
disable_addons = ["ip-masq-agent"]
784+
}
785+
```
786+
765787
## Argument Reference
766788

767789
The following arguments are supported:
@@ -796,6 +818,7 @@ The following arguments are supported:
796818
* `container_runtime` - (Optional, String, ForceNew) Runtime type of the cluster, the available values include: 'docker' and 'containerd'.The Kubernetes v1.24 has removed dockershim, so please use containerd in v1.24 or higher. The default value is `docker` for versions below v1.24 and `containerd` for versions above v1.24.
797819
* `data_plane_v2` - (Optional, Bool, ForceNew) Whether to enable DataPlaneV2 (replace kube-proxy with cilium). `data_plane_v2` and `cluster_ipvs` should not be set at the same time.
798820
* `deletion_protection` - (Optional, Bool) Indicates whether cluster deletion protection is enabled. Default is false.
821+
* `disable_addons` - (Optional, List: [`String`]) To prevent the installation of a specific Addon component, enter the corresponding AddonName.
799822
* `docker_graph_path` - (Optional, String, ForceNew) Docker graph path. Default is `/var/lib/docker`.
800823
* `enable_customized_pod_cidr` - (Optional, Bool) Whether to enable the custom mode of node podCIDR size. Default is false.
801824
* `eni_subnet_ids` - (Optional, List: [`String`]) Subnet Ids for cluster with VPC-CNI network mode. This field can only set when field `network_type` is 'VPC-CNI'. `eni_subnet_ids` can not empty once be set.

0 commit comments

Comments
 (0)