Skip to content

Commit 91c8499

Browse files
committed
feat(tke): add taints para
1 parent fbe2f7b commit 91c8499

9 files changed

+159
-160
lines changed

tencentcloud/services/apigateway/data_source_tc_api_gateway_api_app_api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ func DataSourceTencentCloudApiGatewayApiAppApi() *schema.Resource {
9595
Description: "API authentication type. Possible values are SECRET (key pair authentication), NONE (authentication-free), and OAUTH.",
9696
},
9797
"api_business_type": {
98-
Type: schema.TypeString,
99-
Computed: true,
98+
Type: schema.TypeString,
99+
Computed: true,
100100
Description: "Type of OAUTH API. Possible values are NORMAL (Business API), OAUTH (Authorization API).",
101101
},
102102
"auth_relation_api_id": {

tencentcloud/services/cfs/data_source_tc_cfs_available_zone.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ func DataSourceTencentCloudCfsAvailableZone() *schema.Resource {
7171
Elem: &schema.Resource{
7272
Schema: map[string]*schema.Schema{
7373
"sale_status": {
74-
Type: schema.TypeString,
75-
Computed: true,
74+
Type: schema.TypeString,
75+
Computed: true,
7676
Description: " Sale status. Valid values: sale_out (sold out), saling (purchasable), no_saling (non-purchasable).",
7777
},
7878
"protocol": {

tencentcloud/services/cos/data_source_tc_cos_bucket_inventorys.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ func DataSourceTencentCloudCosBucketInventorys() *schema.Resource {
7878
},
7979
},
8080
"optional_fields": {
81-
Type: schema.TypeList,
82-
Optional: true,
81+
Type: schema.TypeList,
82+
Optional: true,
8383
Description: "Analysis items to include in the inventory result .",
8484
Elem: &schema.Resource{
8585
Schema: map[string]*schema.Schema{

tencentcloud/services/cos/resource_tc_cos_bucket_inventory.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ func ResourceTencentCloudCosBucketInventory() *schema.Resource {
8383
},
8484
},
8585
"optional_fields": {
86-
Type: schema.TypeList,
87-
MaxItems: 1,
88-
Optional: true,
86+
Type: schema.TypeList,
87+
MaxItems: 1,
88+
Optional: true,
8989
Description: "Analysis items to include in the inventory result .",
9090
Elem: &schema.Resource{
9191
Schema: map[string]*schema.Schema{

tencentcloud/services/monitor/data_source_tc_monitor_alarm_policy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ func DataSourceTencentCloudMonitorAlarmPolicy() *schema.Resource {
426426
Description: "Statistical period in seconds. The valid values can be queried via DescribeAlarmMetricsNote: this field may return null, indicating that no valid value is obtained.",
427427
},
428428
"operator": {
429-
Type: schema.TypeString,
430-
Computed: true,
429+
Type: schema.TypeString,
430+
Computed: true,
431431
Description: "Statistical period in seconds. The valid values can be queried via DescribeAlarmMetrics.Note: this field may return null, indicating that no valid value is obtained.Operator String No Operatorintelligent = intelligent detection without thresholdeq = equal toge = greater than or equal togt = greater thanle = less than or equal tolt = less thanne = not equal today_increase = day-on-day increaseday_decrease = day-on-day decreaseday_wave = day-on-day fluctuationweek_increase = week-on-week increaseweek_decrease = week-on-week decreaseweek_wave = week-on-week fluctuationcycle_increase = cyclical increasecycle_decrease = cyclical decreasecycle_wave = cyclical fluctuationre = regex matchThe valid values can be queried via DescribeAlarmMetrics.Note: this field may return null, indicating that no valid value is obtained.",
432432
},
433433
"value": {

tencentcloud/services/mps/data_source_tc_mps_schedules.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,16 @@ func DataSourceTencentCloudMpsSchedules() *schema.Resource {
118118
Description: "The region of the AWS S3 bucket.",
119119
},
120120
"dir": {
121-
Type: schema.TypeString,
122-
Computed: true,
121+
Type: schema.TypeString,
122+
Computed: true,
123123
Description: "The bucket directory bound. It must be an absolute path that starts and ends with `/`, such as `/movie/201907/`. If you do not specify this, the root directory will be bound. .",
124124
},
125125
"formats": {
126126
Type: schema.TypeSet,
127127
Elem: &schema.Schema{
128128
Type: schema.TypeString,
129129
},
130-
Computed: true,
130+
Computed: true,
131131
Description: "The file formats that will trigger the scheme, such as [mp4, flv, mov]. If you do not specify this, the upload of files in any format will trigger the scheme. .",
132132
},
133133
"s3_secret_id": {

tencentcloud/services/mps/resource_tc_mps_schedule.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ func ResourceTencentCloudMpsSchedule() *schema.Resource {
9292
Description: "The region of the AWS S3 bucket.",
9393
},
9494
"dir": {
95-
Type: schema.TypeString,
96-
Optional: true,
95+
Type: schema.TypeString,
96+
Optional: true,
9797
Description: "The bucket directory bound. It must be an absolute path that starts and ends with `/`, such as `/movie/201907/`. If you do not specify this, the root directory will be bound. .",
9898
},
9999
"formats": {
100100
Type: schema.TypeSet,
101101
Elem: &schema.Schema{
102102
Type: schema.TypeString,
103103
},
104-
Optional: true,
104+
Optional: true,
105105
Description: "The file formats that will trigger the scheme, such as [mp4, flv, mov]. If you do not specify this, the upload of files in any format will trigger the scheme. .",
106106
},
107107
"s3_secret_id": {

tencentcloud/services/tke/extension_tke.go

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package tke
33
import (
44
tke "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525"
55

6-
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
76
svccvm "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/cvm"
87
)
98

@@ -158,145 +157,3 @@ var tkeNativeNodePoolAnnotationsMap = map[string]string{
158157
"node.tke.cloud.tencent.com/security-agent": "node.tke.cloud.tencent.com/security-agent",
159158
"node.tke.cloud.tencent.com/security-groups-spread": "node.tke.cloud.tencent.com/security-groups-spread",
160159
}
161-
162-
func tkeGetInstanceAdvancedPara(dMap map[string]interface{}, meta interface{}) (setting tke.InstanceAdvancedSettings) {
163-
setting = tke.InstanceAdvancedSettings{}
164-
if v, ok := dMap["mount_target"]; ok {
165-
setting.MountTarget = helper.String(v.(string))
166-
}
167-
168-
if v, ok := dMap["data_disk"]; ok {
169-
dataDisks := v.([]interface{})
170-
setting.DataDisks = make([]*tke.DataDisk, len(dataDisks))
171-
for i, d := range dataDisks {
172-
value := d.(map[string]interface{})
173-
var diskType, fileSystem, mountTarget, diskPartition string
174-
if v, ok := value["disk_type"].(string); ok {
175-
diskType = v
176-
}
177-
if v, ok := value["file_system"].(string); ok {
178-
fileSystem = v
179-
}
180-
if v, ok := value["mount_target"].(string); ok {
181-
mountTarget = v
182-
}
183-
if v, ok := value["disk_partition"].(string); ok {
184-
diskPartition = v
185-
}
186-
187-
diskSize := int64(value["disk_size"].(int))
188-
autoFormatAndMount := value["auto_format_and_mount"].(bool)
189-
dataDisk := &tke.DataDisk{
190-
DiskType: &diskType,
191-
FileSystem: &fileSystem,
192-
AutoFormatAndMount: &autoFormatAndMount,
193-
MountTarget: &mountTarget,
194-
DiskPartition: &diskPartition,
195-
}
196-
if diskSize > 0 {
197-
dataDisk.DiskSize = &diskSize
198-
}
199-
setting.DataDisks[i] = dataDisk
200-
}
201-
}
202-
if v, ok := dMap["is_schedule"]; ok {
203-
setting.Unschedulable = helper.BoolToInt64Ptr(!v.(bool))
204-
}
205-
206-
if v, ok := dMap["user_data"]; ok {
207-
setting.UserScript = helper.String(v.(string))
208-
}
209-
210-
if v, ok := dMap["pre_start_user_script"]; ok {
211-
setting.PreStartUserScript = helper.String(v.(string))
212-
}
213-
214-
if v, ok := dMap["taints"]; ok {
215-
taints := v.([]interface{})
216-
setting.Taints = make([]*tke.Taint, len(taints))
217-
for i, d := range taints {
218-
taint := d.(map[string]interface{})
219-
var value, key, effect string
220-
if v, ok := taint["key"].(string); ok {
221-
key = v
222-
}
223-
if v, ok := taint["value"].(string); ok {
224-
value = v
225-
}
226-
if v, ok := taint["effect"].(string); ok {
227-
effect = v
228-
}
229-
taintItem := &tke.Taint{
230-
Key: &key,
231-
Value: &value,
232-
Effect: &effect,
233-
}
234-
setting.Taints[i] = taintItem
235-
}
236-
}
237-
238-
if v, ok := dMap["docker_graph_path"]; ok {
239-
setting.DockerGraphPath = helper.String(v.(string))
240-
}
241-
242-
if v, ok := dMap["desired_pod_num"]; ok {
243-
setting.DesiredPodNumber = helper.Int64(int64(v.(int)))
244-
}
245-
246-
if temp, ok := dMap["extra_args"]; ok {
247-
extraArgs := helper.InterfacesStrings(temp.([]interface{}))
248-
clusterExtraArgs := tke.InstanceExtraArgs{}
249-
clusterExtraArgs.Kubelet = make([]*string, 0)
250-
for i := range extraArgs {
251-
clusterExtraArgs.Kubelet = append(clusterExtraArgs.Kubelet, &extraArgs[i])
252-
}
253-
setting.ExtraArgs = &clusterExtraArgs
254-
}
255-
256-
// get gpu_args
257-
if v, ok := dMap["gpu_args"]; ok && len(v.([]interface{})) > 0 {
258-
gpuArgs := v.([]interface{})[0].(map[string]interface{})
259-
260-
var (
261-
migEnable = gpuArgs["mig_enable"].(bool)
262-
driver = gpuArgs["driver"].(map[string]interface{})
263-
cuda = gpuArgs["cuda"].(map[string]interface{})
264-
cudnn = gpuArgs["cudnn"].(map[string]interface{})
265-
customDriver = gpuArgs["custom_driver"].(map[string]interface{})
266-
)
267-
tkeGpuArgs := tke.GPUArgs{}
268-
tkeGpuArgs.MIGEnable = &migEnable
269-
if len(driver) > 0 {
270-
tkeGpuArgs.Driver = &tke.DriverVersion{
271-
Version: helper.String(driver["version"].(string)),
272-
Name: helper.String(driver["name"].(string)),
273-
}
274-
}
275-
if len(cuda) > 0 {
276-
tkeGpuArgs.CUDA = &tke.DriverVersion{
277-
Version: helper.String(cuda["version"].(string)),
278-
Name: helper.String(cuda["name"].(string)),
279-
}
280-
}
281-
if len(cudnn) > 0 {
282-
tkeGpuArgs.CUDNN = &tke.CUDNN{
283-
Version: helper.String(cudnn["version"].(string)),
284-
Name: helper.String(cudnn["name"].(string)),
285-
}
286-
if cudnn["doc_name"] != nil {
287-
tkeGpuArgs.CUDNN.DocName = helper.String(cudnn["doc_name"].(string))
288-
}
289-
if cudnn["dev_name"] != nil {
290-
tkeGpuArgs.CUDNN.DevName = helper.String(cudnn["dev_name"].(string))
291-
}
292-
}
293-
if len(customDriver) > 0 {
294-
tkeGpuArgs.CustomDriver = &tke.CustomDriver{
295-
Address: helper.String(customDriver["address"].(string)),
296-
}
297-
}
298-
setting.GPUArgs = &tkeGpuArgs
299-
}
300-
301-
return setting
302-
}

tencentcloud/services/tke/resource_tc_kubernetes_cluster_attachment.go

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,3 +732,145 @@ func resourceTencentCloudKubernetesClusterAttachmentDelete(d *schema.ResourceDat
732732
_ = response
733733
return nil
734734
}
735+
736+
func tkeGetInstanceAdvancedPara(dMap map[string]interface{}, meta interface{}) (setting tke.InstanceAdvancedSettings) {
737+
setting = tke.InstanceAdvancedSettings{}
738+
if v, ok := dMap["mount_target"]; ok {
739+
setting.MountTarget = helper.String(v.(string))
740+
}
741+
742+
if v, ok := dMap["data_disk"]; ok {
743+
dataDisks := v.([]interface{})
744+
setting.DataDisks = make([]*tke.DataDisk, len(dataDisks))
745+
for i, d := range dataDisks {
746+
value := d.(map[string]interface{})
747+
var diskType, fileSystem, mountTarget, diskPartition string
748+
if v, ok := value["disk_type"].(string); ok {
749+
diskType = v
750+
}
751+
if v, ok := value["file_system"].(string); ok {
752+
fileSystem = v
753+
}
754+
if v, ok := value["mount_target"].(string); ok {
755+
mountTarget = v
756+
}
757+
if v, ok := value["disk_partition"].(string); ok {
758+
diskPartition = v
759+
}
760+
761+
diskSize := int64(value["disk_size"].(int))
762+
autoFormatAndMount := value["auto_format_and_mount"].(bool)
763+
dataDisk := &tke.DataDisk{
764+
DiskType: &diskType,
765+
FileSystem: &fileSystem,
766+
AutoFormatAndMount: &autoFormatAndMount,
767+
MountTarget: &mountTarget,
768+
DiskPartition: &diskPartition,
769+
}
770+
if diskSize > 0 {
771+
dataDisk.DiskSize = &diskSize
772+
}
773+
setting.DataDisks[i] = dataDisk
774+
}
775+
}
776+
if v, ok := dMap["is_schedule"]; ok {
777+
setting.Unschedulable = helper.BoolToInt64Ptr(!v.(bool))
778+
}
779+
780+
if v, ok := dMap["user_data"]; ok {
781+
setting.UserScript = helper.String(v.(string))
782+
}
783+
784+
if v, ok := dMap["pre_start_user_script"]; ok {
785+
setting.PreStartUserScript = helper.String(v.(string))
786+
}
787+
788+
if v, ok := dMap["taints"]; ok {
789+
taints := v.([]interface{})
790+
setting.Taints = make([]*tke.Taint, len(taints))
791+
for i, d := range taints {
792+
taint := d.(map[string]interface{})
793+
var value, key, effect string
794+
if v, ok := taint["key"].(string); ok {
795+
key = v
796+
}
797+
if v, ok := taint["value"].(string); ok {
798+
value = v
799+
}
800+
if v, ok := taint["effect"].(string); ok {
801+
effect = v
802+
}
803+
taintItem := &tke.Taint{
804+
Key: &key,
805+
Value: &value,
806+
Effect: &effect,
807+
}
808+
setting.Taints[i] = taintItem
809+
}
810+
}
811+
812+
if v, ok := dMap["docker_graph_path"]; ok {
813+
setting.DockerGraphPath = helper.String(v.(string))
814+
}
815+
816+
if v, ok := dMap["desired_pod_num"]; ok {
817+
setting.DesiredPodNumber = helper.Int64(int64(v.(int)))
818+
}
819+
820+
if temp, ok := dMap["extra_args"]; ok {
821+
extraArgs := helper.InterfacesStrings(temp.([]interface{}))
822+
clusterExtraArgs := tke.InstanceExtraArgs{}
823+
clusterExtraArgs.Kubelet = make([]*string, 0)
824+
for i := range extraArgs {
825+
clusterExtraArgs.Kubelet = append(clusterExtraArgs.Kubelet, &extraArgs[i])
826+
}
827+
setting.ExtraArgs = &clusterExtraArgs
828+
}
829+
830+
// get gpu_args
831+
if v, ok := dMap["gpu_args"]; ok && len(v.([]interface{})) > 0 {
832+
gpuArgs := v.([]interface{})[0].(map[string]interface{})
833+
834+
var (
835+
migEnable = gpuArgs["mig_enable"].(bool)
836+
driver = gpuArgs["driver"].(map[string]interface{})
837+
cuda = gpuArgs["cuda"].(map[string]interface{})
838+
cudnn = gpuArgs["cudnn"].(map[string]interface{})
839+
customDriver = gpuArgs["custom_driver"].(map[string]interface{})
840+
)
841+
tkeGpuArgs := tke.GPUArgs{}
842+
tkeGpuArgs.MIGEnable = &migEnable
843+
if len(driver) > 0 {
844+
tkeGpuArgs.Driver = &tke.DriverVersion{
845+
Version: helper.String(driver["version"].(string)),
846+
Name: helper.String(driver["name"].(string)),
847+
}
848+
}
849+
if len(cuda) > 0 {
850+
tkeGpuArgs.CUDA = &tke.DriverVersion{
851+
Version: helper.String(cuda["version"].(string)),
852+
Name: helper.String(cuda["name"].(string)),
853+
}
854+
}
855+
if len(cudnn) > 0 {
856+
tkeGpuArgs.CUDNN = &tke.CUDNN{
857+
Version: helper.String(cudnn["version"].(string)),
858+
Name: helper.String(cudnn["name"].(string)),
859+
}
860+
if cudnn["doc_name"] != nil {
861+
tkeGpuArgs.CUDNN.DocName = helper.String(cudnn["doc_name"].(string))
862+
}
863+
if cudnn["dev_name"] != nil {
864+
tkeGpuArgs.CUDNN.DevName = helper.String(cudnn["dev_name"].(string))
865+
}
866+
}
867+
if len(customDriver) > 0 {
868+
tkeGpuArgs.CustomDriver = &tke.CustomDriver{
869+
Address: helper.String(customDriver["address"].(string)),
870+
}
871+
}
872+
setting.GPUArgs = &tkeGpuArgs
873+
}
874+
875+
return setting
876+
}

0 commit comments

Comments
 (0)