magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

Allow network tags to be updated for GKE Nodepools

Open upodroid opened this issue 3 years ago • 19 comments

Fixes: https://github.com/hashicorp/terraform-provider-google/issues/10995

If this PR is for Terraform, I acknowledge that I have:

  • [X] Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • [X] Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • [X] Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • [X] Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • [X] Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

container: `node_config.0.tags` field of `google_container_node_pool` is updateable now. (beta)

upodroid avatar Feb 01 '22 17:02 upodroid

Hello! I am a robot who works on Magic Modules PRs.

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review.

Thanks for your contribution! A human will be with you soon.

@rileykarson, please review this PR or find an appropriate assignee.

modular-magician avatar Feb 01 '22 17:02 modular-magician

@jcanseco This feature is not working properly serverside.

This is mergable once the API is fixed by Google.

Request Logs
---[ REQUEST ]---------------------------------------
PUT /v1beta1/projects/REDACTED/locations/us-central1-a/clusters/tf-test-cluster-p19b92hvjm/nodePools/tf-test-nodepool-zjl91bcnec?alt=json&prettyPrint=false HTTP/1.1
Host: container.googleapis.com
User-Agent: google-api-go-client/0.5 Terraform/1.1.4 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/acc
Content-Length: 68
Content-Type: application/json
X-Goog-Api-Client: gl-go/1.17.6 gdcl/20211201
Accept-Encoding: gzip

{
 "nodePoolId": "tf-test-nodepool-zjl91bcnec",
 "tags": {
  "tags": [
   "ga"
  ]
 }
}

-----------------------------------------------------
2022/02/01 13:04:09 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Tue, 01 Feb 2022 13:04:09 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
 "name": "operation-1643720649194-d10efeb9",
 "zone": "us-central1-a",
 "operationType": "UPGRADE_NODES",
 "status": "RUNNING",
 "selfLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/operations/operation-1643720649194-d10efeb9",
 "targetLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/clusters/tf-test-cluster-p19b92hvjm/nodePools/tf-test-nodepool-zjl91bcnec",
 "startTime": "2022-02-01T13:04:09.194981254Z"
}
-----------------------------------------------------
2022/02/01 13:04:09 [DEBUG] Retry Transport: Stopping retries, last request was successful
2022/02/01 13:04:09 [DEBUG] Retry Transport: Returning after 1 attempts
2022/02/01 13:04:09 [INFO] Instantiating GKE client for path https://container.googleapis.com/
2022/02/01 13:04:09 [DEBUG] Waiting for state to become: [DONE]
2022/02/01 13:04:09 [DEBUG] Waiting for state to become: [success]
2022/02/01 13:04:09 [DEBUG] Retry Transport: starting RoundTrip retry loop
2022/02/01 13:04:09 [DEBUG] Retry Transport: request attempt 0
2022/02/01 13:04:09 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
GET /v1beta1/projects/REDACTED/locations/us-central1-a/operations/operation-1643720649194-d10efeb9?alt=json&prettyPrint=false HTTP/1.1
Host: container.googleapis.com
User-Agent: google-api-go-client/0.5 Terraform/1.1.4 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/acc
X-Goog-Api-Client: gl-go/1.17.6 gdcl/20211201
Accept-Encoding: gzip


-----------------------------------------------------
2022/02/01 13:04:09 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Tue, 01 Feb 2022 13:04:09 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
 "name": "operation-1643720649194-d10efeb9",
 "zone": "us-central1-a",
 "operationType": "UPGRADE_NODES",
 "status": "RUNNING",
 "selfLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/operations/operation-1643720649194-d10efeb9",
 "targetLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/clusters/tf-test-cluster-p19b92hvjm/nodePools/tf-test-nodepool-zjl91bcnec",
 "startTime": "2022-02-01T13:04:09.194981254Z"
}
-----------------------------------------------------
2022/02/01 13:04:09 [DEBUG] Retry Transport: Stopping retries, last request was successful
2022/02/01 13:04:09 [DEBUG] Retry Transport: Returning after 1 attempts
2022/02/01 13:04:09 [DEBUG] Got RUNNING while polling for operation operation-1643720649194-d10efeb9's status
2022/02/01 13:04:19 [DEBUG] Waiting for state to become: [success]
2022/02/01 13:04:19 [DEBUG] Retry Transport: starting RoundTrip retry loop
2022/02/01 13:04:19 [DEBUG] Retry Transport: request attempt 0
2022/02/01 13:04:19 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
GET /v1beta1/projects/REDACTED/locations/us-central1-a/operations/operation-1643720649194-d10efeb9?alt=json&prettyPrint=false HTTP/1.1
Host: container.googleapis.com
User-Agent: google-api-go-client/0.5 Terraform/1.1.4 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/acc
X-Goog-Api-Client: gl-go/1.17.6 gdcl/20211201
Accept-Encoding: gzip


-----------------------------------------------------
2022/02/01 13:04:19 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Tue, 01 Feb 2022 13:04:19 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
 "name": "operation-1643720649194-d10efeb9",
 "zone": "us-central1-a",
 "operationType": "UPGRADE_NODES",
 "status": "RUNNING",
 "selfLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/operations/operation-1643720649194-d10efeb9",
 "targetLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/clusters/tf-test-cluster-p19b92hvjm/nodePools/tf-test-nodepool-zjl91bcnec",
 "detail": "Updating tf-test-nodepool-zjl91bcnec, processed 0 out of 1 nodes (0.0%)",
 "startTime": "2022-02-01T13:04:09.194981254Z",
 "progress": {
  "metrics": [
   {
    "name": "NODES_TOTAL",
    "intValue": "1"
   }
  ]
 }
}
-----------------------------------------------------
2022/02/01 13:04:19 [DEBUG] Retry Transport: Stopping retries, last request was successful
2022/02/01 13:04:19 [DEBUG] Retry Transport: Returning after 1 attempts
2022/02/01 13:04:19 [DEBUG] Got RUNNING while polling for operation operation-1643720649194-d10efeb9's status
2022/02/01 13:04:29 [DEBUG] Waiting for state to become: [success]
2022/02/01 13:04:29 [DEBUG] Retry Transport: starting RoundTrip retry loop
2022/02/01 13:04:29 [DEBUG] Retry Transport: request attempt 0
2022/02/01 13:04:29 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
GET /v1beta1/projects/REDACTED/locations/us-central1-a/operations/operation-1643720649194-d10efeb9?alt=json&prettyPrint=false HTTP/1.1
Host: container.googleapis.com
User-Agent: google-api-go-client/0.5 Terraform/1.1.4 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/acc
X-Goog-Api-Client: gl-go/1.17.6 gdcl/20211201
Accept-Encoding: gzip


-----------------------------------------------------
2022/02/01 13:04:29 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Tue, 01 Feb 2022 13:04:29 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
 "name": "operation-1643720649194-d10efeb9",
 "zone": "us-central1-a",
 "operationType": "UPGRADE_NODES",
 "status": "RUNNING",
 "selfLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/operations/operation-1643720649194-d10efeb9",
 "targetLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/clusters/tf-test-cluster-p19b92hvjm/nodePools/tf-test-nodepool-zjl91bcnec",
 "detail": "Updating tf-test-nodepool-zjl91bcnec, done with 0 out of 1 nodes (0.0%): 1 being processed",
 "startTime": "2022-02-01T13:04:09.194981254Z",
 "progress": {
  "metrics": [
   {
    "name": "NODES_TOTAL",
    "intValue": "1"
   },
   {
    "name": "NODES_FAILED",
    "intValue": "0"
   },
   {
    "name": "NODES_COMPLETE",
    "intValue": "0"
   },
   {
    "name": "NODES_DONE",
    "intValue": "0"
   },
   {
    "name": "NODE_PDB_DELAY_SECONDS",
    "intValue": "0"
   }
  ]
 }
}
-----------------------------------------------------
2022/02/01 13:04:29 [DEBUG] Retry Transport: Stopping retries, last request was successful
2022/02/01 13:04:29 [DEBUG] Retry Transport: Returning after 1 attempts
2022/02/01 13:04:29 [DEBUG] Got RUNNING while polling for operation operation-1643720649194-d10efeb9's status
2022/02/01 13:04:39 [DEBUG] Waiting for state to become: [success]
2022/02/01 13:04:39 [DEBUG] Retry Transport: starting RoundTrip retry loop
2022/02/01 13:04:39 [DEBUG] Retry Transport: request attempt 0
2022/02/01 13:04:39 [DEBUG] Google API Request Details:
---[ REQUEST ]---------------------------------------
GET /v1beta1/projects/REDACTED/locations/us-central1-a/operations/operation-1643720649194-d10efeb9?alt=json&prettyPrint=false HTTP/1.1
Host: container.googleapis.com
User-Agent: google-api-go-client/0.5 Terraform/1.1.4 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/acc
X-Goog-Api-Client: gl-go/1.17.6 gdcl/20211201
Accept-Encoding: gzip


-----------------------------------------------------
2022/02/01 13:04:39 [DEBUG] Google API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 200 OK
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Date: Tue, 01 Feb 2022 13:04:39 GMT
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
 "name": "operation-1643720649194-d10efeb9",
 "zone": "us-central1-a",
 "operationType": "UPGRADE_NODES",
 "status": "DONE",
 "statusMessage": "DeployPatch failed",
 "selfLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/operations/operation-1643720649194-d10efeb9",
 "targetLink": "https://container.googleapis.com/v1beta1/projects/550924169191/zones/us-central1-a/clusters/tf-test-cluster-p19b92hvjm/nodePools/tf-test-nodepool-zjl91bcnec",
 "detail": "DeployPatch failed",
 "startTime": "2022-02-01T13:04:09.194981254Z",
 "endTime": "2022-02-01T13:04:34.629091669Z",
 "progress": {
  "metrics": [
   {
    "name": "NODES_TOTAL",
    "intValue": "1"
   },
   {
    "name": "NODES_FAILED",
    "intValue": "1"
   },
   {
    "name": "NODES_COMPLETE",
    "intValue": "0"
   },
   {
    "name": "NODES_DONE",
    "intValue": "1"
   },
   {
    "name": "NODE_PDB_DELAY_SECONDS",
    "intValue": "0"
   }
  ]
 },
 "clusterConditions": [
  {
   "message": "DeployPatch failed",
   "canonicalCode": "UNKNOWN"
  }
 ],
 "error": {
  "code": 2,
  "message": "DeployPatch failed"
 }
}
-----------------------------------------------------
2022/02/01 13:04:39 [DEBUG] Retry Transport: Stopping retries, last request was successful
2022/02/01 13:04:39 [DEBUG] Retry Transport: Returning after 1 attempts
2022/02/01 13:04:39 [DEBUG] Unlocking "google-container-cluster/REDACTED/us-central1-a/tf-test-cluster-p19b92hvjm"
2022/02/01 13:04:39 [DEBUG] Unlocked "google-container-cluster/REDACTED/us-central1-a/tf-test-cluster-p19b92hvjm"
2022/02/01 13:04:39 [WARN] Got error running Terraform: exit status 1

Error: Error waiting for updating GKE node pool tags: DeployPatch failed

  with google_container_node_pool.np_with_node_config,
  on terraform_plugin_test.tf line 8, in resource "google_container_node_pool" "np_with_node_config":
   8: resource "google_container_node_pool" "np_with_node_config" {

    provider_test.go:286: Step 3/4 error: Error running apply: exit status 1
        
        Error: Error waiting for updating GKE node pool tags: DeployPatch failed
        
          with google_container_node_pool.np_with_node_config,
          on terraform_plugin_test.tf line 8, in resource "google_container_node_pool" "np_with_node_config":
           8: resource "google_container_node_pool" "np_with_node_config" {
    

upodroid avatar Feb 01 '22 17:02 upodroid

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 2 insertions(+), 4 deletions(-)) Terraform Beta: Diff ( 3 files changed, 51 insertions(+), 5 deletions(-)) TF Validator: Diff ( 1 file changed, 2 insertions(+), 4 deletions(-))

modular-magician avatar Feb 01 '22 17:02 modular-magician

I'm gonna hold on review until the API's working!

rileykarson avatar Feb 01 '22 17:02 rileykarson

Gotcha, let me check in with the GKE team to see what's going on (b/216689421).

jcanseco avatar Feb 04 '22 23:02 jcanseco

According to an internal discussion with GKE, it seems this should work now. @upodroid can you try again?

For TF team: see b/218333311#comment6.

jcanseco avatar Mar 25 '22 00:03 jcanseco

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 2 insertions(+), 4 deletions(-)) Terraform Beta: Diff ( 3 files changed, 51 insertions(+), 5 deletions(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Apr 04 '22 23:04 modular-magician

@rileykarson @jcanseco The test is passing now. The bug has been fixed.

upodroid avatar Apr 04 '22 23:04 upodroid

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 6 insertions(+), 4 deletions(-)) Terraform Beta: Diff ( 4 files changed, 55 insertions(+), 5 deletions(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Apr 04 '22 23:04 modular-magician

Awesome, thanks for confirming @upodroid!

jcanseco avatar Apr 04 '22 23:04 jcanseco

Tests rerun

modular-magician avatar Apr 05 '22 00:04 modular-magician

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 2 insertions(+), 4 deletions(-)) Terraform Beta: Diff ( 3 files changed, 51 insertions(+), 5 deletions(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Apr 05 '22 00:04 modular-magician

Tests count: Total tests: 1962 Passed tests 1721 Skipped tests: 234 Failed tests: 7

modular-magician avatar Apr 05 '22 01:04 modular-magician

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccContainerNodePool_withNodeConfig|TestAccContainerNodePool_withNodeConfigScopeAlias|TestAccContainerNodePool_withManagement|TestAccContainerCluster_withAuthenticatorGroupsConfig|TestAccComputeRegionTargetHttpsProxy_update|TestAccServiceNetworkingPeeredDNSDomain_basic|TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic

modular-magician avatar Apr 05 '22 01:04 modular-magician

Tests passed during RECORDING mode: TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic TestAccContainerNodePool_withManagement TestAccServiceNetworkingPeeredDNSDomain_basic TestAccContainerNodePool_withNodeConfigScopeAlias TestAccComputeRegionTargetHttpsProxy_update

Tests failed during RECORDING mode: TestAccContainerCluster_withAuthenticatorGroupsConfig TestAccContainerNodePool_withNodeConfig

Please fix these to complete your PR You can view the build log here: https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-5671/artifacts/9ef49957-468e-48cb-8439-3d0955f5d4a4/build-log/recording_test.log and the debug log for each test here: https://console.cloud.google.com/storage/browser/vcr-test-logs/beta/refs/heads/auto-pr-5671/artifacts/9ef49957-468e-48cb-8439-3d0955f5d4a4/recording

modular-magician avatar Apr 05 '22 01:04 modular-magician

I believe we're still getting the same old error:

Error: Error waiting for updating GKE node pool tags: DeployPatch failed

  with google_container_node_pool.np_with_node_config,
  on terraform_plugin_test.tf line 8, in resource "google_container_node_pool" "np_with_node_config":
   8: resource "google_container_node_pool" "np_with_node_config" {

rileykarson avatar Apr 06 '22 16:04 rileykarson

I didn't get that error. Have a look at this gist with the full debug log from my run earlier this week. https://gist.github.com/upodroid/1eddc671cac739a4bd34d817ed6e34ab

upodroid avatar Apr 06 '22 17:04 upodroid

Yep, I'm aware! The VCR recording did. I followed up w/ the service team internally.

rileykarson avatar Apr 06 '22 17:04 rileykarson

Could this PR also include taints and labels? I was in the process of creating my own PR but there is no point if this PR can do the same thing.

References:

  • https://github.com/hashicorp/terraform-provider-google/pull/11910
  • https://github.com/GoogleCloudPlatform/magic-modules/compare/main...justdan96:magic-modules:main

justdan96 avatar Jul 05 '22 12:07 justdan96