From af71c40b20c124e8a4fd7af8859f3e39c074ae1b Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Fri, 20 Sep 2024 13:40:36 +0800 Subject: [PATCH 01/16] feat(tke): add cdc id --- go.mod | 4 +- go.sum | 8 +- .../tke/resource_tc_kubernetes_cluster.go | 21 ++ .../tencentcloud/common/http/request.go | 2 +- .../tencentcloud/tke/v20180525/client.go | 138 +++++++++++ .../tencentcloud/tke/v20180525/models.go | 216 +++++++++++++++++- vendor/modules.txt | 4 +- 7 files changed, 383 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 23a783526e..73b94e33b9 100644 --- a/go.mod +++ b/go.mod @@ -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.1001 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1005 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.960 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692 @@ -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.912 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1001 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1005 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 diff --git a/go.sum b/go.sum index c3fb80b99b..4ea9ccbd66 100644 --- a/go.sum +++ b/go.sum @@ -930,8 +930,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995/go.mod github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.998/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.998/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1001 h1:uX1xklZMQkTj/JAcn++AVwf5nf9ocrkionqz9diO2j8= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1001/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1005 h1:/7YHwvVZcWfF97eTbKGpZsr2XUFWVPg5u/oBwdK63fA= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1005/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 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ= @@ -1036,8 +1036,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.912 h1:XGOKd5u github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.912/go.mod h1:iqTDU0pVTQ8RCeMJPk/PAWl9HeI1DFMd1h07yMH7RGU= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998 h1:f4/n0dVKQTD06xJ84B5asHViNJHrZmGojdAWEPIsITM= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998/go.mod h1:fyi/HUwCwVe2NCCCjz8k/C5GwPu3QazCZO+OBJ3MhLk= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1001 h1:qj+pw5MJFuOvA+a+yAA2JR8B4TmfX5H5D8jy3L0YKH0= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1001/go.mod h1:FVJUGrfLPiJWiKrH+62h38Iyo9mA2O1wuaPLMlbeDBI= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1005 h1:Cj4aqrMtRojMFeJW+y9c2lkVO8RozL690itsfv+BXnU= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1005/go.mod h1:iWwbMdWtdwRM7dZSA6yR1TKe10uo3RMMSDmtsbIy7Cw= 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= diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go index ef1b8629b3..5c2d8cae35 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go @@ -3,6 +3,7 @@ package tke import ( "context" + "fmt" "log" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -1287,6 +1288,12 @@ func ResourceTencentCloudKubernetesCluster() *schema.Resource { Type: schema.TypeString, }, }, + + "cdc_id": { + Type: schema.TypeString, + Optional: true, + Description: "CDC ID.", + }, }, } } @@ -1307,6 +1314,10 @@ func resourceTencentCloudKubernetesClusterCreate(d *schema.ResourceData, meta in response = tkev20180525.NewCreateClusterResponse() ) + if v, ok := d.GetOk("cdc_id"); ok { + request.CdcId = helper.String(v.(string)) + } + clusterCIDRSettings := tkev20180525.ClusterCIDRSettings{} if v, ok := d.GetOk("cluster_cidr"); ok { clusterCIDRSettings.ClusterCIDR = helper.String(v.(string)) @@ -1496,6 +1507,10 @@ func resourceTencentCloudKubernetesClusterRead(d *schema.ResourceData, meta inte log.Printf("[WARN]%s resource `kubernetes_cluster` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) return nil } + if respData.CdcId != nil { + _ = d.Set("cdc_id", respData.CdcId) + } + if respData.ClusterName != nil { _ = d.Set("cluster_name", respData.ClusterName) } @@ -1681,6 +1696,12 @@ func resourceTencentCloudKubernetesClusterUpdate(d *schema.ResourceData, meta in ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + immutableArgs := []string{"cdc_id"} + for _, v := range immutableArgs { + if d.HasChange(v) { + return fmt.Errorf("argument `%s` cannot be changed", v) + } + } clusterId := d.Id() if err := resourceTencentCloudKubernetesClusterUpdateOnStart(ctx); err != nil { diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go index bd7d22b1fa..99781ac94a 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go @@ -265,7 +265,7 @@ func CompleteCommonParams(request Request, region string, requestClient string) params["Action"] = request.GetAction() params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) params["Nonce"] = strconv.Itoa(rand.Int()) - params["RequestClient"] = "SDK_GO_1.0.1001" + params["RequestClient"] = "SDK_GO_1.0.1005" if requestClient != "" { params["RequestClient"] += ": " + requestClient } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go index 0f51807c0f..2910411125 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go @@ -8450,6 +8450,73 @@ func (c *Client) DescribeLogSwitchesWithContext(ctx context.Context, request *De return } +func NewDescribeOpenPolicyListRequest() (request *DescribeOpenPolicyListRequest) { + request = &DescribeOpenPolicyListRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("tke", APIVersion, "DescribeOpenPolicyList") + + + return +} + +func NewDescribeOpenPolicyListResponse() (response *DescribeOpenPolicyListResponse) { + response = &DescribeOpenPolicyListResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeOpenPolicyList +// 查询opa策略列表 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_COMPONENTCLIENTUNPACK = "FailedOperation.ComponentClientUnpack" +// FAILEDOPERATION_KUBERNETESLISTOPERATIONERROR = "FailedOperation.KubernetesListOperationError" +// FAILEDOPERATION_RBACFORBIDDEN = "FailedOperation.RBACForbidden" +// INTERNALERROR = "InternalError" +// INTERNALERROR_KUBERNETESCLIENTBUILDERROR = "InternalError.KubernetesClientBuildError" +// INTERNALERROR_KUBERNETESGETOPERATIONERROR = "InternalError.KubernetesGetOperationError" +// INTERNALERROR_PARAM = "InternalError.Param" +// INTERNALERROR_UNEXCEPTEDINTERNAL = "InternalError.UnexceptedInternal" +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +func (c *Client) DescribeOpenPolicyList(request *DescribeOpenPolicyListRequest) (response *DescribeOpenPolicyListResponse, err error) { + return c.DescribeOpenPolicyListWithContext(context.Background(), request) +} + +// DescribeOpenPolicyList +// 查询opa策略列表 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_COMPONENTCLIENTUNPACK = "FailedOperation.ComponentClientUnpack" +// FAILEDOPERATION_KUBERNETESLISTOPERATIONERROR = "FailedOperation.KubernetesListOperationError" +// FAILEDOPERATION_RBACFORBIDDEN = "FailedOperation.RBACForbidden" +// INTERNALERROR = "InternalError" +// INTERNALERROR_KUBERNETESCLIENTBUILDERROR = "InternalError.KubernetesClientBuildError" +// INTERNALERROR_KUBERNETESGETOPERATIONERROR = "InternalError.KubernetesGetOperationError" +// INTERNALERROR_PARAM = "InternalError.Param" +// INTERNALERROR_UNEXCEPTEDINTERNAL = "InternalError.UnexceptedInternal" +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +func (c *Client) DescribeOpenPolicyListWithContext(ctx context.Context, request *DescribeOpenPolicyListRequest) (response *DescribeOpenPolicyListResponse, err error) { + if request == nil { + request = NewDescribeOpenPolicyListRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeOpenPolicyList require credential") + } + + request.SetContext(ctx) + + response = NewDescribeOpenPolicyListResponse() + err = c.Send(request, response) + return +} + func NewDescribePodChargeInfoRequest() (request *DescribePodChargeInfoRequest) { request = &DescribePodChargeInfoRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -12883,6 +12950,77 @@ func (c *Client) ModifyNodePoolInstanceTypesWithContext(ctx context.Context, req return } +func NewModifyOpenPolicyListRequest() (request *ModifyOpenPolicyListRequest) { + request = &ModifyOpenPolicyListRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("tke", APIVersion, "ModifyOpenPolicyList") + + + return +} + +func NewModifyOpenPolicyListResponse() (response *ModifyOpenPolicyListResponse) { + response = &ModifyOpenPolicyListResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// ModifyOpenPolicyList +// 批量修改opa策略 +// +// 可能返回的错误码: +// FAILEDOPERATION_COMPONENTCLIENTHTTP = "FailedOperation.ComponentClientHttp" +// INTERNALERROR = "InternalError" +// INTERNALERROR_ACCOUNTUSERNOTAUTHENTICATED = "InternalError.AccountUserNotAuthenticated" +// INTERNALERROR_CLUSTERNOTFOUND = "InternalError.ClusterNotFound" +// INTERNALERROR_DB = "InternalError.Db" +// INTERNALERROR_DBRECORDNOTFOUND = "InternalError.DbRecordNotFound" +// INTERNALERROR_PARAM = "InternalError.Param" +// INTERNALERROR_UNEXCEPTEDINTERNAL = "InternalError.UnexceptedInternal" +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ModifyOpenPolicyList(request *ModifyOpenPolicyListRequest) (response *ModifyOpenPolicyListResponse, err error) { + return c.ModifyOpenPolicyListWithContext(context.Background(), request) +} + +// ModifyOpenPolicyList +// 批量修改opa策略 +// +// 可能返回的错误码: +// FAILEDOPERATION_COMPONENTCLIENTHTTP = "FailedOperation.ComponentClientHttp" +// INTERNALERROR = "InternalError" +// INTERNALERROR_ACCOUNTUSERNOTAUTHENTICATED = "InternalError.AccountUserNotAuthenticated" +// INTERNALERROR_CLUSTERNOTFOUND = "InternalError.ClusterNotFound" +// INTERNALERROR_DB = "InternalError.Db" +// INTERNALERROR_DBRECORDNOTFOUND = "InternalError.DbRecordNotFound" +// INTERNALERROR_PARAM = "InternalError.Param" +// INTERNALERROR_UNEXCEPTEDINTERNAL = "InternalError.UnexceptedInternal" +// INTERNALERROR_UNEXPECTEDINTERNAL = "InternalError.UnexpectedInternal" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +// RESOURCENOTFOUND = "ResourceNotFound" +func (c *Client) ModifyOpenPolicyListWithContext(ctx context.Context, request *ModifyOpenPolicyListRequest) (response *ModifyOpenPolicyListResponse, err error) { + if request == nil { + request = NewModifyOpenPolicyListRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("ModifyOpenPolicyList require credential") + } + + request.SetContext(ctx) + + response = NewModifyOpenPolicyListResponse() + err = c.Send(request, response) + return +} + func NewModifyPrometheusAgentExternalLabelsRequest() (request *ModifyPrometheusAgentExternalLabelsRequest) { request = &ModifyPrometheusAgentExternalLabelsRequest{ BaseRequest: &tchttp.BaseRequest{}, diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go index 7d21bc5b7c..4da83d47ab 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go @@ -903,6 +903,10 @@ type Cluster struct { // 集群当前etcd数量 // 注意:此字段可能返回 null,表示取不到有效值。 ClusterEtcdNodeNum *uint64 `json:"ClusterEtcdNodeNum,omitnil,omitempty" name:"ClusterEtcdNodeNum"` + + // 本地专用集群Id + // 注意:此字段可能返回 null,表示取不到有效值。 + CdcId *string `json:"CdcId,omitnil,omitempty" name:"CdcId"` } type ClusterAdvancedSettings struct { @@ -9898,9 +9902,13 @@ type DescribeExternalNodeSupportConfigResponseParams struct { // 是否开启第三方节点公网连接支持 EnabledPublicConnect *bool `json:"EnabledPublicConnect,omitnil,omitempty" name:"EnabledPublicConnect"` - // 公网连接地址 + // 注册节点公网版公网连接地址 PublicConnectUrl *string `json:"PublicConnectUrl,omitnil,omitempty" name:"PublicConnectUrl"` + // 注册节点公网版自定义域名 + // 注意:此字段可能返回 null,表示取不到有效值。 + PublicCustomDomain *string `json:"PublicCustomDomain,omitnil,omitempty" name:"PublicCustomDomain"` + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` } @@ -10224,6 +10232,71 @@ func (r *DescribeLogSwitchesResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type DescribeOpenPolicyListRequestParams struct { + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 策略分类 基线:baseline 优选:priority 可选:optional + Category *string `json:"Category,omitnil,omitempty" name:"Category"` +} + +type DescribeOpenPolicyListRequest struct { + *tchttp.BaseRequest + + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 策略分类 基线:baseline 优选:priority 可选:optional + Category *string `json:"Category,omitnil,omitempty" name:"Category"` +} + +func (r *DescribeOpenPolicyListRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOpenPolicyListRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterId") + delete(f, "Category") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeOpenPolicyListRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeOpenPolicyListResponseParams struct { + // 策略信息列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + OpenPolicyInfoList []*OpenPolicyInfo `json:"OpenPolicyInfoList,omitnil,omitempty" name:"OpenPolicyInfoList"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeOpenPolicyListResponse struct { + *tchttp.BaseResponse + Response *DescribeOpenPolicyListResponseParams `json:"Response"` +} + +func (r *DescribeOpenPolicyListResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeOpenPolicyListResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type DescribePodChargeInfoRequestParams struct { // 集群ID @@ -16643,6 +16716,74 @@ func (r *ModifyNodePoolInstanceTypesResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type ModifyOpenPolicyListRequestParams struct { + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 修改的策略列表,目前仅支持修改EnforcementAction字段 + OpenPolicyInfoList []*OpenPolicySwitch `json:"OpenPolicyInfoList,omitnil,omitempty" name:"OpenPolicyInfoList"` + + // 策略分类 基线:baseline 优选:priority 可选:optional + Category *string `json:"Category,omitnil,omitempty" name:"Category"` +} + +type ModifyOpenPolicyListRequest struct { + *tchttp.BaseRequest + + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 修改的策略列表,目前仅支持修改EnforcementAction字段 + OpenPolicyInfoList []*OpenPolicySwitch `json:"OpenPolicyInfoList,omitnil,omitempty" name:"OpenPolicyInfoList"` + + // 策略分类 基线:baseline 优选:priority 可选:optional + Category *string `json:"Category,omitnil,omitempty" name:"Category"` +} + +func (r *ModifyOpenPolicyListRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyOpenPolicyListRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterId") + delete(f, "OpenPolicyInfoList") + delete(f, "Category") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyOpenPolicyListRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type ModifyOpenPolicyListResponseParams struct { + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type ModifyOpenPolicyListResponse struct { + *tchttp.BaseResponse + Response *ModifyOpenPolicyListResponseParams `json:"Response"` +} + +func (r *ModifyOpenPolicyListResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *ModifyOpenPolicyListResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type ModifyPrometheusAgentExternalLabelsRequestParams struct { // 实例ID @@ -17412,6 +17553,79 @@ type OIDCConfigAuthenticationOptions struct { AutoInstallPodIdentityWebhookAddon *bool `json:"AutoInstallPodIdentityWebhookAddon,omitnil,omitempty" name:"AutoInstallPodIdentityWebhookAddon"` } +type OpenConstraintInfo struct { + // 策略实例名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + Name *string `json:"Name,omitnil,omitempty" name:"Name"` + + // 策略实例关联事件数 + // 注意:此字段可能返回 null,表示取不到有效值。 + EventNums *uint64 `json:"EventNums,omitnil,omitempty" name:"EventNums"` + + // 实例yaml详情base64编码 + // 注意:此字段可能返回 null,表示取不到有效值。 + YamlDetail *string `json:"YamlDetail,omitnil,omitempty" name:"YamlDetail"` +} + +type OpenPolicyInfo struct { + // 策略分类:cluster集群策略、node节点策略、namespace命名空间策略、configuration配置相关策略、compute计算资源策略、storage存储资源策略、network网络资源策略 + // 注意:此字段可能返回 null,表示取不到有效值。 + PolicyCategory *string `json:"PolicyCategory,omitnil,omitempty" name:"PolicyCategory"` + + // 策略中文名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + PolicyName *string `json:"PolicyName,omitnil,omitempty" name:"PolicyName"` + + // 策略描述 + // 注意:此字段可能返回 null,表示取不到有效值。 + PolicyDesc *string `json:"PolicyDesc,omitnil,omitempty" name:"PolicyDesc"` + + // 策略运行模式:dryrun空跑不生效,deny拦截生效 + // 注意:此字段可能返回 null,表示取不到有效值。 + EnforcementAction *string `json:"EnforcementAction,omitnil,omitempty" name:"EnforcementAction"` + + // 关联的事件数量(最近7d) + // 注意:此字段可能返回 null,表示取不到有效值。 + EventNums *uint64 `json:"EventNums,omitnil,omitempty" name:"EventNums"` + + // 策略英文名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + Name *string `json:"Name,omitnil,omitempty" name:"Name"` + + // 策略模版类型 + // 注意:此字段可能返回 null,表示取不到有效值。 + Kind *string `json:"Kind,omitnil,omitempty" name:"Kind"` + + // 策略开关状态:open打开,close关闭 + // 注意:此字段可能返回 null,表示取不到有效值。 + EnabledStatus *string `json:"EnabledStatus,omitnil,omitempty" name:"EnabledStatus"` + + // 策略的实例的yaml示例base64编码 + // 注意:此字段可能返回 null,表示取不到有效值。 + ConstraintYamlExample *string `json:"ConstraintYamlExample,omitnil,omitempty" name:"ConstraintYamlExample"` + + // 策略关联的实例列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + OpenConstraintInfoList []*OpenConstraintInfo `json:"OpenConstraintInfoList,omitnil,omitempty" name:"OpenConstraintInfoList"` +} + +type OpenPolicySwitch struct { + // 策略运行模式:dryrun空跑不生效,deny拦截生效 + EnforcementAction *string `json:"EnforcementAction,omitnil,omitempty" name:"EnforcementAction"` + + // 策略英文名称 + Name *string `json:"Name,omitnil,omitempty" name:"Name"` + + // 策略模版类型 + Kind *string `json:"Kind,omitnil,omitempty" name:"Kind"` + + // 策略开关状态:open打开,close关闭 + EnabledStatus *string `json:"EnabledStatus,omitnil,omitempty" name:"EnabledStatus"` + + // 策略关联的实例列表 + OpenConstraintInfoList []*OpenConstraintInfo `json:"OpenConstraintInfoList,omitnil,omitempty" name:"OpenConstraintInfoList"` +} + type OptionalRuntimes struct { // 运行时类型 // 注意:此字段可能返回 null,表示取不到有效值。 diff --git a/vendor/modules.txt b/vendor/modules.txt index a71911654b..80366efabb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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.1001 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1005 ## explicit; go 1.11 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors @@ -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.1001 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1005 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20220501 From 3740b8d6689ce9a749bf0321ad5908a15376e405 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Fri, 20 Sep 2024 13:42:18 +0800 Subject: [PATCH 02/16] feat(tke): add cdc id --- website/docs/r/kubernetes_cluster.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index dfb72dede9..a1395cbe0c 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -798,6 +798,7 @@ The following arguments are supported: * `auth_options` - (Optional, List) Specify cluster authentication configuration. Only available for managed cluster and `cluster_version` >= 1.20. * `auto_upgrade_cluster_level` - (Optional, Bool) Whether the cluster level auto upgraded, valid for managed cluster. * `base_pod_num` - (Optional, Int, ForceNew) The number of basic pods. valid when enable_customized_pod_cidr=true. +* `cdc_id` - (Optional, String) CDC ID. * `claim_expired_seconds` - (Optional, Int) Claim expired seconds to recycle ENI. This field can only set when field `network_type` is 'VPC-CNI'. `claim_expired_seconds` must greater or equal than 300 and less than 15768000. * `cluster_audit` - (Optional, List) Specify Cluster Audit config. NOTE: Please make sure your TKE CamRole have permission to access CLS service. * `cluster_cidr` - (Optional, String, ForceNew) A network address block of the cluster. Different from vpc cidr and cidr of other clusters within this vpc. Must be in 10./192.168/172.[16-31] segments. From 24d8b28c277f7fc55abf154780ecc6500caa02e7 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Fri, 20 Sep 2024 13:46:47 +0800 Subject: [PATCH 03/16] docs(tke): add changelog --- .changelog/2835.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/2835.txt diff --git a/.changelog/2835.txt b/.changelog/2835.txt new file mode 100644 index 0000000000..cef30a41ac --- /dev/null +++ b/.changelog/2835.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_kubernetes_cluster: support `cdc_id` params +``` From 08068da60375cc600378448cd015a4656d69ee2d Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Fri, 20 Sep 2024 14:25:35 +0800 Subject: [PATCH 04/16] docs(tke): add changelog --- .../tke/resource_tc_kubernetes_health_check_policy_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_health_check_policy_test.go b/tencentcloud/services/tke/resource_tc_kubernetes_health_check_policy_test.go index 1afe689109..8d5c274df4 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_health_check_policy_test.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_health_check_policy_test.go @@ -65,7 +65,7 @@ resource "tencentcloud_kubernetes_health_check_policy" "kubernetes_health_check_ ` // const testAccKubernetesHealthCheckPolicyUpdate = testAccTkeCluster + ` -const testAccKubernetesHealthCheckPolicyCreate = ` +const testAccKubernetesHealthCheckPolicyUpdate = ` resource "tencentcloud_kubernetes_health_check_policy" "kubernetes_health_check_policy" { cluster_id = "cls-eh0da110" From bbb5ab62ba30acf55207b8e81e47eb477ef020d2 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Mon, 23 Sep 2024 21:22:20 +0800 Subject: [PATCH 05/16] feat(tke): cdc id --- .../tke/resource_tc_kubernetes_cluster.go | 6 ++ ...esource_tc_kubernetes_cluster_extension.go | 57 +++++++++++-------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go index 5c2d8cae35..d6e154cab1 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go @@ -1216,6 +1216,12 @@ func ResourceTencentCloudKubernetesCluster() *schema.Resource { DiffSuppressFunc: dockerGraphPathDiffSuppressFunc, }, + "pre_start_user_script": { + Type: schema.TypeString, + Optional: true, + Description: "Base64-encoded user script, executed before initializing the node, currently only effective for adding existing nodes.", + }, + "extra_args": { Type: schema.TypeList, Optional: true, diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go index 3794833562..77d3b28ce2 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go @@ -149,34 +149,39 @@ func resourceTencentCloudKubernetesClusterCreatePostFillRequest0(ctx context.Con Master: make([]tke.InstanceAdvancedSettings, 0), Work: make([]tke.InstanceAdvancedSettings, 0), } - if masters, ok := d.GetOk("master_config"); ok { - if clusterDeployType == TKE_DEPLOY_TYPE_MANAGED { - return fmt.Errorf("if `cluster_deploy_type` is `MANAGED_CLUSTER` , You don't need define the master yourself") - } - var masterCount int64 = 0 - masterList := masters.([]interface{}) - for index := range masterList { - master := masterList[index].(map[string]interface{}) - paraJson, count, err := tkeGetCvmRunInstancesPara(master, meta, vpcId, basic.ProjectId) - if err != nil { - return err + + cdc_id := d.Get("cdc_id").(string) + + if cdc_id == "" { + if masters, ok := d.GetOk("master_config"); ok { + if clusterDeployType == TKE_DEPLOY_TYPE_MANAGED { + return fmt.Errorf("if `cluster_deploy_type` is `MANAGED_CLUSTER` , You don't need define the master yourself") } + var masterCount int64 = 0 + masterList := masters.([]interface{}) + for index := range masterList { + master := masterList[index].(map[string]interface{}) + paraJson, count, err := tkeGetCvmRunInstancesPara(master, meta, vpcId, basic.ProjectId) + if err != nil { + return err + } - cvms.Master = append(cvms.Master, paraJson) - masterCount += count + cvms.Master = append(cvms.Master, paraJson) + masterCount += count - if v, ok := master["desired_pod_num"]; ok { - dpNum := int64(v.(int)) - if dpNum != DefaultDesiredPodNum { - overrideSettings.Master = append(overrideSettings.Master, tke.InstanceAdvancedSettings{DesiredPodNumber: helper.Int64(dpNum)}) + if v, ok := master["desired_pod_num"]; ok { + dpNum := int64(v.(int)) + if dpNum != DefaultDesiredPodNum { + overrideSettings.Master = append(overrideSettings.Master, tke.InstanceAdvancedSettings{DesiredPodNumber: helper.Int64(dpNum)}) + } } } + if masterCount < 3 { + return fmt.Errorf("if `cluster_deploy_type` is `TKE_DEPLOY_TYPE_INDEPENDENT` len(master_config) should >=3") + } + } else if clusterDeployType == TKE_DEPLOY_TYPE_INDEPENDENT { + return fmt.Errorf("if `cluster_deploy_type` is `TKE_DEPLOY_TYPE_INDEPENDENT` , You need define the master yourself") } - if masterCount < 3 { - return fmt.Errorf("if `cluster_deploy_type` is `TKE_DEPLOY_TYPE_INDEPENDENT` len(master_config) should >=3") - } - } else if clusterDeployType == TKE_DEPLOY_TYPE_INDEPENDENT { - return fmt.Errorf("if `cluster_deploy_type` is `TKE_DEPLOY_TYPE_INDEPENDENT` , You need define the master yourself") } if workers, ok := d.GetOk("worker_config"); ok { @@ -261,6 +266,10 @@ func resourceTencentCloudKubernetesClusterCreatePostFillRequest0(ctx context.Con iAdvanced.DockerGraphPath = "/var/lib/docker" } + if preStartUserScript, ok := d.GetOk("pre_start_user_script"); ok { + iAdvanced.DockerGraphPath = preStartUserScript.(string) + } + // ExistedInstancesForNode existInstances := make([]*tke.ExistedInstancesForNode, 0) if instances, ok := d.GetOk("exist_instance"); ok { @@ -311,7 +320,9 @@ func resourceTencentCloudKubernetesClusterCreatePostFillRequest0(ctx context.Con req.RunInstancesForNode = []*tke.RunInstancesForNode{} - if len(cvms.Master) != 0 { + if cdc_id != "" { + req.ClusterType = helper.String(clusterDeployType) + } else if len(cvms.Master) != 0 { var node tke.RunInstancesForNode node.NodeRole = helper.String(TKE_ROLE_MASTER_ETCD) From a84e65e4ed607dc331e37b800c3853f2dcec1555 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Mon, 23 Sep 2024 21:45:37 +0800 Subject: [PATCH 06/16] feat(tke): cdc id --- .../services/tke/resource_tc_kubernetes_cluster_extension.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go index 77d3b28ce2..38fe5e6557 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go @@ -267,7 +267,7 @@ func resourceTencentCloudKubernetesClusterCreatePostFillRequest0(ctx context.Con } if preStartUserScript, ok := d.GetOk("pre_start_user_script"); ok { - iAdvanced.DockerGraphPath = preStartUserScript.(string) + iAdvanced.PreStartUserScript = preStartUserScript.(string) } // ExistedInstancesForNode From 41c024892a69629c52d692382c4ecc9f51c6f7ec Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Mon, 23 Sep 2024 22:30:08 +0800 Subject: [PATCH 07/16] feat(tke): cdc id --- .../tke/resource_tc_kubernetes_cluster.go | 1 + .../services/tke/service_tencentcloud_tke.go | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go index d6e154cab1..c536428610 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go @@ -1219,6 +1219,7 @@ func ResourceTencentCloudKubernetesCluster() *schema.Resource { "pre_start_user_script": { Type: schema.TypeString, Optional: true, + ForceNew: true, Description: "Base64-encoded user script, executed before initializing the node, currently only effective for adding existing nodes.", }, diff --git a/tencentcloud/services/tke/service_tencentcloud_tke.go b/tencentcloud/services/tke/service_tencentcloud_tke.go index c1e33046f0..367e4e8ee1 100644 --- a/tencentcloud/services/tke/service_tencentcloud_tke.go +++ b/tencentcloud/services/tke/service_tencentcloud_tke.go @@ -73,14 +73,15 @@ type RunInstancesForNode struct { } type InstanceAdvancedSettings struct { - MountTarget string - DockerGraphPath string - UserScript string - Unschedulable int64 - DesiredPodNum int64 - Labels []*tke.Label - DataDisks []*tke.DataDisk - ExtraArgs tke.InstanceExtraArgs + MountTarget string + DockerGraphPath string + PreStartUserScript string + UserScript string + Unschedulable int64 + DesiredPodNum int64 + Labels []*tke.Label + DataDisks []*tke.DataDisk + ExtraArgs tke.InstanceExtraArgs } type ClusterCidrSettings struct { From 2d6d9d24b7e7749680873eeee6076d0d688ffdb1 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Mon, 23 Sep 2024 22:56:54 +0800 Subject: [PATCH 08/16] feat(tke): cdc id --- .../services/tke/resource_tc_kubernetes_cluster_extension.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go index 38fe5e6557..6500ab7bde 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go @@ -305,6 +305,7 @@ func resourceTencentCloudKubernetesClusterCreatePostFillRequest0(ctx context.Con req.ClusterAdvancedSettings.VpcCniType = &advanced.VpcCniType req.InstanceAdvancedSettings.DockerGraphPath = &iAdvanced.DockerGraphPath + req.InstanceAdvancedSettings.PreStartUserScript = &iAdvanced.PreStartUserScript req.InstanceAdvancedSettings.UserScript = &iAdvanced.UserScript if len(iAdvanced.DataDisks) > 0 { From 0b96e3a8b87d23a979e5364e76be395af7c37bd0 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Mon, 23 Sep 2024 23:08:59 +0800 Subject: [PATCH 09/16] feat(tke): cdc id --- .changelog/2835.txt | 2 +- go.mod | 4 +- go.sum | 8 +- .../tencentcloud/common/http/request.go | 2 +- .../tencentcloud/tke/v20180525/client.go | 118 ++++++++++++ .../tencentcloud/tke/v20180525/errors.go | 3 + .../tencentcloud/tke/v20180525/models.go | 168 +++++++++++++++++- vendor/modules.txt | 4 +- .../docs/r/kubernetes_cluster.html.markdown | 1 + 9 files changed, 299 insertions(+), 11 deletions(-) diff --git a/.changelog/2835.txt b/.changelog/2835.txt index cef30a41ac..f311dbdc54 100644 --- a/.changelog/2835.txt +++ b/.changelog/2835.txt @@ -1,3 +1,3 @@ ```release-note:enhancement -resource/tencentcloud_kubernetes_cluster: support `cdc_id` params +resource/tencentcloud_kubernetes_cluster: support `cdc_id` and `pre_start_user_script` params ``` diff --git a/go.mod b/go.mod index 73b94e33b9..92228f0dd2 100644 --- a/go.mod +++ b/go.mod @@ -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.1005 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1008 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.960 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692 @@ -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.912 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1005 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1008 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 diff --git a/go.sum b/go.sum index 4ea9ccbd66..ee2ac2ac16 100644 --- a/go.sum +++ b/go.sum @@ -930,8 +930,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995/go.mod github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.998/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.998/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1005 h1:/7YHwvVZcWfF97eTbKGpZsr2XUFWVPg5u/oBwdK63fA= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1005/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1008 h1:BQJUiwOi2d368bF1qmdCjHjUMEt24vM6d68r9S+OrQM= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1008/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 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ= @@ -1036,8 +1036,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.912 h1:XGOKd5u github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.912/go.mod h1:iqTDU0pVTQ8RCeMJPk/PAWl9HeI1DFMd1h07yMH7RGU= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998 h1:f4/n0dVKQTD06xJ84B5asHViNJHrZmGojdAWEPIsITM= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.998/go.mod h1:fyi/HUwCwVe2NCCCjz8k/C5GwPu3QazCZO+OBJ3MhLk= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1005 h1:Cj4aqrMtRojMFeJW+y9c2lkVO8RozL690itsfv+BXnU= -github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1005/go.mod h1:iWwbMdWtdwRM7dZSA6yR1TKe10uo3RMMSDmtsbIy7Cw= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1008 h1:Cz7JSuS2zxIBzAuZ2bKk3EmrZ1QgS2QAHmCDTDPWBz0= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1008/go.mod h1:71PkDdVPT2Pd8yiuX6QFUDReTji39R/03dg1JwcjHWo= 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= diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go index 99781ac94a..aa13a9ae6e 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go @@ -265,7 +265,7 @@ func CompleteCommonParams(request Request, region string, requestClient string) params["Action"] = request.GetAction() params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10) params["Nonce"] = strconv.Itoa(rand.Int()) - params["RequestClient"] = "SDK_GO_1.0.1005" + params["RequestClient"] = "SDK_GO_1.0.1008" if requestClient != "" { params["RequestClient"] += ": " + requestClient } diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go index 2910411125..7850ddd1a6 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/client.go @@ -4121,6 +4121,65 @@ func (c *Client) DeleteImageCachesWithContext(ctx context.Context, request *Dele return } +func NewDeleteLogConfigsRequest() (request *DeleteLogConfigsRequest) { + request = &DeleteLogConfigsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("tke", APIVersion, "DeleteLogConfigs") + + + return +} + +func NewDeleteLogConfigsResponse() (response *DeleteLogConfigsResponse) { + response = &DeleteLogConfigsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DeleteLogConfigs +// 删除集群内采集规则 +// +// 可能返回的错误码: +// FAILEDOPERATION_K8SCLIENTBUILDERROR = "FailedOperation.K8sClientBuildError" +// FAILEDOPERATION_KUBERNETESDELETEOPERATIONERROR = "FailedOperation.KubernetesDeleteOperationError" +// FAILEDOPERATION_KUBERNETESGETOPERATIONERROR = "FailedOperation.KubernetesGetOperationError" +// FAILEDOPERATION_KUBERNETESLISTOPERATIONERROR = "FailedOperation.KubernetesListOperationError" +// FAILEDOPERATION_KUBERNETESRESOURCENOTFOUND = "FailedOperation.KubernetesResourceNotFound" +// FAILEDOPERATION_PARAM = "FailedOperation.Param" +func (c *Client) DeleteLogConfigs(request *DeleteLogConfigsRequest) (response *DeleteLogConfigsResponse, err error) { + return c.DeleteLogConfigsWithContext(context.Background(), request) +} + +// DeleteLogConfigs +// 删除集群内采集规则 +// +// 可能返回的错误码: +// FAILEDOPERATION_K8SCLIENTBUILDERROR = "FailedOperation.K8sClientBuildError" +// FAILEDOPERATION_KUBERNETESDELETEOPERATIONERROR = "FailedOperation.KubernetesDeleteOperationError" +// FAILEDOPERATION_KUBERNETESGETOPERATIONERROR = "FailedOperation.KubernetesGetOperationError" +// FAILEDOPERATION_KUBERNETESLISTOPERATIONERROR = "FailedOperation.KubernetesListOperationError" +// FAILEDOPERATION_KUBERNETESRESOURCENOTFOUND = "FailedOperation.KubernetesResourceNotFound" +// FAILEDOPERATION_PARAM = "FailedOperation.Param" +func (c *Client) DeleteLogConfigsWithContext(ctx context.Context, request *DeleteLogConfigsRequest) (response *DeleteLogConfigsResponse, err error) { + if request == nil { + request = NewDeleteLogConfigsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DeleteLogConfigs require credential") + } + + request.SetContext(ctx) + + response = NewDeleteLogConfigsResponse() + err = c.Send(request, response) + return +} + func NewDeletePrometheusAlertPolicyRequest() (request *DeletePrometheusAlertPolicyRequest) { request = &DeletePrometheusAlertPolicyRequest{ BaseRequest: &tchttp.BaseRequest{}, @@ -8383,6 +8442,65 @@ func (c *Client) DescribeImagesWithContext(ctx context.Context, request *Describ return } +func NewDescribeLogConfigsRequest() (request *DescribeLogConfigsRequest) { + request = &DescribeLogConfigsRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("tke", APIVersion, "DescribeLogConfigs") + + + return +} + +func NewDescribeLogConfigsResponse() (response *DescribeLogConfigsResponse) { + response = &DescribeLogConfigsResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return + +} + +// DescribeLogConfigs +// 查询日志采集规则 +// +// 可能返回的错误码: +// FAILEDOPERATION_KUBERNETESCLIENTBUILDERROR = "FailedOperation.KubernetesClientBuildError" +// FAILEDOPERATION_KUBERNETESGETOPERATIONERROR = "FailedOperation.KubernetesGetOperationError" +// FAILEDOPERATION_KUBERNETESLISTOPERATIONERROR = "FailedOperation.KubernetesListOperationError" +// FAILEDOPERATION_KUBERNETESRESOURCENOTFOUND = "FailedOperation.KubernetesResourceNotFound" +// FAILEDOPERATION_PARAM = "FailedOperation.Param" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +func (c *Client) DescribeLogConfigs(request *DescribeLogConfigsRequest) (response *DescribeLogConfigsResponse, err error) { + return c.DescribeLogConfigsWithContext(context.Background(), request) +} + +// DescribeLogConfigs +// 查询日志采集规则 +// +// 可能返回的错误码: +// FAILEDOPERATION_KUBERNETESCLIENTBUILDERROR = "FailedOperation.KubernetesClientBuildError" +// FAILEDOPERATION_KUBERNETESGETOPERATIONERROR = "FailedOperation.KubernetesGetOperationError" +// FAILEDOPERATION_KUBERNETESLISTOPERATIONERROR = "FailedOperation.KubernetesListOperationError" +// FAILEDOPERATION_KUBERNETESRESOURCENOTFOUND = "FailedOperation.KubernetesResourceNotFound" +// FAILEDOPERATION_PARAM = "FailedOperation.Param" +// INVALIDPARAMETER_PARAM = "InvalidParameter.Param" +func (c *Client) DescribeLogConfigsWithContext(ctx context.Context, request *DescribeLogConfigsRequest) (response *DescribeLogConfigsResponse, err error) { + if request == nil { + request = NewDescribeLogConfigsRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("DescribeLogConfigs require credential") + } + + request.SetContext(ctx) + + response = NewDescribeLogConfigsResponse() + err = c.Send(request, response) + return +} + func NewDescribeLogSwitchesRequest() (request *DescribeLogSwitchesRequest) { request = &DescribeLogSwitchesRequest{ BaseRequest: &tchttp.BaseRequest{}, diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/errors.go index a724bad3c0..11ba09df32 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/errors.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/errors.go @@ -164,6 +164,9 @@ const ( // Kubernetes patch 操作失败。 FAILEDOPERATION_KUBERNETESPATCHOPERATIONERROR = "FailedOperation.KubernetesPatchOperationError" + // Kubernetes没有找到。 + FAILEDOPERATION_KUBERNETESRESOURCENOTFOUND = "FailedOperation.KubernetesResourceNotFound" + // 底层调用CLB未知错误。 FAILEDOPERATION_LBCOMMON = "FailedOperation.LbCommon" diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go index 4da83d47ab..a543a1fa77 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525/models.go @@ -5510,6 +5510,78 @@ func (r *DeleteImageCachesResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type DeleteLogConfigsRequestParams struct { + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 待删除采集规则名称,多个采集规则使用","分隔 + LogConfigNames *string `json:"LogConfigNames,omitnil,omitempty" name:"LogConfigNames"` + + // 集群集群类型, tke/eks 默认为 tke 集群 + ClusterType *string `json:"ClusterType,omitnil,omitempty" name:"ClusterType"` +} + +type DeleteLogConfigsRequest struct { + *tchttp.BaseRequest + + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 待删除采集规则名称,多个采集规则使用","分隔 + LogConfigNames *string `json:"LogConfigNames,omitnil,omitempty" name:"LogConfigNames"` + + // 集群集群类型, tke/eks 默认为 tke 集群 + ClusterType *string `json:"ClusterType,omitnil,omitempty" name:"ClusterType"` +} + +func (r *DeleteLogConfigsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteLogConfigsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterId") + delete(f, "LogConfigNames") + delete(f, "ClusterType") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteLogConfigsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DeleteLogConfigsResponseParams struct { + // 删除采集规则遇到错误时返回错误原因 + // 注意:此字段可能返回 null,表示取不到有效值。 + Message *string `json:"Message,omitnil,omitempty" name:"Message"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DeleteLogConfigsResponse struct { + *tchttp.BaseResponse + Response *DeleteLogConfigsResponseParams `json:"Response"` +} + +func (r *DeleteLogConfigsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteLogConfigsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type DeletePrometheusAlertPolicyRequestParams struct { // 实例id @@ -10167,6 +10239,100 @@ func (r *DescribeImagesResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type DescribeLogConfigsRequestParams struct { + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 当前集群类型支持tke、eks。默认为tke + ClusterType *string `json:"ClusterType,omitnil,omitempty" name:"ClusterType"` + + // 按照采集规则名称查找,多个采集规则使用 "," 分隔。 + LogConfigNames *string `json:"LogConfigNames,omitnil,omitempty" name:"LogConfigNames"` + + // 偏移量,默认0 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 最大输出条数,默认20,最大为100 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` +} + +type DescribeLogConfigsRequest struct { + *tchttp.BaseRequest + + // 集群ID + ClusterId *string `json:"ClusterId,omitnil,omitempty" name:"ClusterId"` + + // 当前集群类型支持tke、eks。默认为tke + ClusterType *string `json:"ClusterType,omitnil,omitempty" name:"ClusterType"` + + // 按照采集规则名称查找,多个采集规则使用 "," 分隔。 + LogConfigNames *string `json:"LogConfigNames,omitnil,omitempty" name:"LogConfigNames"` + + // 偏移量,默认0 + Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"` + + // 最大输出条数,默认20,最大为100 + Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"` +} + +func (r *DescribeLogConfigsRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeLogConfigsRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "ClusterId") + delete(f, "ClusterType") + delete(f, "LogConfigNames") + delete(f, "Offset") + delete(f, "Limit") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeLogConfigsRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type DescribeLogConfigsResponseParams struct { + // 分页查找时返回采集规则总数 + // 注意:此字段可能返回 null,表示取不到有效值。 + Total *int64 `json:"Total,omitnil,omitempty" name:"Total"` + + // 指定采集规则名称查找,部分失败时返回失败采集规则名称及最后一个失败原因 + // 注意:此字段可能返回 null,表示取不到有效值。 + Message *string `json:"Message,omitnil,omitempty" name:"Message"` + + // 采集规则查询结果 + // 注意:此字段可能返回 null,表示取不到有效值。 + LogConfigs *string `json:"LogConfigs,omitnil,omitempty" name:"LogConfigs"` + + // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` +} + +type DescribeLogConfigsResponse struct { + *tchttp.BaseResponse + Response *DescribeLogConfigsResponseParams `json:"Response"` +} + +func (r *DescribeLogConfigsResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeLogConfigsResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type DescribeLogSwitchesRequestParams struct { // 集群ID列表 @@ -17661,7 +17827,7 @@ type PendingRelease struct { // 注意:此字段可能返回 null,表示取不到有效值。 Namespace *string `json:"Namespace,omitnil,omitempty" name:"Namespace"` - // 应用状态 + // 应用状态(参考helm的发布状态: unknown, deployed, uninstalled, superseded, failed, uninstalling, pending-install, pending-upgrade 或 pending-rollback) // 注意:此字段可能返回 null,表示取不到有效值。 Status *string `json:"Status,omitnil,omitempty" name:"Status"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 80366efabb..c429112d27 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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.1005 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1008 ## explicit; go 1.11 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors @@ -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.1005 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.1008 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20180525 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke/v20220501 diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index a1395cbe0c..ca6a471bcd 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -842,6 +842,7 @@ The following arguments are supported: * `network_type` - (Optional, String, ForceNew) Cluster network type, the available values include: 'GR' and 'VPC-CNI' and 'CiliumOverlay'. Default is GR. * `node_name_type` - (Optional, String, ForceNew) Node name type of Cluster, the available values include: 'lan-ip' and 'hostname', Default is 'lan-ip'. * `node_pool_global_config` - (Optional, List) Global config effective for all node pools. +* `pre_start_user_script` - (Optional, String, ForceNew) Base64-encoded user script, executed before initializing the node, currently only effective for adding existing nodes. * `project_id` - (Optional, Int) Project ID, default value is 0. * `runtime_version` - (Optional, String) Container Runtime version. * `service_cidr` - (Optional, String, ForceNew) A network address block of the service. Different from vpc cidr and cidr of other clusters within this vpc. Must be in 10./192.168/172.[16-31] segments. From 44deca9896895b38a8bf7a967d363bcb55261ab1 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Tue, 24 Sep 2024 11:33:59 +0800 Subject: [PATCH 10/16] feat(tke): cdc id --- .../tke/resource_tc_kubernetes_cluster.md | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md index 42c803a191..c38cedea05 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md @@ -767,18 +767,46 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { event_persistence { enabled = true - log_set_id = "" # optional + log_set_id = "" # optional topic_id = "" # optional } cluster_audit { enabled = true - log_set_id = "" # optional + log_set_id = "" # optional topic_id = "" # optional } } ``` +Create cluster with cdc_id +``` +resource "tencentcloud_kubernetes_cluster" "cdc_cluster" { + cdc_id = "cluster-xxxxx" + vpc_id = "vpc-xxxxx" + cluster_cidr = "192.168.0.0/16" + cluster_max_pod_num = 64 + cluster_name = "test-cdc" + cluster_desc = "test cluster desc" + cluster_max_service_num = 1024 + cluster_version = "1.30.0" + + cluster_os = "tlinux3.1x86_64" + cluster_level = "L20" + cluster_deploy_type = "INDEPENDENT_CLUSTER" + + container_runtime = "containerd" + runtime_version = "1.6.9" + pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw=" + exist_instance { + node_role = "MASTER_ETCD" + instances_para { + instance_ids = ["ins-eeijdk16", "ins-84ku5rba", "ins-8oa3im2s"] + } + } +} +``` + Import tke cluster can be imported, e.g. From ebc114ede434a6d9e4fc505c04146ab915326a1c Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Tue, 24 Sep 2024 11:35:45 +0800 Subject: [PATCH 11/16] feat(tke): cdc id --- tencentcloud/services/tke/resource_tc_kubernetes_cluster.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md index c38cedea05..a1342a1a7c 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md @@ -779,7 +779,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { } ``` -Create cluster with cdc_id +Create a CDC scenario cluster with ``` resource "tencentcloud_kubernetes_cluster" "cdc_cluster" { cdc_id = "cluster-xxxxx" From 9ed3e8fb8f83539037b6dbd7a39ef5e29a524366 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Tue, 24 Sep 2024 14:15:38 +0800 Subject: [PATCH 12/16] feat(tke): cdc id --- .../docs/r/kubernetes_cluster.html.markdown | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index ca6a471bcd..8c9849f2ea 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -789,6 +789,35 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { } ``` +### Create a CDC scenario cluster with + +```hcl +resource "tencentcloud_kubernetes_cluster" "cdc_cluster" { + cdc_id = "cluster-xxxxx" + vpc_id = "vpc-xxxxx" + cluster_cidr = "192.168.0.0/16" + cluster_max_pod_num = 64 + cluster_name = "test-cdc" + cluster_desc = "test cluster desc" + cluster_max_service_num = 1024 + cluster_version = "1.30.0" + + cluster_os = "tlinux3.1x86_64" + cluster_level = "L20" + cluster_deploy_type = "INDEPENDENT_CLUSTER" + + container_runtime = "containerd" + runtime_version = "1.6.9" + pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw=" + exist_instance { + node_role = "MASTER_ETCD" + instances_para { + instance_ids = ["ins-eeijdk16", "ins-84ku5rba", "ins-8oa3im2s"] + } + } +} +``` + ## Argument Reference The following arguments are supported: From 6fdf35a4e6ca6883ba39c37dee8484b6d8563255 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Tue, 24 Sep 2024 14:20:01 +0800 Subject: [PATCH 13/16] feat(tke): cdc id --- .../tke/resource_tc_kubernetes_cluster.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md index a1342a1a7c..b824a30dfe 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md @@ -767,13 +767,13 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { event_persistence { enabled = true - log_set_id = "" # optional + log_set_id = "" # optional topic_id = "" # optional } cluster_audit { enabled = true - log_set_id = "" # optional + log_set_id = "" # optional topic_id = "" # optional } } @@ -782,28 +782,28 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { Create a CDC scenario cluster with ``` resource "tencentcloud_kubernetes_cluster" "cdc_cluster" { - cdc_id = "cluster-xxxxx" - vpc_id = "vpc-xxxxx" - cluster_cidr = "192.168.0.0/16" - cluster_max_pod_num = 64 - cluster_name = "test-cdc" - cluster_desc = "test cluster desc" - cluster_max_service_num = 1024 - cluster_version = "1.30.0" - - cluster_os = "tlinux3.1x86_64" - cluster_level = "L20" - cluster_deploy_type = "INDEPENDENT_CLUSTER" + cdc_id = "cluster-xxxxx" + vpc_id = "vpc-xxxxx" + cluster_cidr = "192.168.0.0/16" + cluster_max_pod_num = 64 + cluster_name = "test-cdc" + cluster_desc = "test cluster desc" + cluster_max_service_num = 1024 + cluster_version = "1.30.0" + + cluster_os = "tlinux3.1x86_64" + cluster_level = "L20" + cluster_deploy_type = "INDEPENDENT_CLUSTER" - container_runtime = "containerd" - runtime_version = "1.6.9" - pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw=" - exist_instance { - node_role = "MASTER_ETCD" - instances_para { - instance_ids = ["ins-eeijdk16", "ins-84ku5rba", "ins-8oa3im2s"] + container_runtime = "containerd" + runtime_version = "1.6.9" + pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw=" + exist_instance { + node_role = "MASTER_ETCD" + instances_para { + instance_ids = ["ins-eeijdk16", "ins-84ku5rba", "ins-8oa3im2s"] + } } - } } ``` From 65a7c6ad58391cf5370e9021a395a8bff325afdd Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Tue, 24 Sep 2024 15:54:34 +0800 Subject: [PATCH 14/16] feat(tke): cdc id --- tencentcloud/services/tke/resource_tc_kubernetes_cluster.md | 2 +- website/docs/r/kubernetes_cluster.html.markdown | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md index b824a30dfe..ee871b4dc1 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md +++ b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md @@ -779,7 +779,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { } ``` -Create a CDC scenario cluster with +Create a CDC scenario cluster ``` resource "tencentcloud_kubernetes_cluster" "cdc_cluster" { cdc_id = "cluster-xxxxx" diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 8c9849f2ea..8297ae6204 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -789,7 +789,7 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" { } ``` -### Create a CDC scenario cluster with +### Create a CDC scenario cluster ```hcl resource "tencentcloud_kubernetes_cluster" "cdc_cluster" { From 8e9f7a8b70129f7894be0f999e32590c50571522 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Wed, 25 Sep 2024 12:02:14 +0800 Subject: [PATCH 15/16] feat(tke): datasource support cdcid --- .../services/tke/data_source_tc_kubernetes_clusters.go | 9 +++++++++ website/docs/d/kubernetes_clusters.html.markdown | 1 + 2 files changed, 10 insertions(+) diff --git a/tencentcloud/services/tke/data_source_tc_kubernetes_clusters.go b/tencentcloud/services/tke/data_source_tc_kubernetes_clusters.go index c40135fd8b..958e8d075f 100644 --- a/tencentcloud/services/tke/data_source_tc_kubernetes_clusters.go +++ b/tencentcloud/services/tke/data_source_tc_kubernetes_clusters.go @@ -63,6 +63,11 @@ func DataSourceTencentCloudKubernetesClusters() *schema.Resource { Computed: true, Description: "Description of the cluster.", }, + "cdc_id": { + Type: schema.TypeString, + Computed: true, + Description: "CDC ID.", + }, "cluster_os": { Type: schema.TypeString, Computed: true, @@ -357,6 +362,10 @@ func dataSourceTencentCloudKubernetesClustersRead(d *schema.ResourceData, meta i clustersMap["cluster_desc"] = clusters.ClusterDescription } + if clusters.CdcId != nil { + clustersMap["cdc_id"] = clusters.CdcId + } + if clusters.ClusterOs != nil { clustersMap["cluster_os"] = clusters.ClusterOs } diff --git a/website/docs/d/kubernetes_clusters.html.markdown b/website/docs/d/kubernetes_clusters.html.markdown index dc0be94cd8..2637e2f600 100644 --- a/website/docs/d/kubernetes_clusters.html.markdown +++ b/website/docs/d/kubernetes_clusters.html.markdown @@ -38,6 +38,7 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: * `list` - An information list of kubernetes clusters. Each element contains the following attributes: + * `cdc_id` - CDC ID. * `certification_authority` - The certificate used for access. * `claim_expired_seconds` - The expired seconds to recycle ENI. * `cluster_as_enabled` - Indicates whether to enable cluster node auto scaler. From 88b75ffee4f108aa9cbd0dab2d02be7b56bd6277 Mon Sep 17 00:00:00 2001 From: andrewjiang Date: Wed, 25 Sep 2024 12:07:07 +0800 Subject: [PATCH 16/16] feat(tke): datasource support cdcid --- .changelog/2835.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.changelog/2835.txt b/.changelog/2835.txt index f311dbdc54..b3537f64ee 100644 --- a/.changelog/2835.txt +++ b/.changelog/2835.txt @@ -1,3 +1,4 @@ ```release-note:enhancement -resource/tencentcloud_kubernetes_cluster: support `cdc_id` and `pre_start_user_script` params +resource/tencentcloud_kubernetes_cluster: support `cdc_id` and `pre_start_user_script` parameter +datasource/tencentcloud_kubernetes_clusters: support `cdc_id` parameter ```