Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tke): [132131249] tencentcloud_kubernetes_cluster update code #3066

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3066.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_cluster: update code
```
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

func customResourceImporter(ctx context.Context, d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
importClsFlag = true
err := resourceTencentCloudKubernetesClusterRead(d, m)

Check failure on line 33 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: resourceTencentCloudKubernetesClusterRead (typecheck)
if err != nil {
return nil, fmt.Errorf("failed to import resource")
}
Expand All @@ -42,12 +42,12 @@
meta := tccommon.ProviderMetaFromContext(ctx)

var (
basic ClusterBasicSetting

Check failure on line 45 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: ClusterBasicSetting (typecheck)
advanced ClusterAdvancedSettings

Check failure on line 46 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: ClusterAdvancedSettings (typecheck)
cvms RunInstancesForNode

Check failure on line 47 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: RunInstancesForNode (typecheck)
iAdvanced InstanceAdvancedSettings

Check failure on line 48 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: InstanceAdvancedSettings (typecheck)
iDiskMountSettings []*tke.InstanceDataDiskMountSetting
cidrSet ClusterCidrSettings

Check failure on line 50 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: ClusterCidrSettings (typecheck)
clusterInternet = d.Get("cluster_internet").(bool)
clusterIntranet = d.Get("cluster_intranet").(bool)
intranetSubnetId = d.Get("cluster_intranet_subnet_id").(string)
Expand Down Expand Up @@ -75,13 +75,13 @@

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

if v, ok := tkeClusterOsMap[cluster_os]; ok {

Check failure on line 78 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: tkeClusterOsMap (typecheck)
basic.ClusterOs = v
} else {
basic.ClusterOs = cluster_os
}

if tkeClusterOsMap[cluster_os] != "" {

Check failure on line 84 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: tkeClusterOsMap (typecheck)
basic.ClusterOs = tkeClusterOsMap[cluster_os]
} else {
basic.ClusterOs = cluster_os
Expand Down Expand Up @@ -500,7 +500,7 @@
}

if _, ok := d.GetOk("auth_options"); ok {
request := tkeGetAuthOptions(d)
request := tkeGetAuthOptions(d, id)
if err := service.ModifyClusterAuthenticationOptions(ctx, request); err != nil {
return err
}
Expand Down Expand Up @@ -1397,7 +1397,7 @@
id := d.Id()

if d.HasChange("auth_options") {
request := tkeGetAuthOptions(d)
request := tkeGetAuthOptions(d, id)
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
inErr := tkeService.ModifyClusterAuthenticationOptions(ctx, request)
if inErr != nil {
Expand Down Expand Up @@ -1690,7 +1690,7 @@
}

// upgradeClusterInstances upgrade instances, upgrade type try seq:major, hot.
func upgradeClusterInstances(tkeService TkeService, ctx context.Context, id string) error {

Check failure on line 1693 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: TkeService (typecheck)
// get all available instances for upgrade
upgradeType := "major"
instanceIds, err := tkeService.CheckInstancesUpgradeAble(ctx, id, upgradeType)
Expand Down Expand Up @@ -2275,12 +2275,12 @@
return request
}

func tkeGetAuthOptions(d *schema.ResourceData) *tke.ModifyClusterAuthenticationOptionsRequest {
func tkeGetAuthOptions(d *schema.ResourceData, clusterId string) *tke.ModifyClusterAuthenticationOptionsRequest {
raw, ok := d.GetOk("auth_options")
options := raw.([]interface{})

request := tke.NewModifyClusterAuthenticationOptionsRequest()
request.ClusterId = helper.String(d.Id())
request.ClusterId = helper.String(clusterId)
request.ServiceAccounts = &tke.ServiceAccountAuthenticationOptions{
AutoCreateDiscoveryAnonymousAuth: helper.Bool(false),
}
Expand Down Expand Up @@ -2311,7 +2311,7 @@
return request
}

func checkClusterEndpointStatus(ctx context.Context, service *TkeService, d *schema.ResourceData, isInternet bool) (err error) {

Check failure on line 2314 in tencentcloud/services/tke/resource_tc_kubernetes_cluster_extension.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: TkeService (typecheck)
var status, config string
var response tke.DescribeClusterEndpointsResponseParams
var isOpened bool
Expand Down
Loading