Skip to content

Commit 276cbdb

Browse files
authored
feat(update-variant)!: allow updating disk_type, disk_size_gb, machine_type, enable_gcfs in place (#2195)
Signed-off-by: drfaust92 <[email protected]>
1 parent e9ab0df commit 276cbdb

File tree

5 files changed

+44
-16
lines changed

5 files changed

+44
-16
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,6 @@ resource "google_container_cluster" "primary" {
716716
{% if update_variant %}
717717
locals {
718718
force_node_pool_recreation_resources = [
719-
"disk_size_gb",
720-
"disk_type",
721719
"accelerator_count",
722720
"accelerator_type",
723721
"gpu_partition_size",
@@ -730,15 +728,13 @@ locals {
730728
{% if beta_cluster %}
731729
"local_ssd_ephemeral_count",
732730
{% endif %}
733-
"machine_type",
734731
"placement_policy",
735732
"max_pods_per_node",
736733
"min_cpu_platform",
737734
"pod_range",
738735
"preemptible",
739736
"spot",
740737
"service_account",
741-
"enable_gcfs",
742738
"enable_gvnic",
743739
"boot_disk_kms_key",
744740
"queued_provisioning",

docs/upgrading_to_v35.0.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,47 @@ The Terraform Kubernetes Engine Module now requires version 6 of the Google Clou
66

77
### Private Cluster Sub-Modules Endpoint Output
88
The private cluster sub-modules now return the cluster's private endpoint for the `endpoint` output when the `enable_private_endpoint` argument is `true`, regardless of the `deploy_using_private_endpoint` argument value.
9+
10+
## Update variant random ID keepers updated
11+
12+
The v35.0 release updates the keepers for the update variant modules. This will force a recreation of the nodepools.
13+
14+
To avoid this, it is possible to edit the remote state of the `random_id` resource to add the new attributes.
15+
16+
1. Perform a `terraform plan` as normal, identifying the `random_id` resource(s) changing and the new/removed attributes
17+
```tf
18+
~ keepers = { # forces replacement
19+
- "disk_type" = "" -> null
20+
- "disk_size_gb" = "" -> null
21+
- "machine_type" = "" -> null
22+
- "enable_gcfs" = "" -> null
23+
# (19 unchanged elements hidden)
24+
}
25+
# (2 unchanged attributes hidden)
26+
}
27+
```
28+
2. Pull the remote state locally: `terraform state pull > default.tfstate`
29+
3. Back up the original remote state: `cp default.tfstate original.tfstate`
30+
4. Edit the `random_id` resource(s) to add/remove the attributes from the `terraform plan` step
31+
```diff
32+
"attributes": {
33+
"b64_std": "pool-02-vb4=",
34+
"b64_url": "pool-02-vb4",
35+
"byte_length": 2,
36+
"dec": "pool-02-48574",
37+
"hex": "pool-02-bdbe",
38+
"id": "vb4",
39+
"keepers": {
40+
...
41+
"taints": "",
42+
- "disk_size_gb": "",
43+
- "enable_gcfs": "",
44+
- "machine_type": "",
45+
- "disk_type": "",
46+
},
47+
"prefix": "pool-02-"
48+
}
49+
```
50+
1. Bump the serial number at the top
51+
2. Push the modified state to the remote `terraform state push default.tfstate`
52+
3. Confirm the `random_id` resource(s) no longer changes (or the corresponding `nodepool`) in a `terraform plan`

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,6 @@ resource "google_container_cluster" "primary" {
610610
*****************************************/
611611
locals {
612612
force_node_pool_recreation_resources = [
613-
"disk_size_gb",
614-
"disk_type",
615613
"accelerator_count",
616614
"accelerator_type",
617615
"gpu_partition_size",
@@ -622,15 +620,13 @@ locals {
622620
"enable_integrity_monitoring",
623621
"local_ssd_count",
624622
"local_ssd_ephemeral_count",
625-
"machine_type",
626623
"placement_policy",
627624
"max_pods_per_node",
628625
"min_cpu_platform",
629626
"pod_range",
630627
"preemptible",
631628
"spot",
632629
"service_account",
633-
"enable_gcfs",
634630
"enable_gvnic",
635631
"boot_disk_kms_key",
636632
"queued_provisioning",

modules/beta-public-cluster-update-variant/cluster.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,6 @@ resource "google_container_cluster" "primary" {
589589
*****************************************/
590590
locals {
591591
force_node_pool_recreation_resources = [
592-
"disk_size_gb",
593-
"disk_type",
594592
"accelerator_count",
595593
"accelerator_type",
596594
"gpu_partition_size",
@@ -601,15 +599,13 @@ locals {
601599
"enable_integrity_monitoring",
602600
"local_ssd_count",
603601
"local_ssd_ephemeral_count",
604-
"machine_type",
605602
"placement_policy",
606603
"max_pods_per_node",
607604
"min_cpu_platform",
608605
"pod_range",
609606
"preemptible",
610607
"spot",
611608
"service_account",
612-
"enable_gcfs",
613609
"enable_gvnic",
614610
"boot_disk_kms_key",
615611
"queued_provisioning",

modules/private-cluster-update-variant/cluster.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,6 @@ resource "google_container_cluster" "primary" {
563563
*****************************************/
564564
locals {
565565
force_node_pool_recreation_resources = [
566-
"disk_size_gb",
567-
"disk_type",
568566
"accelerator_count",
569567
"accelerator_type",
570568
"gpu_partition_size",
@@ -574,15 +572,13 @@ locals {
574572
"enable_secure_boot",
575573
"enable_integrity_monitoring",
576574
"local_ssd_count",
577-
"machine_type",
578575
"placement_policy",
579576
"max_pods_per_node",
580577
"min_cpu_platform",
581578
"pod_range",
582579
"preemptible",
583580
"spot",
584581
"service_account",
585-
"enable_gcfs",
586582
"enable_gvnic",
587583
"boot_disk_kms_key",
588584
"queued_provisioning",

0 commit comments

Comments
 (0)