diff --git a/.changelog/2835.txt b/.changelog/2835.txt new file mode 100644 index 0000000000..b3537f64ee --- /dev/null +++ b/.changelog/2835.txt @@ -0,0 +1,4 @@ +```release-note:enhancement +resource/tencentcloud_kubernetes_cluster: support `cdc_id` and `pre_start_user_script` parameter +datasource/tencentcloud_kubernetes_clusters: support `cdc_id` parameter +``` diff --git a/go.mod b/go.mod index 72be69c12a..7eba3ed95f 100644 --- a/go.mod +++ b/go.mod @@ -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.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 d380ce0e25..c2561b0fa5 100644 --- a/go.sum +++ b/go.sum @@ -1038,8 +1038,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.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/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/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.go index ef1b8629b3..c536428610 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" @@ -1215,6 +1216,13 @@ func ResourceTencentCloudKubernetesCluster() *schema.Resource { DiffSuppressFunc: dockerGraphPathDiffSuppressFunc, }, + "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.", + }, + "extra_args": { Type: schema.TypeList, Optional: true, @@ -1287,6 +1295,12 @@ func ResourceTencentCloudKubernetesCluster() *schema.Resource { Type: schema.TypeString, }, }, + + "cdc_id": { + Type: schema.TypeString, + Optional: true, + Description: "CDC ID.", + }, }, } } @@ -1307,6 +1321,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 +1514,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 +1703,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/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md b/tencentcloud/services/tke/resource_tc_kubernetes_cluster.md index 42c803a191..ee871b4dc1 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 a CDC scenario cluster +``` +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. diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go b/tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go index 3794833562..6500ab7bde 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.PreStartUserScript = preStartUserScript.(string) + } + // ExistedInstancesForNode existInstances := make([]*tke.ExistedInstancesForNode, 0) if instances, ok := d.GetOk("exist_instance"); ok { @@ -296,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 { @@ -311,7 +321,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) 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" 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 { 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..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{}, @@ -8450,6 +8568,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 +13068,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/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 7d21bc5b7c..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 @@ -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 { @@ -5506,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 @@ -9898,9 +9974,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"` } @@ -10159,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列表 @@ -10224,6 +10398,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 +16882,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 +17719,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,表示取不到有效值。 @@ -17447,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 a941493a34..cf57adb151 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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.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/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. diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index dfb72dede9..8297ae6204 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 + +```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: @@ -798,6 +827,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. @@ -841,6 +871,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.