From 71cc77af9f596424bcf823ad565271cafd9666a5 Mon Sep 17 00:00:00 2001 From: "Muneeb H. Jan" Date: Wed, 18 Dec 2024 13:10:00 +0100 Subject: [PATCH 1/6] [Chore] Update go mod --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2c1c03ccb..f28cfc8e5 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/jmespath/go-jmespath v0.4.0 github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4 github.com/mitchellh/go-homedir v1.1.0 - github.com/opentelekomcloud/gophertelekomcloud v0.9.4-0.20241216095705-f4669448c474 + github.com/opentelekomcloud/gophertelekomcloud v0.9.4-0.20241217130728-c35f3bd67003 github.com/unknwon/com v1.0.1 golang.org/x/crypto v0.31.0 golang.org/x/sync v0.10.0 diff --git a/go.sum b/go.sum index 13a3bbad1..f1797b5b3 100644 --- a/go.sum +++ b/go.sum @@ -156,8 +156,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/opentelekomcloud/gophertelekomcloud v0.9.4-0.20241216095705-f4669448c474 h1:ostsbG++ZcDj+lut7axnbonRAdRDs9/fpZBVOZC5FdQ= -github.com/opentelekomcloud/gophertelekomcloud v0.9.4-0.20241216095705-f4669448c474/go.mod h1:la8cQVYopRoEbNe2L7HlGTdLxUQOwIqHp1VHtjE/5qA= +github.com/opentelekomcloud/gophertelekomcloud v0.9.4-0.20241217130728-c35f3bd67003 h1:yZzN1AJUxA1fpFZSsgokbCfBWS+/McwRSlc56A2oqjU= +github.com/opentelekomcloud/gophertelekomcloud v0.9.4-0.20241217130728-c35f3bd67003/go.mod h1:la8cQVYopRoEbNe2L7HlGTdLxUQOwIqHp1VHtjE/5qA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= From bb4777812c0be5ddfd0deff52a7045e0850796d0 Mon Sep 17 00:00:00 2001 From: "Muneeb H. Jan" Date: Wed, 18 Dec 2024 14:30:45 +0100 Subject: [PATCH 2/6] [Refactor] Refactor accoring to changes in Gopher --- ...rce_opentelekomcloud_cce_addon_template_v3.go | 4 ++-- ...ce_opentelekomcloud_cce_addon_templates_v3.go | 4 ++-- .../resource_opentelekomcloud_cce_addon_v3.go | 14 +++++++------- .../resource_opentelekomcloud_cce_cluster_v3.go | 16 ++++++++-------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_template_v3.go b/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_template_v3.go index b5d40a5d7..15637624e 100644 --- a/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_template_v3.go +++ b/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_template_v3.go @@ -63,7 +63,7 @@ func dataSourceCceAddonTemplateV3Read(_ context.Context, d *schema.ResourceData, return fmterr.Errorf(cceClientError, err) } - addonTemplates, err := addons.GetTemplates(client).Extract() + addonTemplates, err := addons.GetTemplates(client) if err != nil { return fmterr.Errorf("unable to retrieve templates: %s", err) } @@ -96,7 +96,7 @@ func dataSourceCceAddonTemplateV3Read(_ context.Context, d *schema.ResourceData, log.Printf("[DEBUG] Retrieved Template using given filter: %s", template.Metadata.Id) d.SetId(template.Metadata.Id) - inputData := result.Input["basic"].(map[string]interface{}) + inputData := result.Input.Basic mErr := multierror.Append( d.Set("cluster_ip", inputData["cluster_ip"]), d.Set("image_version", inputData["image_version"]), diff --git a/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_templates_v3.go b/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_templates_v3.go index 3b74392c6..57a70bc95 100644 --- a/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_templates_v3.go +++ b/opentelekomcloud/services/cce/data_source_opentelekomcloud_cce_addon_templates_v3.go @@ -96,7 +96,7 @@ func dataSourceCceAddonTemplatesV3Read(_ context.Context, d *schema.ResourceData return fmterr.Errorf(cceClientError, err) } - addonTemplates, err := addons.GetTemplates(client).Extract() + addonTemplates, err := addons.GetTemplates(client) if err != nil { return fmterr.Errorf("unable to retrieve templates: %s", err) } @@ -141,7 +141,7 @@ func dataSourceCceAddonTemplatesV3Read(_ context.Context, d *schema.ResourceData result := make([]map[string]interface{}, len(templates)) for i, item := range templates { - inputData := item.Input["basic"].(map[string]interface{}) + inputData := item.Input.Basic addon := map[string]interface{}{ "addon_version": item.Version, "cluster_ip": inputData["cluster_ip"], diff --git a/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_addon_v3.go b/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_addon_v3.go index c81c4178d..d8a4adb2c 100644 --- a/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_addon_v3.go +++ b/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_addon_v3.go @@ -129,7 +129,7 @@ func resourceCCEAddonV3Create(ctx context.Context, d *schema.ResourceData, meta Flavor: flavor, }, }, - }, clusterID).Extract() + }, clusterID) if err != nil { errMsg := logHttpError(err) @@ -171,7 +171,7 @@ func resourceCCEAddonV3Read(ctx context.Context, d *schema.ResourceData, meta in } clusterID := d.Get("cluster_id").(string) - addon, err := addons.Get(client, d.Id(), clusterID).Extract() + addon, err := addons.Get(client, d.Id(), clusterID) if err != nil { if _, ok := err.(golangsdk.ErrDefault404); ok { d.SetId("") @@ -228,7 +228,7 @@ func resourceCCEAddonV3Delete(ctx context.Context, d *schema.ResourceData, meta clusterID := d.Get("cluster_id").(string) - if err := addons.Delete(client, d.Id(), clusterID).ExtractErr(); err != nil { + if err := addons.Delete(client, d.Id(), clusterID); err != nil { return fmterr.Errorf("error deleting CCE addon : %w", err) } @@ -250,7 +250,7 @@ func resourceCCEAddonV3Delete(ctx context.Context, d *schema.ResourceData, meta } func getAddonTemplateSpec(client *golangsdk.ServiceClient, clusterID, templateName string) (string, error) { - templates, err := addons.ListTemplates(client, clusterID, addons.ListOpts{Name: templateName}).Extract() + templates, err := addons.ListTemplates(client, clusterID, addons.ListOpts{Name: templateName}) if err != nil { return "", err } @@ -300,7 +300,7 @@ func unStringMap(src map[string]interface{}) map[string]interface{} { func waitForCCEAddonDelete(client *golangsdk.ServiceClient, addonID, clusterID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - addon, err := addons.Get(client, addonID, clusterID).Extract() + addon, err := addons.Get(client, addonID, clusterID) if err != nil { if _, ok := err.(golangsdk.ErrDefault404); ok { return addon, "deleted", nil @@ -328,7 +328,7 @@ func resourceCCEAddonV3Import(_ context.Context, d *schema.ResourceData, meta in return nil, fmt.Errorf("error creating CCE client: %w", logHttpError(err)) } - addon, err := addons.Get(client, d.Id(), clusterID).Extract() + addon, err := addons.Get(client, d.Id(), clusterID) if err != nil { if _, ok := err.(golangsdk.ErrDefault404); ok { d.SetId("") @@ -355,7 +355,7 @@ func resourceCCEAddonV3Import(_ context.Context, d *schema.ResourceData, meta in func waitForCCEAddonActive(cceAddonClient *golangsdk.ServiceClient, id, clusterID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - n, err := addons.Get(cceAddonClient, id, clusterID).Extract() + n, err := addons.Get(cceAddonClient, id, clusterID) if err != nil { return nil, "", err } diff --git a/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_cluster_v3.go b/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_cluster_v3.go index 59dc1d2a5..6c3e1f593 100644 --- a/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_cluster_v3.go +++ b/opentelekomcloud/services/cce/resource_opentelekomcloud_cce_cluster_v3.go @@ -590,7 +590,7 @@ func resourceCCEClusterV3Read(ctx context.Context, d *schema.ResourceData, meta } installedAddons := make([]string, len(instances.Items)) for i, instance := range instances.Items { - installedAddons[i] = instance.Metadata.ID + installedAddons[i] = instance.Metadata.Id } if err := d.Set("installed_addons", installedAddons); err != nil { return fmterr.Errorf("error setting installed addons: %w", err) @@ -844,7 +844,7 @@ func listInstalledAddons(d *schema.ResourceData, config *cfg.Config) (*addons.Ad if err != nil { return nil, fmt.Errorf("error creating CCE Addon client: %w", logHttpError(err)) } - return addons.ListAddonInstances(client, d.Id()).Extract() + return addons.ListAddonInstances(client, d.Id()) } func waitForInstalledAddons(ctx context.Context, d *schema.ResourceData, config *cfg.Config) error { @@ -875,12 +875,12 @@ func removeAddons(ctx context.Context, d *schema.ResourceData, config *cfg.Confi return fmt.Errorf("error creating CCE Addon client: %w", logHttpError(err)) } - instances, err := addons.ListAddonInstances(client, d.Id()).Extract() + instances, err := addons.ListAddonInstances(client, d.Id()) if err != nil { return fmt.Errorf("error listing cluster addons: %w", err) } for _, addon := range instances.Items { - addonID := addon.Metadata.ID + addonID := addon.Metadata.Id stateConfAddonReady := &resource.StateChangeConf{ Pending: []string{"installing"}, Target: []string{"running", "available", "abnormal"}, @@ -895,8 +895,8 @@ func removeAddons(ctx context.Context, d *schema.ResourceData, config *cfg.Confi } for _, instance := range instances.Items { - addonID := instance.Metadata.ID - if err := addons.Delete(client, addonID, d.Id()).ExtractErr(); err != nil { + addonID := instance.Metadata.Id + if err := addons.Delete(client, addonID, d.Id()); err != nil { return fmt.Errorf("error deleting cluster addon %s/%s: %w", d.Id(), addonID, err) } } @@ -919,7 +919,7 @@ func removeAddons(ctx context.Context, d *schema.ResourceData, config *cfg.Confi func waitForCCEClusterAddonsState(client *golangsdk.ServiceClient, clusterID string) resource.StateRefreshFunc { return func() (r interface{}, s string, err error) { - instances, err := addons.ListAddonInstances(client, clusterID).Extract() + instances, err := addons.ListAddonInstances(client, clusterID) if err != nil { return nil, "", fmt.Errorf("error listing cluster addons: %w", err) } @@ -932,7 +932,7 @@ func waitForCCEClusterAddonsState(client *golangsdk.ServiceClient, clusterID str func waitForCCEClusterAddonActive(client *golangsdk.ServiceClient, id, clusterID string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - n, err := addons.Get(client, id, clusterID).Extract() + n, err := addons.Get(client, id, clusterID) if err != nil { return nil, "", err } From e3dc645f5a084976e510cf880de2bae487111722 Mon Sep 17 00:00:00 2001 From: "Muneeb H. Jan" Date: Thu, 19 Dec 2024 12:07:21 +0100 Subject: [PATCH 3/6] [Test] Use resource check funtion --- ...urce_opentelekomcloud_cce_addon_v3_test.go | 105 +++++++++--------- 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go b/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go index dd70f31d0..c1e3e21c3 100644 --- a/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go +++ b/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go @@ -16,7 +16,22 @@ import ( const resourceAddonName = "opentelekomcloud_cce_addon_v3.autoscaler" const resourceAddonNameDns = "opentelekomcloud_cce_addon_v3.coredns" +func getCceAddonResourceFunc(cfg *cfg.Config, state *terraform.ResourceState) (interface{}, error) { + client, err := cfg.CceV3AddonClient(env.OS_REGION_NAME) + if err != nil { + return nil, fmt.Errorf("error creating CCE v3 Addon Client: %s", err) + } + return addons.Get(client, state.Primary.ID, state.Primary.Attributes["cluster_id"]) +} + func TestAccCCEAddonV3Basic(t *testing.T) { + var addon addons.Addon + rc := common.InitResourceCheck( + resourceAddonName, + &addon, + getCceAddonResourceFunc, + ) + clusterName := randClusterName() t.Parallel() quotas.BookOne(t, quotas.CCEClusterQuota) @@ -24,7 +39,7 @@ func TestAccCCEAddonV3Basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { common.TestAccPreCheck(t) }, ProviderFactories: common.TestAccProviderFactories, - CheckDestroy: testAccCheckCCEAddonV3Destroy, + CheckDestroy: rc.CheckResourceDestroy(), Steps: []resource.TestStep{ { Config: testAccCCEAddonV3Basic(clusterName), @@ -40,23 +55,6 @@ func TestAccCCEAddonV3Basic(t *testing.T) { resource.TestCheckResourceAttr(resourceAddonName, "values.0.custom.scaleDownDelayAfterDelete", "8"), ), }, - }, - }) -} - -func TestAccCCEAddonV3ImportBasic(t *testing.T) { - t.Parallel() - clusterName := randClusterName() - quotas.BookOne(t, quotas.CCEClusterQuota) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { common.TestAccPreCheck(t) }, - ProviderFactories: common.TestAccProviderFactories, - CheckDestroy: testAccCheckCCEAddonV3Destroy, - Steps: []resource.TestStep{ - { - Config: testAccCCEAddonV3Basic(clusterName), - }, { ResourceName: resourceAddonName, ImportState: true, @@ -70,25 +68,13 @@ func TestAccCCEAddonV3ImportBasic(t *testing.T) { }) } -func testAccCCEAddonV3ImportStateIdFunc() resource.ImportStateIdFunc { - return func(s *terraform.State) (string, error) { - var clusterID string - var addonID string - for _, rs := range s.RootModule().Resources { - if rs.Type == "opentelekomcloud_cce_cluster_v3" { - clusterID = rs.Primary.ID - } else if rs.Type == "opentelekomcloud_cce_addon_v3" { - addonID = rs.Primary.ID - } - } - if clusterID == "" || addonID == "" { - return "", fmt.Errorf("resource not found: %s/%s", clusterID, addonID) - } - return fmt.Sprintf("%s/%s", clusterID, addonID), nil - } -} - func TestAccCCEAddonV3ForceNewCCE(t *testing.T) { + var addon addons.Addon + rc := common.InitResourceCheck( + resourceAddonName, + &addon, + getCceAddonResourceFunc, + ) clusterName := randClusterName() t.Parallel() quotas.BookOne(t, quotas.CCEClusterQuota) @@ -96,7 +82,7 @@ func TestAccCCEAddonV3ForceNewCCE(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { common.TestAccPreCheck(t) }, ProviderFactories: common.TestAccProviderFactories, - CheckDestroy: testAccCheckCCEAddonV3Destroy, + CheckDestroy: rc.CheckResourceDestroy(), Steps: []resource.TestStep{ { Config: testAccCCEAddonV3Basic(clusterName), @@ -117,6 +103,12 @@ func TestAccCCEAddonV3ForceNewCCE(t *testing.T) { } func TestAccCCEAddonV3CoreDNS(t *testing.T) { + var addon addons.Addon + rc := common.InitResourceCheck( + resourceAddonNameDns, + &addon, + getCceAddonResourceFunc, + ) clusterName := randClusterName() t.Parallel() quotas.BookOne(t, quotas.CCEClusterQuota) @@ -124,7 +116,7 @@ func TestAccCCEAddonV3CoreDNS(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { common.TestAccPreCheck(t) }, ProviderFactories: common.TestAccProviderFactories, - CheckDestroy: testAccCheckCCEAddonV3Destroy, + CheckDestroy: rc.CheckResourceDestroy(), Steps: []resource.TestStep{ { Config: testAccCCEAddonV3StubDomains(clusterName), @@ -140,6 +132,12 @@ const flavorRef = " {\n \"description\": \"Has only one instance\",\ const flavorRefUpdate = " {\n \"description\": \"Has only one instance\",\n \"name\": \"Single\",\n \"replicas\": 1,\n \"resources\": [\n {\n \"limitsCpu\": \"8000m\",\n \"limitsMem\": \"4Gi\",\n \"name\": \"autoscaler\",\n \"requestsCpu\": \"4000m\",\n \"requestsMem\": \"2Gi\"\n }\n ]\n }\n" func TestAccCCEAddonV3Flavor(t *testing.T) { + var addon addons.Addon + rc := common.InitResourceCheck( + resourceAddonName, + &addon, + getCceAddonResourceFunc, + ) clusterName := randClusterName() t.Parallel() quotas.BookOne(t, quotas.CCEClusterQuota) @@ -147,7 +145,7 @@ func TestAccCCEAddonV3Flavor(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { common.TestAccPreCheck(t) }, ProviderFactories: common.TestAccProviderFactories, - CheckDestroy: testAccCheckCCEAddonV3Destroy, + CheckDestroy: rc.CheckResourceDestroy(), Steps: []resource.TestStep{ { Config: testAccCCEAddonV3Flavor(clusterName), @@ -167,25 +165,22 @@ func TestAccCCEAddonV3Flavor(t *testing.T) { }) } -func testAccCheckCCEAddonV3Destroy(s *terraform.State) error { - config := common.TestAccProvider.Meta().(*cfg.Config) - client, err := config.CceV3Client(env.OS_REGION_NAME) - if err != nil { - return fmt.Errorf("error creating OpenTelekomCloud CCEv3 client: %w", err) - } - +func testAccCCEAddonV3ImportStateIdFunc() resource.ImportStateIdFunc { + return func(s *terraform.State) (string, error) { + var clusterID string + var addonID string for _, rs := range s.RootModule().Resources { - if rs.Type != "opentelekomcloud_cce_addon_v3" { - continue + if rs.Type == "opentelekomcloud_cce_cluster_v3" { + clusterID = rs.Primary.ID + } else if rs.Type == "opentelekomcloud_cce_addon_v3" { + addonID = rs.Primary.ID + } } - - _, err := addons.Get(client, rs.Primary.ID, rs.Primary.Attributes["cluster_id"]).Extract() - if err == nil { - return fmt.Errorf("addon still exists") + if clusterID == "" || addonID == "" { + return "", fmt.Errorf("resource not found: %s/%s", clusterID, addonID) } + return fmt.Sprintf("%s/%s", clusterID, addonID), nil } - - return nil } func checkScaleDownForAutoscaler(name string, enabled bool) resource.TestCheckFunc { @@ -205,7 +200,7 @@ func checkScaleDownForAutoscaler(name string, enabled bool) resource.TestCheckFu return fmt.Errorf("error creating opentelekomcloud CCE client: %w", err) } - found, err := addons.Get(client, rs.Primary.ID, rs.Primary.Attributes["cluster_id"]).Extract() + found, err := addons.Get(client, rs.Primary.ID, rs.Primary.Attributes["cluster_id"]) if err != nil { return err } From 082dfc5d4ebff8572a2e352e910579e2e5d8f2e2 Mon Sep 17 00:00:00 2001 From: "Muneeb H. Jan" Date: Thu, 19 Dec 2024 12:16:18 +0100 Subject: [PATCH 4/6] [Test] Update addons config and versions --- ...urce_opentelekomcloud_cce_addon_v3_test.go | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go b/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go index c1e3e21c3..4285aaefa 100644 --- a/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go +++ b/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go @@ -169,7 +169,7 @@ func testAccCCEAddonV3ImportStateIdFunc() resource.ImportStateIdFunc { return func(s *terraform.State) (string, error) { var clusterID string var addonID string - for _, rs := range s.RootModule().Resources { + for _, rs := range s.RootModule().Resources { if rs.Type == "opentelekomcloud_cce_cluster_v3" { clusterID = rs.Primary.ID } else if rs.Type == "opentelekomcloud_cce_addon_v3" { @@ -228,21 +228,21 @@ resource opentelekomcloud_cce_cluster_v3 cluster_1 { flavor_id = "cce.s1.small" vpc_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id subnet_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id - cluster_version = "v1.27" + cluster_version = "v1.29" container_network_type = "overlay_l2" kubernetes_svc_ip_range = "10.247.0.0/16" } resource "opentelekomcloud_cce_addon_v3" "autoscaler" { template_name = "autoscaler" - template_version = "1.27.53" + template_version = "1.29.17" cluster_id = opentelekomcloud_cce_cluster_v3.cluster_1.id values { basic = { "cceEndpoint" : "https://cce.eu-de.otc.t-systems.com", "ecsEndpoint" : "https://ecs.eu-de.otc.t-systems.com", - "image_version" : "1.27.53", + "image_version" : "1.29.17", "region" : "eu-de", "swr_addr" : "100.125.7.25:20202", "swr_user" : "cce-addons" @@ -301,21 +301,21 @@ resource opentelekomcloud_cce_cluster_v3 cluster_1 { flavor_id = "cce.s1.small" vpc_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id subnet_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id - cluster_version = "v1.27" + cluster_version = "v1.29" container_network_type = "overlay_l2" kubernetes_svc_ip_range = "10.247.0.0/16" } resource "opentelekomcloud_cce_addon_v3" "autoscaler" { template_name = "autoscaler" - template_version = "1.27.53" + template_version = "1.29.17" cluster_id = opentelekomcloud_cce_cluster_v3.cluster_1.id values { basic = { "cceEndpoint" : "https://cce.eu-de.otc.t-systems.com", "ecsEndpoint" : "https://ecs.eu-de.otc.t-systems.com", - "image_version" : "1.27.53", + "image_version" : "1.29.17", "region" : "eu-de", "swr_addr" : "100.125.7.25:20202", "swr_user" : "cce-addons" @@ -374,21 +374,21 @@ resource opentelekomcloud_cce_cluster_v3 cluster_1 { flavor_id = "cce.s1.medium" vpc_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id subnet_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id - cluster_version = "v1.19" + cluster_version = "v1.29" container_network_type = "overlay_l2" kubernetes_svc_ip_range = "10.247.0.0/16" } resource "opentelekomcloud_cce_addon_v3" "autoscaler" { template_name = "autoscaler" - template_version = "1.19.1" + template_version = "1.29.17" cluster_id = opentelekomcloud_cce_cluster_v3.cluster_1.id values { basic = { "cceEndpoint" : "https://cce.eu-de.otc.t-systems.com", "ecsEndpoint" : "https://ecs.eu-de.otc.t-systems.com", - "image_version" : "1.19.1", + "image_version" : "1.29.17", "platform" : "linux-amd64", "region" : "eu-de", "swr_addr" : "100.125.7.25:20202", @@ -443,7 +443,7 @@ resource opentelekomcloud_cce_cluster_v3 cluster_1 { flavor_id = "cce.s1.medium" vpc_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id subnet_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id - cluster_version = "v1.23" + cluster_version = "v1.29" container_network_type = "overlay_l2" kubernetes_svc_ip_range = "10.247.0.0/16" no_addons = true @@ -451,13 +451,15 @@ resource opentelekomcloud_cce_cluster_v3 cluster_1 { resource "opentelekomcloud_cce_addon_v3" "coredns" { template_name = "coredns" - template_version = "1.28.4" + template_version = "1.29.4" cluster_id = opentelekomcloud_cce_cluster_v3.cluster_1.id values { basic = { + "cluster_ip": "10.247.3.10", + "image_version": "1.29.4", "swr_addr" : "100.125.7.25:20202", - "swr_user" : "hwofficial" + "swr_user" : "cce-addons" } custom = { "stub_domains" : "{\"test\":[\"10.10.40.10\"], \"test2\":[\"10.10.40.20\"]}" @@ -479,21 +481,21 @@ resource opentelekomcloud_cce_cluster_v3 cluster_1 { flavor_id = "cce.s1.small" vpc_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id subnet_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id - cluster_version = "v1.27" + cluster_version = "v1.29" container_network_type = "overlay_l2" kubernetes_svc_ip_range = "10.247.0.0/16" } resource "opentelekomcloud_cce_addon_v3" "autoscaler" { template_name = "autoscaler" - template_version = "1.27.53" + template_version = "1.29.17" cluster_id = opentelekomcloud_cce_cluster_v3.cluster_1.id values { basic = { "cceEndpoint" : "https://cce.eu-de.otc.t-systems.com", "ecsEndpoint" : "https://ecs.eu-de.otc.t-systems.com", - "image_version" : "1.27.53", + "image_version" : "1.29.17", "region" : "eu-de", "swr_addr" : "100.125.7.25:20202", "swr_user" : "cce-addons" @@ -552,21 +554,21 @@ resource opentelekomcloud_cce_cluster_v3 cluster_1 { flavor_id = "cce.s1.small" vpc_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id subnet_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id - cluster_version = "v1.27" + cluster_version = "v1.29" container_network_type = "overlay_l2" kubernetes_svc_ip_range = "10.247.0.0/16" } resource "opentelekomcloud_cce_addon_v3" "autoscaler" { template_name = "autoscaler" - template_version = "1.27.53" + template_version = "1.29.17" cluster_id = opentelekomcloud_cce_cluster_v3.cluster_1.id values { basic = { "cceEndpoint" : "https://cce.eu-de.otc.t-systems.com", "ecsEndpoint" : "https://ecs.eu-de.otc.t-systems.com", - "image_version" : "1.27.53", + "image_version" : "1.29.17", "region" : "eu-de", "swr_addr" : "100.125.7.25:20202", "swr_user" : "cce-addons" From 8458f00f1f9d3e1e2cd89e83748c1c8a6cef87c9 Mon Sep 17 00:00:00 2001 From: "Muneeb H. Jan" Date: Thu, 19 Dec 2024 14:09:52 +0100 Subject: [PATCH 5/6] [Style] TF lint fix --- .../cce/resource_opentelekomcloud_cce_addon_v3_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go b/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go index 4285aaefa..5a1970208 100644 --- a/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go +++ b/opentelekomcloud/acceptance/cce/resource_opentelekomcloud_cce_addon_v3_test.go @@ -456,8 +456,8 @@ resource "opentelekomcloud_cce_addon_v3" "coredns" { values { basic = { - "cluster_ip": "10.247.3.10", - "image_version": "1.29.4", + "cluster_ip" : "10.247.3.10", + "image_version" : "1.29.4", "swr_addr" : "100.125.7.25:20202", "swr_user" : "cce-addons" } From 9e94bc80f600d70a0d0b67a1b9f9098322b686d5 Mon Sep 17 00:00:00 2001 From: "Muneeb H. Jan" Date: Thu, 19 Dec 2024 14:11:36 +0100 Subject: [PATCH 6/6] [Doc] Add releasenote cce-refactor-addons --- releasenotes/notes/cce-refactor-addons-74add546147c8f42.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 releasenotes/notes/cce-refactor-addons-74add546147c8f42.yaml diff --git a/releasenotes/notes/cce-refactor-addons-74add546147c8f42.yaml b/releasenotes/notes/cce-refactor-addons-74add546147c8f42.yaml new file mode 100644 index 000000000..b02c9f279 --- /dev/null +++ b/releasenotes/notes/cce-refactor-addons-74add546147c8f42.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + **[CCE]** Refactor v3 addons tests and fixed to match changes in gopher (`#2770 `_)