Skip to content
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

Add support for disk config on the GKE Node Auto provisioning #6649

Conversation

mrvarmazyar
Copy link
Contributor

@mrvarmazyar mrvarmazyar commented Oct 5, 2022

In this PR, I've added the feature to pass the disk_size and disk_type on the GKE node auto provisioning defaults to specify and change the default values on the provisioned nodes by NAP.

Related Configurations on the Google API: Link
Related issue: hashicorp/terraform-provider-google#12722

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

  • 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).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • 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).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

container: Added support for the Disk type and size configuration on the GKE Node Auto-provisioning

@modular-magician
Copy link
Collaborator

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

I've detected that you're a community contributor. @shuyama1, a repository maintainer, has been assigned to assist you and help review your changes.

❓ First time contributing? Click here for more details

Your assigned reviewer will help review your code by:

  • Ensuring it's backwards compatible, covers common error cases, etc.
  • Summarizing the change into a user-facing changelog note.
  • Passes tests, either our "VCR" suite, a set of presubmit tests, or with manual test runs.

You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails.

If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox.


@shuyama1
Copy link
Member

shuyama1 commented Oct 5, 2022

/gcbrun

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build failed due to error:
google/resource_container_cluster.go:3138:19: cannot use config["disk_size"].(int) (comma, ok expression of type int) as type int64 in struct literal
Therefore, proposed following changes.

@modular-magician
Copy link
Collaborator

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

Diff report:

Terraform GA: Diff ( 3 files changed, 152 insertions(+))
Terraform Beta: Diff ( 3 files changed, 152 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2208
Passed tests 1960
Skipped tests: 240
Failed tests: 8

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccContainerCluster_nodeAutoprovisioningDefaultsMinCpuPlatform|TestAccContainerCluster_nodeAutoprovisioningDefaults|TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskType|TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType|TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskSizeGb|TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccContainerCluster_nodeAutoprovisioningDefaults[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskType[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskSizeGb[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey[Debug log]

Tests failed during RECORDING mode:
TestAccContainerCluster_nodeAutoprovisioningDefaultsMinCpuPlatform[Error message] [Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType[Error message] [Debug log]
TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log]
TestAccCGCSnippet_eventarcWorkflowsExample[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@shuyama1
Copy link
Member

shuyama1 commented Oct 7, 2022

Related tests failed due to error:

provider_test.go:315: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
        
        (map[string]string) (len=54) {
         (string) (len=11) "node_pool.#": (string) (len=1) "2",
         (string) (len=13) "node_pool.1.%": (string) (len=2) "15",
         (string) (len=25) "node_pool.1.autoscaling.#": (string) (len=1) "1",
         (string) (len=27) "node_pool.1.autoscaling.0.%": (string) (len=1) "5",
         (string) (len=41) "node_pool.1.autoscaling.0.location_policy": (string) "",
         (string) (len=40) "node_pool.1.autoscaling.0.max_node_count": (string) (len=4) "1000",
         (string) (len=40) "node_pool.1.autoscaling.0.min_node_count": (string) (len=1) "0",
         (string) (len=46) "node_pool.1.autoscaling.0.total_max_node_count": (string) (len=1) "0",
         (string) (len=46) "node_pool.1.autoscaling.0.total_min_node_count": (string) (len=1) "0",
         (string) (len=30) "node_pool.1.initial_node_count": (string) (len=1) "0",
         (string) (len=33) "node_pool.1.instance_group_urls.#": (string) (len=1) "1",
         (string) (len=33) "node_pool.1.instance_group_urls.0": (string) (len=162) "https://www.googleapis.com/compute/v1/projects/ci-test-project-188019/zones/us-central1-a/instanceGroupManagers/gke-tf-test-cluster--nap-e2-medium-1v-ea9d0b6c-grp",
         (string) (len=41) "node_pool.1.managed_instance_group_urls.#": (string) (len=1) "1",
         (string) (len=41) "node_pool.1.managed_instance_group_urls.0": (string) (len=157) "https://www.googleapis.com/compute/beta/projects/ci-test-project-188019/zones/us-central1-a/instanceGroups/gke-tf-test-cluster--nap-e2-medium-1v-ea9d0b6c-grp",
         (string) (len=24) "node_pool.1.management.#": (string) (len=1) "1",
         (string) (len=26) "node_pool.1.management.0.%": (string) (len=1) "2",
         (string) (len=36) "node_pool.1.management.0.auto_repair": (string) (len=4) "true",
         (string) (len=37) "node_pool.1.management.0.auto_upgrade": (string) (len=4) "true",
         (string) (len=29) "node_pool.1.max_pods_per_node": (string) (len=1) "0",
         (string) (len=16) "node_pool.1.name": (string) (len=22) "nap-e2-medium-1vp52gpm",
         (string) (len=23) "node_pool.1.name_prefix": (string) "",
         (string) (len=25) "node_pool.1.node_config.#": (string) (len=1) "1",
         (string) (len=27) "node_pool.1.node_config.0.%": (string) (len=2) "26",
         (string) (len=43) "node_pool.1.node_config.0.boot_disk_kms_key": (string) "",
         (string) (len=38) "node_pool.1.node_config.0.disk_size_gb": (string) (len=3) "100",
         (string) (len=35) "node_pool.1.node_config.0.disk_type": (string) (len=11) "pd-standard",
         (string) (len=36) "node_pool.1.node_config.0.image_type": (string) (len=14) "COS_CONTAINERD",
         (string) (len=41) "node_pool.1.node_config.0.local_ssd_count": (string) (len=1) "0",
         (string) (len=38) "node_pool.1.node_config.0.machine_type": (string) (len=9) "e2-medium",
         (string) (len=36) "node_pool.1.node_config.0.metadata.%": (string) (len=1) "1",
         (string) (len=59) "node_pool.1.node_config.0.metadata.disable-legacy-endpoints": (string) (len=4) "true",
         (string) (len=42) "node_pool.1.node_config.0.min_cpu_platform": (string) "",
         (string) (len=36) "node_pool.1.node_config.0.node_group": (string) "",
         (string) (len=40) "node_pool.1.node_config.0.oauth_scopes.#": (string) (len=1) "2",
         (string) (len=40) "node_pool.1.node_config.0.oauth_scopes.0": (string) (len=46) "https://www.googleapis.com/auth/cloud-platform",
         (string) (len=40) "node_pool.1.node_config.0.oauth_scopes.1": (string) (len=46) "https://www.googleapis.com/auth/userinfo.email",
         (string) (len=37) "node_pool.1.node_config.0.preemptible": (string) (len=5) "false",
         (string) (len=41) "node_pool.1.node_config.0.service_account": (string) (len=7) "default",
         (string) (len=52) "node_pool.1.node_config.0.shielded_instance_config.#": (string) (len=1) "1",
         (string) (len=54) "node_pool.1.node_config.0.shielded_instance_config.0.%": (string) (len=1) "2",
         (string) (len=80) "node_pool.1.node_config.0.shielded_instance_config.0.enable_integrity_monitoring": (string) (len=4) "true",
         (string) (len=71) "node_pool.1.node_config.0.shielded_instance_config.0.enable_secure_boot": (string) (len=5) "false",
         (string) (len=30) "node_pool.1.node_config.0.spot": (string) (len=5) "false",
         (string) (len=22) "node_pool.1.node_count": (string) (len=1) "0",
         (string) (len=28) "node_pool.1.node_locations.#": (string) (len=1) "1",
         (string) (len=28) "node_pool.1.node_locations.0": (string) (len=13) "us-central1-a",
         (string) (len=30) "node_pool.1.placement_policy.#": (string) (len=1) "1",
         (string) (len=32) "node_pool.1.placement_policy.0.%": (string) (len=1) "1",
         (string) (len=35) "node_pool.1.placement_policy.0.type": (string) "",
         (string) (len=30) "node_pool.1.upgrade_settings.#": (string) (len=1) "1",
         (string) (len=32) "node_pool.1.upgrade_settings.0.%": (string) (len=1) "2",
         (string) (len=40) "node_pool.1.upgrade_settings.0.max_surge": (string) (len=1) "1",
         (string) (len=46) "node_pool.1.upgrade_settings.0.max_unavailable": (string) (len=1) "0",
         (string) (len=19) "node_pool.1.version": (string) (len=14) "1.24.4-gke.800"
        }
        
        
        (map[string]string) (len=1) {
         (string) (len=11) "node_pool.#": (string) (len=1) "1"
        }

@mrvarmazyar
Copy link
Contributor Author

mrvarmazyar commented Oct 7, 2022

@shuyama1 Thanks, since the API accepts the disk size as an integer and on the other hand I don't see the full test log, should I change the disk_size_gb to string?

Related tests failed due to error:

provider_test.go:315: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
        
        (map[string]string) (len=54) {
.
.
         (string) (len=38) "node_pool.1.node_config.0.disk_size_gb": (string) (len=3) "100",
         (string) (len=35) "node_pool.1.node_config.0.disk_type": (string) (len=11) "pd-standard",
.
.

@shuyama1
Copy link
Member

/gcbrun

@modular-magician
Copy link
Collaborator

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

Diff report:

Terraform GA: Diff ( 3 files changed, 152 insertions(+))
Terraform Beta: Diff ( 3 files changed, 152 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2218
Passed tests 1973
Skipped tests: 240
Failed tests: 5

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFirebaserulesRelease_BasicRelease|TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType|TestAccContainerCluster_nodeAutoprovisioningDefaultsMinCpuPlatform|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsMinCpuPlatform[Debug log]

Tests failed during RECORDING mode:
TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log]
TestAccCGCSnippet_eventarcWorkflowsExample[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants