fix: add missing ForceNew node_config fields to update-variant keepers#2579
fix: add missing ForceNew node_config fields to update-variant keepers#2579voron wants to merge 1 commit into
Conversation
Add local_nvme_ssd_count, threads_per_core, enable_nested_virtualization, performance_monitoring_unit, and node_affinity to force_node_pool_recreation_resources. The provider declares these ForceNew, so without them changes plan a replacement against the same node pool name and fail with "Error 409: Already exists". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Alex Vorona <alex@vorona.com.ua>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds several ForceNew attributes, such as local_nvme_ssd_count and node_affinity, to the cluster configuration templates and update-variant modules to improve node pool update logic. Feedback suggests including additional missing ForceNew fields, like machine_type and disk_size_gb, to prevent 409 conflicts and ensure reliable zero-downtime updates.
| "local_nvme_ssd_count", | ||
| "threads_per_core", | ||
| "enable_nested_virtualization", | ||
| "performance_monitoring_unit", | ||
| "node_affinity", |
There was a problem hiding this comment.
The addition of these five fields is correct as they are indeed ForceNew attributes. However, several other critical ForceNew fields that the module accepts in the node_pools map are also missing from this list. Missing these fields will cause the update-variant modules to fail with a 409 conflict when they are changed, as the node pool name won't be rotated, preventing create_before_destroy from working correctly.
Consider adding the following missing fields as well:
machine_typedisk_size_gbdisk_typeimage_typenode_metadataenable_gcfsenable_gvnicenable_fast_socketprovisioned_iopsprovisioned_throughputenable_confidential_nodes
This will make the zero-downtime update logic much more robust for common node pool configuration changes.
"local_nvme_ssd_count",
"threads_per_core",
"enable_nested_virtualization",
"performance_monitoring_unit",
"node_affinity",
"machine_type",
"disk_size_gb",
"disk_type",
"image_type",
"node_metadata",
"enable_gcfs",
"enable_gvnic",
"enable_fast_socket",
"provisioned_iops",
"provisioned_throughput",
"enable_confidential_nodes",
There was a problem hiding this comment.
Thanks, but I don't think these belong in the keepers list — most of them aren't ForceNew in the provider:
machine_type,disk_size_gb,disk_type,image_type— updateable in placeenable_gcfs,enable_gvnic,enable_fast_socket— updateableprovisioned_iops,provisioned_throughput— updateable (handled as part of disk update)node_metadata— not a currentnode_configfield (legacy alias ofworkload_metadata_config.mode, which is updateable)enable_confidential_nodes— theForceNewbits ofconfidential_nodesare already covered viaenable_confidential_storage; the surface this module exposes doesn't add a newForceNewgap here
Adding any of these would force full pool recreation on routine in-place changes, which is the opposite of what this list is for.
The five fields in this PR were picked by cross-checking node_config in the provider source for ForceNew: true against what the module actually surfaces from node_pools. The reviewers' confidence list in the original write-up enumerated the rest already-covered.
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
|
This PR is not stale |
Summary
The
*-update-variantmodules userandom_id.namekeyed offforce_node_pool_recreation_resourcesto roll the node-pool name suffix whenever aForceNewattribute changes, socreate_before_destroycan replace the pool cleanly.Five module variables that the module already accepts in
node_poolsmap to provider fields declaredForceNew: truebut are missing from the keepers list. Changing any of them on an existing pool causes Terraform to plan a replacement against the same node pool name, producing:Reproduced on
v41.0.0andv44.0.0.Gaps
local_nvme_ssd_countnode_config.local_nvme_ssd_block_config.local_ssd_countthreads_per_corenode_config.advanced_machine_features.threads_per_coreenable_nested_virtualizationnode_config.advanced_machine_features.enable_nested_virtualizationperformance_monitoring_unitnode_config.advanced_machine_features.performance_monitoring_unitnode_affinitynode_config.sole_tenant_config.node_affinityAll five are declared
ForceNew: trueinhashicorp/terraform-provider-google(google/services/container/node_config.go), and all are already consumed by the module fromnode_pools.Fix
Add the five entries to
force_node_pool_recreation_resourcesinautogen/main/cluster.tf.tmpl.make buildpropagates the change to the three update-variant submodules.Workaround (until merged)
terraform apply -replace='module.<path>.random_id.name["<pool>"]'