-
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
No pdcsi disable on create #9557
Conversation
Hello! I am a robot. It looks like you are a: @shuyama1, 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. |
|
869e1a6
to
4e6a7ca
Compare
/restest |
/retest |
Tests analyticsTotal tests: 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 testsTestAccLoggingProjectSink_updatePreservesCustomWriter |
|
The acceptance tests are failing, including the same cannot-create-key error that the VCR test above is failing with. My test shouldn't be affecting any of that so I'm hoping it's an infra flake. |
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.
The current failing VCR test seems unrelated to this change. No need to worry about it. Sorry for the noise. We skipped the test TestAccContainerCluster_withAddons
from running completely since it's consistently failing. You'll need to remove the t.Skipf
flag in the test:
magic-modules/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb
Line 130 in 6d9fb14
t.Skipf("Skipping test %s due to https://github.com/hashicorp/terraform-provider-google/issues/16114", t.Name()) |
4e6a7ca
to
493819d
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. Terraform GA: Diff ( 2 files changed, 8 insertions(+), 1 deletion(-)) |
/gcbrun |
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. Terraform GA: Diff ( 2 files changed, 8 insertions(+), 1 deletion(-)) |
Tests analyticsTotal tests: Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccContainerCluster_withAddons|TestAccDataprocClusterIamPolicy |
Rerun these tests in REPLAYING mode to catch issues
|
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.
The test failed due to the same permadiff:
vcr_utils.go:152: Step 1/4 error: After applying this test step, the plan was not empty.
stdout:
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# google_container_cluster.primary will be updated in-place
~ resource "google_container_cluster" "primary" {
id = "projects/ci-test-project-188019/locations/us-central1-a/clusters/tf-test-cluster-xgap7otdsy"
name = "tf-test-cluster-xgap7otdsy"
# (28 unchanged attributes hidden)
~ addons_config {
~ gce_persistent_disk_csi_driver_config {
~ enabled = true -> false
}
# (11 unchanged blocks hidden)
}
# (21 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
It means the the user set gce_persistent_disk_csi_driver_config.enable = false
but end up getting gce_persistent_disk_csi_driver_config.enable = true
in the TF state. Since GcePersistentDiskCsiDriver cannot be disabled at cluster create, only on cluster update, what we need to do is first make a create call with gce_persistent_disk_csi_driver_config.enable = true
and then make a update call to update the field to false
to match users' config. And all these will be happen in the Terraform resourceContainerClusterCreate
method, so that when users try to set gce_persistent_disk_csi_driver_config.enable = false
when creating the resource initially, they will have the resource as intended.
Similar example like privateClusterConfig.EnablePrivateEndpoint as you mentioned in the ticket. It won't support enable_private_endpoint
on create
. We need to set it to false
in the create call, and then make an update call if users set it as true
in the first place.
Please let me know if you have any questions.
Oh, I see. I missed that we want to emulate create with false by doing an update. Thx. |
Do we care that we may be doing several updates if, eg, pdcsi is disabled and privateClusterConfig is similarly set? In theory I think we could just do a single update after create in order to set values that can only be set on update. But I don't know if that's going to complicate things too much given how resourceContainerClusterCreate is structured. |
I think that's a good concern. I'm not sure why it's set up this way in the first place, it may due to that we need to update features one by one during the time it was implemented or it may be easier to check and update a single feature instead of multiple ones. It's implemented a few years ago so I'm only guessing here. So if you see that pdcsi can be combined to one of the current update calls, feel free to add it in and see if it works. |
493819d
to
1c938f0
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. Terraform GA: Diff ( 2 files changed, 41 insertions(+), 9 deletions(-)) |
Tests analyticsTotal tests: 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 testsTestAccContainerCluster_withAddons |
Hmm, locally the _withAddons test failed with the following. I'm not sure if that's due to my changes are not, I'll look into it but while I do so are there any known flakes around this?
|
|
The test failed probably due to a missing
in the The error that you run into locally is due to that it's hitting the max (30) of secondary ranges for subnet "gke-cluster" in your local testing environment, you may want to clean some of those up and see if the error still occurs. |
1c938f0
to
75bd248
Compare
Thanks! I pushed the changes up to test upstream while I sort out my project. |
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. Terraform GA: Diff ( 2 files changed, 48 insertions(+), 15 deletions(-)) |
Tests analyticsTotal tests: 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 testsTestAccContainerCluster_withAddons |
Rerun these tests in REPLAYING mode to catch issues
|
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.
LGTM overall. only some nit-picks and small comments.
@@ -2384,12 +2384,29 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er | |||
cluster.SecurityPostureConfig = expandSecurityPostureConfig(v) | |||
} | |||
|
|||
needUpdateAfterCreate := false |
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.
needUpdateAfterCreate := false | |
needUpdateAfterCreate := false |
nit: we use tabs instead spaces for indentation in this file. Please also update the rest of the file. Sorry for the nitpick and thank you!
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.
Done! Hopefully it worked right, I'll upload and see how github shows the changes.
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.
Hmm, I tabified but it seems to have affected quite a bit of the file. WDYT?
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.
Thanks for updating the file. Sorry I was not clear before. I mean let's update the indentation of the code changed in this PR but not the whole file. Sorry about it. Plus, we use spaces for inline spacing and tabs for indentation for resource.go file and in test.go file, we use spaces for resource configuration blocks in the tests: https://github.com/mattcary/magic-modules/blob/pdcsi-create/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb#L5134.
Sorry if I've made it more confused, you can check generated resource and test files. https://github.com/hashicorp/terraform-provider-google-beta/blob/main/google-beta/services/cloudrunv2/resource_cloud_run_v2_job.go
https://github.com/hashicorp/terraform-provider-google-beta/blob/main/google-beta/services/cloudrunv2/resource_cloud_run_v2_job_generated_test.go
Handwritten files should also follow that format.
Anyways, let's only update the code touched in this PR - this is to prevent merge conflicts for this and other ongoing PRs. Thank you and sorry for the confusion.
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.
Okay, I think I got it. I'm not totally sure how to check that tabs are in the right places though.
if cluster.AddonsConfig == nil { | ||
cluster.AddonsConfig = &container.AddonsConfig{} | ||
} | ||
if cluster.AddonsConfig.GcePersistentDiskCsiDriverConfig == nil { | ||
cluster.AddonsConfig.GcePersistentDiskCsiDriverConfig = &container.GcePersistentDiskCsiDriverConfig{} | ||
} |
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.
Do we need these two checks here? I'd assume we wouldn't reach these two conditions since we'd have enablePDCSI = true
if cluster.AddonsConfig == nil || cluster.AddonsConfig.GcePersistentDiskCsiDriverConfig == nil
? Or I could be missing some cases.
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.
There are several other addons besides pdcsi. So it definitely could be the case that addons config != nil but the pdcsi config is nil.
However, as mentioned in the comment above I'm being paranoid because if pdcsi is not enabled, the config must have been explicitly defined.
But it seems an easy check to make and who knows how the code might change in the future.
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.
Yeah, that makes sense. I was just curious since these checks are under if !enablePDCSI
. But let's keep them just in case. Thanks!
b4d24c4
to
fc95fba
Compare
8c73cdf
to
69785e2
Compare
69785e2
to
634c658
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. Terraform GA: Diff ( 2 files changed, 41 insertions(+), 9 deletions(-)) |
Tests analyticsTotal tests: 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 testsTestAccDataSourceGoogleServiceAccountJwt |
Rerun these tests in REPLAYING mode to catch issues
|
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.
LGTM. Thanks!
The PDCSI addon cannot be disabled on cluster creation.
Fixes: hashicorp/terraform-provider-google#16114
Release Note Template for Downstream PRs (will be copied)