Skip to content

Commit b88f6bc

Browse files
authored
Merge pull request #545 from gailwang/master
fix kubernetes bug
2 parents 86b2633 + 78d1ea5 commit b88f6bc

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
## 1.46.4 (Unreleased)
2+
3+
BUG FIXES:
4+
* Resource: `tencentcloud_kubernetes_cluster` fix force replacement when updating `docker_graph_path`.
5+
26
## 1.46.3 (November 6, 2020)
37

48
ENHANCEMENTS:

tencentcloud/extension_tke.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const (
66
TKE_CLUSTER_OS_UBUNTU16 = "ubuntu16.04.1 LTSx86_64"
77
TKE_CLUSTER_OS_UBUNTU18 = "ubuntu18.04.1 LTSx86_64"
88
TKE_CLUSTER_OS_LINUX24 = "tlinux2.4x86_64"
9+
TKE_CLUSTER_OS_LINUX22 = "tlinux2.2(tkernel3)x86_64"
10+
TKE_CLUSTER_OS_LINUXF22 = "Tencent tlinux release 2.2 (Final)"
911
)
1012

1113
var TKE_CLUSTER_OS = []string{TKE_CLUSTER_OS_CENTOS72, TKE_CLUSTER_OS_CENTOS76, TKE_CLUSTER_OS_UBUNTU16, TKE_CLUSTER_OS_UBUNTU18, TKE_CLUSTER_OS_LINUX24}
@@ -15,6 +17,8 @@ var tkeClusterOsMap = map[string]string{TKE_CLUSTER_OS_CENTOS72: TKE_CLUSTER_OS_
1517
TKE_CLUSTER_OS_UBUNTU16: TKE_CLUSTER_OS_UBUNTU16,
1618
TKE_CLUSTER_OS_UBUNTU18: "ubuntu18.04.1x86_64",
1719
TKE_CLUSTER_OS_LINUX24: "tlinux2.4x86_64",
20+
TKE_CLUSTER_OS_LINUX22: TKE_CLUSTER_OS_LINUX22,
21+
TKE_CLUSTER_OS_LINUXF22: TKE_CLUSTER_OS_LINUXF22,
1822
}
1923

2024
func tkeToShowClusterOs(apiOs string) string {
@@ -23,7 +27,7 @@ func tkeToShowClusterOs(apiOs string) string {
2327
return showName
2428
}
2529
}
26-
return "unknown"
30+
return apiOs
2731
}
2832

2933
const (

tencentcloud/resource_tc_kubernetes_cluster.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,17 @@ func resourceTencentCloudTkeCluster() *schema.Resource {
826826
Description: "Mount target. Default is not mounting.",
827827
},
828828
"docker_graph_path": {
829-
Type: schema.TypeString,
830-
Optional: true,
831-
ForceNew: true,
832-
Default: "/var/lib/docker",
829+
Type: schema.TypeString,
830+
Optional: true,
831+
ForceNew: true,
832+
Default: "/var/lib/docker",
833+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
834+
if new == "/var/lib/docker" && old == "" || old == "/var/lib/docker" && new == "" {
835+
return true
836+
} else {
837+
return old == new
838+
}
839+
},
833840
Description: "Docker graph path. Default is `/var/lib/docker`.",
834841
},
835842
"extra_args": {
@@ -1116,10 +1123,10 @@ func resourceTencentCloudTkeClusterCreate(d *schema.ResourceData, meta interface
11161123

11171124
cluster_os := d.Get("cluster_os").(string)
11181125

1119-
if tkeClusterOsMap[cluster_os] == "" {
1120-
basic.ClusterOs = cluster_os
1126+
if v, ok := tkeClusterOsMap[cluster_os]; ok {
1127+
basic.ClusterOs = v
11211128
} else {
1122-
basic.ClusterOs = tkeClusterOsMap[cluster_os]
1129+
basic.ClusterOs = cluster_os
11231130
}
11241131
basic.ClusterOsType = d.Get("cluster_os_type").(string)
11251132

0 commit comments

Comments
 (0)