Skip to content

feat(tke): [120409794] support cluster_os field to update and adjust its set logic #2918

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 4 commits into from
Nov 1, 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/2918.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_cluster: support `cluster_os` field to update and adjust its set logic
```
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1027
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1031
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1014
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
Expand Down Expand Up @@ -91,7 +91,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.955
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.578
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.1013
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1027
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1031
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/trocket v1.0.947
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tse v1.0.857
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tsf v1.0.674
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,10 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1025 h1:VBC
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1025/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1027 h1:4/chUqYM26idp2Rd3pPmsL94RTAwIM5dGXoaskOQ+cM=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1027/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1030 h1:kwiUoCkooUgy7iPyhEEbio7WT21kGJUeZ5JeJfb/dYk=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1030/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1031 h1:3ouglYKE5cwhx2vwICGeW7pAlwyCLnpQd7O0l3hCSTg=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1031/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
Expand Down Expand Up @@ -1051,6 +1055,10 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1025 h1:KQTBLt
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1025/go.mod h1:WBsBVG3Qb9bupdElk/d/S7xLadGwyBvKF2VikkezhjE=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1027 h1:CCbjHzYueJMa6O3aH2zn/Uppp+u7YJSd7oTrtypxGhM=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1027/go.mod h1:U0WwaLeMZf4Qx1SGG6TlFBhwlV03BMF5F176G14W9Qc=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1030 h1:/PpJ0QVuKHaZ3khR17DktATXccHT8761D9bTZwPmrHY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1030/go.mod h1:h9iblPtLWJRVlVyFFwYM+3V54B3i1JZq6yxmSVnY49c=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1031 h1:0Ew48YnVO+Sd2U3VrWgV36uRySTF7uOOFJH0Hd4ufhg=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1031/go.mod h1:KcKTYEXZil0FciUtQ75svPL4hZpLYVnemAeW27N3OKY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/trocket v1.0.947 h1:iZfuU8S86kfqFsAVT/LUApP8L5cpT90hl2wSKiUDVvw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/trocket v1.0.947/go.mod h1:eAgJ+XUEhffMq79zjpgHoR3PBVcciSg+LuPDC8hLWsE=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tse v1.0.857 h1:TkJnvSeRSXsRCwOwcwXSvruSK9s/kw8LC3FLeccw+A0=
Expand Down
34 changes: 33 additions & 1 deletion 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.

Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ func resourceTencentCloudKubernetesClusterReadPostHandleResponse0(ctx context.Co
newOs = oldOs
}
_ = d.Set("cluster_os", newOs)
// When ImageId is not empty, cluster_os is ImageId. When ImageId is empty, cluster_os displays ClusterOs
if cluster.ImageId != nil && *cluster.ImageId != "" {
_ = d.Set("cluster_os", *cluster.ImageId)
}

_ = d.Set("tags", clusterInfo.Tags)

_ = d.Set("vpc_cni_type", clusterInfo.VpcCniType)
Expand Down Expand Up @@ -1567,16 +1572,16 @@ func clusterCidrValidateFunc(v interface{}, k string) (ws []string, errs []error
errs = append(errs, fmt.Errorf("%q must be a network segment", k))
return
}
if !strings.HasPrefix(value, "9.") && !strings.HasPrefix(value, "10.") && !strings.HasPrefix(value, "192.168.") && !strings.HasPrefix(value, "172.") {
errs = append(errs, fmt.Errorf("%q must in 9. | 10. | 192.168. | 172.[16-31]", k))
if !strings.HasPrefix(value, "9.") && !strings.HasPrefix(value, "10.") && !strings.HasPrefix(value, "11.") && !strings.HasPrefix(value, "192.168.") && !strings.HasPrefix(value, "172.") {
errs = append(errs, fmt.Errorf("%q must in 9. | 10. | 11. | 192.168. | 172.[16-31]", k))
return
}

if strings.HasPrefix(value, "172.") {
nextNo := strings.Split(value, ".")[1]
no, _ := strconv.ParseInt(nextNo, 10, 64)
if no < 16 || no > 31 {
errs = append(errs, fmt.Errorf("%q must in 9.0 | 10. | 192.168. | 172.[16-31]", k))
errs = append(errs, fmt.Errorf("%q must in 9.0 | 10. | 11. | 192.168. | 172.[16-31]", k))
return
}
}
Expand Down

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

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

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

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
## explicit; go 1.14
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1027
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1031
## explicit; go 1.11
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors
Expand Down Expand Up @@ -1321,7 +1321,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998
## explicit; go 1.14
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc/v20230321
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1027
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1031
## explicit; go 1.14
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20220501
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ The following arguments are supported:
* `cluster_max_service_num` - (Optional, Int, ForceNew) The maximum number of services in the cluster. Default is 256. The range is from 32 to 32768. When its power unequal to 2, it will round upward to the closest power of 2.
* `cluster_name` - (Optional, String) Name of the cluster.
* `cluster_os_type` - (Optional, String, ForceNew) Image type of the cluster os, the available values include: 'GENERAL'. Default is 'GENERAL'.
* `cluster_os` - (Optional, String, ForceNew) Cluster operating system, supports setting public images (the field passes the corresponding image Name) and custom images (the field passes the corresponding image ID). For details, please refer to: https://cloud.tencent.com/document/product/457/68289.
* `cluster_os` - (Optional, String) Cluster operating system, supports setting public images (the field passes the corresponding image Name) and custom images (the field passes the corresponding image ID). For details, please refer to: https://cloud.tencent.com/document/product/457/68289.
* `cluster_subnet_id` - (Optional, String, ForceNew) Subnet ID of the cluster, such as: subnet-b3p7d7q5.
* `cluster_version` - (Optional, String) Version of the cluster. Use `tencentcloud_kubernetes_available_cluster_versions` to get the upgradable cluster version.
* `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.Default is 'docker'.
Expand Down
Loading