-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
container: fix missing updates for google_container_cluster.node_config
subfields
#12014
container: fix missing updates for google_container_cluster.node_config
subfields
#12014
Conversation
google_container_cluster.node_config
subfieldsgoogle_container_cluster.node_config
subfields
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @roaks3, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've kicked off tests, but @wyardley this is a little tough to understand out of context, and seems potentially dangerous. Could you possibly either:
- Describe what you've actually changed in the code, and why that solves the issue, or
- Loop in someone else who may have prior context on these changes
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 212 Click here to see the affected service packages
🟢 All tests passed! View the build log |
@roaks3 Sure!
So, tl;dr this should make the behavior of the default node pool within the Let me know if that helps in terms of what you were looking for. A bit broader context: |
} | ||
|
||
nodePoolNodeConfigUpdate(d, config, nodePoolInfo, "", defaultPool, d.Timeout(schema.TimeoutUpdate)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy to adjust this to either define timeout
above and / or hard-code "default-pool"
vs defining it above
@wyardley thanks for the response! Yea, I think I understand the intent to update this config, and some of the nuance where this is shared between resources. But I am still wondering if you could give a brief description of the actual code changes here. (I could probably deduce the answer by reading all of the related references, but it would take quite a bit longer for me to wrap my head around everything for this review). For example, why are all of these lines being removed? Are they effectively already copied under the function you are replacing them with, or do I need to review those functions as well to determine what behavior has changed? In short, what could break? Acknowledged on the testing. Once I know a bit more about what is changing that will help me weigh in, but I'm tempted to say this is the type of change that would be covered well enough by existing tests. We may want to add some of these fields to existing tests though, if they are any that aren't already included. |
So the bug here is that not all of the fields that support update in place were being updated when defined for the default pool via The plan therefore was to first extract out the node_config updates in So the simple answer to your question is that the code being pulled out should be a functionally equivalent subset of what's now being called. Some of the code should be identical or close to identical (other than the semantics around For the parts that were already implemented in both places, you should be able to compare the code and see that those sections are pretty similar. For example, compare: magic-modules/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl Lines 3846 to 3892 in c438c6e
to magic-modules/mmv1/third_party/terraform/services/container/node_config.go.tmpl Lines 2415 to 2448 in c438c6e
I checked and when the default node pool is defined via
However, some of these resources may not have tests in either place that test the path where the resource is updated in-place. |
Drive-by comment: @wyardley will existing tests catch this error? or is this fixing bugs that were not caught by the existing tests? |
@melinath: There were presumably no (update) tests for the things that were broken before, at least not directly within
Edit: See summary before of what I found (and added) test-wise. |
53caf85
to
62e2a1b
Compare
Ok @roaks3 @melinath: tried to do a quick audit of existing test coverage. It's kind of a patchwork, though actually a reasonable amount of coverage already, esp. if we assume the same behavior between the default pool and other nodepools once this change is in place. I'm adding a simple tweak to an existing test that will already cover Here's what I found (may not be perfect)
|
d0d2365
to
0b5b6a1
Compare
I was able to extend With the changes, things pass, and, even with all the separate node pool updates, it's not horribly fast:
The same test fails as expected without the code changes. Some of the fields ( This is a good example where the tests directly for |
0b5b6a1
to
5e7f736
Compare
I've added / adjusted tests for almost all of the fields directly in I can add All of these passed when I ran them manually; would be great if someone can kick off the full suite again Monday. I left the commits mostly atomic for easier review, but let me know if I should squash something.
|
forceNewClusterNodeConfigFields = []string{ | ||
"labels", | ||
"workload_metadata_config", | ||
"resource_manager_tags", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this list had been perfectly maintained / up to date, I think this "bug" wouldn't have existed [because the default pool would have gotten recreated if any of those fields changed), but also, it seems better to update the fields in-place if we can, which it seems like we can, and I'm pretty confident at least some fields were missing from this list.
6625353
to
036c349
Compare
Add test for setting `gvnic` to enabled, and toggling `fast_socket` from `false` to `true`.
10658fe
to
91c0c4d
Compare
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_container_cluster" "primary" {
node_config {
resource_manager_tags = # value needed
}
}
|
Tests analyticsTotal tests: 214 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
@roaks3 any idea why it didn’t re-run As far as why it’s still complaining about the missing test, I've normally seen that when the test doesn't compile at all, but maybe here it's because it's not the first attribute in the nested block? |
Yea, I'm not sure on the missing test detector. It is reporting a correct requirement, but we also clearly have it covered in a test. It might be hitting some edge case it isn't expecting. |
I thought this change might fix hashicorp/terraform-provider-google#18208, but I tried to add the sysctl config again with version 6.12.0 of the Google provider, and it's still not working for me. |
This resolves an issue where many subfields of
node_config
in a cluster (which affects the default node-pool "default-pool" whenremove_default_node_pool
is not set tofalse
) don't support updates properly, and also allows 3 subfields which had been previously set to force recreation of the default node pool (because updates were non-functional) to be updated in-place.Some acceptance tests are added, and some existing tests have been adjusted to confirm that the behavior is the same between
google_container_cluster.node_config
andgoogle_container_node_pool.node_config
.Fixes hashicorp/terraform-provider-google#19225
Fixes hashicorp/terraform-provider-google#18208
Fixes hashicorp/terraform-provider-google#16054
Fixes hashicorp/terraform-provider-google#13872
Possible fix for hashicorp/terraform-provider-google#17522 roaks3: This helps but I don't think it's a fix per se
Partial / possible fix for hashicorp/terraform-provider-google#12966 roaks3: Agreed, might fix, but we shouldn't close it yet
Followup to #11826 where the code used by the regular node pool update code was broken out.
Release Note Template for Downstream PRs (will be copied)
References
node_config.gcfs_config
and make optional #11717node_config
node pool update #11826See above for some other issues that I believe may be fully or partially resolved by this.
b/361634104