-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Removing All Labels on GKE Node Pool Fails #15848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing All Labels on GKE Node Pool Fails #15848
Comments
Hello, I want to ask, is there any solution at present? |
this is still an issue on provider |
I just tested on 6.8.0, and the problem still seems to be an issue, even with the changes I was testing locally for handling updating these values in-place. |
This is still an issue... |
We're running into the same problem when provisioning node pool using https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/main/modules/beta-private-cluster
upon initial provisioning, it resulted in immediate drift where GCP automatically added
however, when running
|
We found a working solution by using Terraform's ability to ignore changes to specific map elements. Adding this to the node pool resource configuration works:
This prevents Terraform from trying to remove the automatically added label while still maintaining control over other resource labels. Reference to the relevant Terraform docs: https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes |
sadly it won’t work if the node pool exists in a child module due a terraform limitation hashicorp/terraform#21546 unless the module itself has this hardcoded. our current workaround is to always provide some dummy resource labels in the configuration. also thanks to the non-authoritative nature of resourceLabels, the provider will not run into infinite drift as its additional only. I believe the issue is more so about the poor handling of zero value in the GKE management API, the provider is working as intended. For example, if we try to update resource labels using the Go sdk directly, we can reproduce the exact same error:
|
There are two issues going on here:
|
We have got the problem with new node pools created just few days ago This is from
And adding this into terraform module solved the issue.
|
Reopening this as I didn't fix the removal of all labels issue. I only fixed the issue with diffs showing up for the server added label |
I recently released versions 6.18.1 and 5.45.1 of both the GA and beta provider to address the server-side applied labels. It doesn't necessarily fix the remove all labels problem as I didn't want to make such a change in a backport fix, but that problem may actually go away once the server-side labels are rolled out. |
@slevenick Appreciate the fix for the
|
Hey @drcapulet that's worrying. I'm not able to reproduce this locally with 6.19.0, but I'm also not getting the labels applied to my node pools. Can you make sure that you're on 6.18.1 or 6.19.0? If so, can you share your config and debug logs so that I can take a closer look? |
@slevenick Apologies - I missed that we were using the beta provider there, can confirm we're not seeing drift there anymore with 6.19.0. |
Given that we've fixed the "removing all labels" problem once the server-side labels are rolled out I'm going to close this. There are two separate problems in this issue, but both are solved once the GKE node pool has server-side applied labels and the user is on 6.18.1+ |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
Labels on the node pool are removed.
Actual Behavior
Steps to Reproduce
node_config.labels
or set to{}
terraform apply
b/300616676
The text was updated successfully, but these errors were encountered: