Skip to content

Commit

Permalink
feat(update-variant)!: allow updating disk_type, disk_size_gb, machin…
Browse files Browse the repository at this point in the history
…e_type, enable_gcfs in place (#2195)

Signed-off-by: drfaust92 <[email protected]>
  • Loading branch information
DrFaust92 authored Dec 5, 2024
1 parent e9ab0df commit 276cbdb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
4 changes: 0 additions & 4 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,6 @@ resource "google_container_cluster" "primary" {
{% if update_variant %}
locals {
force_node_pool_recreation_resources = [
"disk_size_gb",
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
Expand All @@ -730,15 +728,13 @@ locals {
{% if beta_cluster %}
"local_ssd_ephemeral_count",
{% endif %}
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
"preemptible",
"spot",
"service_account",
"enable_gcfs",
"enable_gvnic",
"boot_disk_kms_key",
"queued_provisioning",
Expand Down
44 changes: 44 additions & 0 deletions docs/upgrading_to_v35.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,47 @@ The Terraform Kubernetes Engine Module now requires version 6 of the Google Clou

### Private Cluster Sub-Modules Endpoint Output
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.

## Update variant random ID keepers updated

The v35.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
- "disk_type" = "" -> null
- "disk_size_gb" = "" -> null
- "machine_type" = "" -> null
- "enable_gcfs" = "" -> 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": "",
- "disk_size_gb": "",
- "enable_gcfs": "",
- "machine_type": "",
- "disk_type": "",
},
"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`
4 changes: 0 additions & 4 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,6 @@ resource "google_container_cluster" "primary" {
*****************************************/
locals {
force_node_pool_recreation_resources = [
"disk_size_gb",
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
Expand All @@ -622,15 +620,13 @@ locals {
"enable_integrity_monitoring",
"local_ssd_count",
"local_ssd_ephemeral_count",
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
"preemptible",
"spot",
"service_account",
"enable_gcfs",
"enable_gvnic",
"boot_disk_kms_key",
"queued_provisioning",
Expand Down
4 changes: 0 additions & 4 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,6 @@ resource "google_container_cluster" "primary" {
*****************************************/
locals {
force_node_pool_recreation_resources = [
"disk_size_gb",
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
Expand All @@ -601,15 +599,13 @@ locals {
"enable_integrity_monitoring",
"local_ssd_count",
"local_ssd_ephemeral_count",
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
"preemptible",
"spot",
"service_account",
"enable_gcfs",
"enable_gvnic",
"boot_disk_kms_key",
"queued_provisioning",
Expand Down
4 changes: 0 additions & 4 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,6 @@ resource "google_container_cluster" "primary" {
*****************************************/
locals {
force_node_pool_recreation_resources = [
"disk_size_gb",
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
Expand All @@ -574,15 +572,13 @@ locals {
"enable_secure_boot",
"enable_integrity_monitoring",
"local_ssd_count",
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
"preemptible",
"spot",
"service_account",
"enable_gcfs",
"enable_gvnic",
"boot_disk_kms_key",
"queued_provisioning",
Expand Down

0 comments on commit 276cbdb

Please sign in to comment.