From ba22351c4312b6e291225788e180693bd48452fb Mon Sep 17 00:00:00 2001 From: Laura Seidler Date: Mon, 24 Jul 2023 22:11:57 +0200 Subject: [PATCH 1/3] fix: update dead links for moved files --- autogen/main/cluster.tf.tmpl | 4 ++-- modules/beta-private-cluster-update-variant/cluster.tf | 4 ++-- modules/beta-public-cluster-update-variant/cluster.tf | 4 ++-- modules/private-cluster-update-variant/cluster.tf | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 714b90fb8e..401c7dc9eb 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -587,8 +587,8 @@ locals { # This keepers list is based on the terraform google provider schemaNodeConfig # resources where "ForceNew" is "true". schemaNodeConfig can be found in resource_container_node_pool.go at -# https://github.com/hashicorp/terraform-provider-google/blob/main/google/resource_container_node_pool.go and node_config.go at -# https://github.com/terraform-providers/terraform-provider-google/blob/main/google/node_config.go +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/resource_container_node_pool.go and node_config.go at +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/node_config.go resource "random_id" "name" { for_each = merge(local.node_pools, local.windows_node_pools) byte_length = 2 diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 29770ab8f6..3e72471328 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -502,8 +502,8 @@ locals { # This keepers list is based on the terraform google provider schemaNodeConfig # resources where "ForceNew" is "true". schemaNodeConfig can be found in resource_container_node_pool.go at -# https://github.com/hashicorp/terraform-provider-google/blob/main/google/resource_container_node_pool.go and node_config.go at -# https://github.com/terraform-providers/terraform-provider-google/blob/main/google/node_config.go +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/resource_container_node_pool.go and node_config.go at +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/node_config.go resource "random_id" "name" { for_each = merge(local.node_pools, local.windows_node_pools) byte_length = 2 diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index d35a15d495..9165c5dfe1 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -483,8 +483,8 @@ locals { # This keepers list is based on the terraform google provider schemaNodeConfig # resources where "ForceNew" is "true". schemaNodeConfig can be found in resource_container_node_pool.go at -# https://github.com/hashicorp/terraform-provider-google/blob/main/google/resource_container_node_pool.go and node_config.go at -# https://github.com/terraform-providers/terraform-provider-google/blob/main/google/node_config.go +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/resource_container_node_pool.go and node_config.go at +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/node_config.go resource "random_id" "name" { for_each = merge(local.node_pools, local.windows_node_pools) byte_length = 2 diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 191c99ec50..7a3e86a4cc 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -429,8 +429,8 @@ locals { # This keepers list is based on the terraform google provider schemaNodeConfig # resources where "ForceNew" is "true". schemaNodeConfig can be found in resource_container_node_pool.go at -# https://github.com/hashicorp/terraform-provider-google/blob/main/google/resource_container_node_pool.go and node_config.go at -# https://github.com/terraform-providers/terraform-provider-google/blob/main/google/node_config.go +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/resource_container_node_pool.go and node_config.go at +# https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/container/node_config.go resource "random_id" "name" { for_each = merge(local.node_pools, local.windows_node_pools) byte_length = 2 From 67d97646ea25d1f1aa63c49952f2064a6b0cc92a Mon Sep 17 00:00:00 2001 From: Laura Seidler Date: Mon, 24 Jul 2023 22:23:52 +0200 Subject: [PATCH 2/3] feat!: align keepers with `ForceNew: true` fields Will cause node pools to be re-created on update, unless remote state of the `random_id` resources is manually modified to reflect the new keepers. Fixes #1695 --- autogen/main/cluster.tf.tmpl | 25 +++---------------- .../cluster.tf | 25 +++---------------- .../cluster.tf | 25 +++---------------- .../private-cluster-update-variant/cluster.tf | 25 +++---------------- 4 files changed, 12 insertions(+), 88 deletions(-) diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 401c7dc9eb..852aa825b1 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -569,10 +569,12 @@ locals { "disk_type", "accelerator_count", "accelerator_type", + "gpu_partition_size", "enable_secure_boot", "enable_integrity_monitoring", "local_ssd_count", "machine_type", + "placement_policy", "max_pods_per_node", "min_cpu_platform", "pod_range", @@ -582,6 +584,7 @@ locals { "enable_gcfs", "enable_gvnic", "enable_secure_boot", + "boot_disk_kms_key", ] } @@ -598,18 +601,6 @@ resource "random_id" "name" { local.force_node_pool_recreation_resources, [for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")] ), - { - labels = join(",", - sort( - concat( - keys(local.node_pools_labels["all"]), - values(local.node_pools_labels["all"]), - keys(local.node_pools_labels[each.value["name"]]), - values(local.node_pools_labels[each.value["name"]]) - ) - ) - ) - }, { taints = join(",", sort( @@ -643,16 +634,6 @@ resource "random_id" "name" { ) ) ) - }, - { - tags = join(",", - sort( - concat( - local.node_pools_tags["all"], - local.node_pools_tags[each.value["name"]] - ) - ) - ) } ) } diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 3e72471328..1fa4004639 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -484,10 +484,12 @@ locals { "disk_type", "accelerator_count", "accelerator_type", + "gpu_partition_size", "enable_secure_boot", "enable_integrity_monitoring", "local_ssd_count", "machine_type", + "placement_policy", "max_pods_per_node", "min_cpu_platform", "pod_range", @@ -497,6 +499,7 @@ locals { "enable_gcfs", "enable_gvnic", "enable_secure_boot", + "boot_disk_kms_key", ] } @@ -513,18 +516,6 @@ resource "random_id" "name" { local.force_node_pool_recreation_resources, [for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")] ), - { - labels = join(",", - sort( - concat( - keys(local.node_pools_labels["all"]), - values(local.node_pools_labels["all"]), - keys(local.node_pools_labels[each.value["name"]]), - values(local.node_pools_labels[each.value["name"]]) - ) - ) - ) - }, { taints = join(",", sort( @@ -558,16 +549,6 @@ resource "random_id" "name" { ) ) ) - }, - { - tags = join(",", - sort( - concat( - local.node_pools_tags["all"], - local.node_pools_tags[each.value["name"]] - ) - ) - ) } ) } diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 9165c5dfe1..088fba4308 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -465,10 +465,12 @@ locals { "disk_type", "accelerator_count", "accelerator_type", + "gpu_partition_size", "enable_secure_boot", "enable_integrity_monitoring", "local_ssd_count", "machine_type", + "placement_policy", "max_pods_per_node", "min_cpu_platform", "pod_range", @@ -478,6 +480,7 @@ locals { "enable_gcfs", "enable_gvnic", "enable_secure_boot", + "boot_disk_kms_key", ] } @@ -494,18 +497,6 @@ resource "random_id" "name" { local.force_node_pool_recreation_resources, [for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")] ), - { - labels = join(",", - sort( - concat( - keys(local.node_pools_labels["all"]), - values(local.node_pools_labels["all"]), - keys(local.node_pools_labels[each.value["name"]]), - values(local.node_pools_labels[each.value["name"]]) - ) - ) - ) - }, { taints = join(",", sort( @@ -539,16 +530,6 @@ resource "random_id" "name" { ) ) ) - }, - { - tags = join(",", - sort( - concat( - local.node_pools_tags["all"], - local.node_pools_tags[each.value["name"]] - ) - ) - ) } ) } diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 7a3e86a4cc..17ed665c93 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -411,10 +411,12 @@ locals { "disk_type", "accelerator_count", "accelerator_type", + "gpu_partition_size", "enable_secure_boot", "enable_integrity_monitoring", "local_ssd_count", "machine_type", + "placement_policy", "max_pods_per_node", "min_cpu_platform", "pod_range", @@ -424,6 +426,7 @@ locals { "enable_gcfs", "enable_gvnic", "enable_secure_boot", + "boot_disk_kms_key", ] } @@ -440,18 +443,6 @@ resource "random_id" "name" { local.force_node_pool_recreation_resources, [for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")] ), - { - labels = join(",", - sort( - concat( - keys(local.node_pools_labels["all"]), - values(local.node_pools_labels["all"]), - keys(local.node_pools_labels[each.value["name"]]), - values(local.node_pools_labels[each.value["name"]]) - ) - ) - ) - }, { taints = join(",", sort( @@ -485,16 +476,6 @@ resource "random_id" "name" { ) ) ) - }, - { - tags = join(",", - sort( - concat( - local.node_pools_tags["all"], - local.node_pools_tags[each.value["name"]] - ) - ) - ) } ) } From 1defeaf74330a6102406f5c83a575f4a8f67052a Mon Sep 17 00:00:00 2001 From: Laura Seidler Date: Thu, 12 Oct 2023 18:05:56 +0200 Subject: [PATCH 3/3] docs: add changelog for new/removed keepers --- docs/upgrading_to_v29.0.md | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/upgrading_to_v29.0.md diff --git a/docs/upgrading_to_v29.0.md b/docs/upgrading_to_v29.0.md new file mode 100644 index 0000000000..9cff5eb1f1 --- /dev/null +++ b/docs/upgrading_to_v29.0.md @@ -0,0 +1,49 @@ +# Upgrading to v29.0 +The v29.0 release of *kubernetes-engine* is a backwards incompatible +release. + +### Update variant random ID keepers updated + +The v29.0 release updates the keepers for the update variant modules. This will force a recreation of the nodepools. + +To avoid this, it is possible to edit the remote state of the `random_id` resource to add the new attributes. + +1. Perform a `terraform plan` as normal, identifying the `random_id` resource(s) changing and the new/removed attributes +```tf + ~ keepers = { # forces replacement + + "boot_disk_kms_key" = "" + + "gpu_partition_size" = "" + - "labels" = "" -> null + + "placement_policy" = "" + - "tags" = "" -> null + # (19 unchanged elements hidden) + } + # (2 unchanged attributes hidden) + } +``` +2. Pull the remote state locally: `terraform state pull > default.tfstate` +3. Back up the original remote state: `cp default.tfstate original.tfstate` +4. Edit the `random_id` resource(s) to add/remove the attributes from the `terraform plan` step +```diff +"attributes": { + "b64_std": "pool-02-vb4=", + "b64_url": "pool-02-vb4", + "byte_length": 2, + "dec": "pool-02-48574", + "hex": "pool-02-bdbe", + "id": "vb4", + "keepers": { + ... + "taints": "", +- "labels": "", +- "tags": "", ++ "boot_disk_kms_key": "", ++ "gpu_partition_size": "", ++ "placement_policy": "", + }, + "prefix": "pool-02-" + } +``` +1. Bump the serial number at the top +2. Push the modified state to the remote `terraform state push default.tfstate` +3. Confirm the `random_id` resource(s) no longer changes (or the corresponding `nodepool`) in a `terraform plan`