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

Added upgrade_settings with validation for SURGE strategy with promoting min_cpu_platform to GA #6815

Merged
merged 11 commits into from Dec 8, 2022

Conversation

mitj04
Copy link
Contributor

@mitj04 mitj04 commented Nov 11, 2022

part of hashicorp/terraform-provider-google#9180

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 `auto_provisioning_defaults.cluster_autoscaling.upgrade_settings` in `google_container_cluster`
container: promoted `min_cpu_platform` in `google_container_cluster` to GA

@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@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. @slevenick, 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.


@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 365 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 315 insertions(+), 39 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2243
Passed tests 1992
Skipped tests: 241
Failed tests: 10

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccBillingSubaccount_renameOnDestroy|TestAccFirebaserulesRelease_BasicRelease|TestAccContainerCluster_autoprovisioningDefaultsManagement|TestAccContainerCluster_nodeAutoprovisioningDefaultsShieldedInstance|TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType|TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskType|TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey|TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskSizeGb|TestAccContainerCluster_nodeAutoprovisioningDefaults|TestAccContainerCluster_nodeAutoprovisioning

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccBillingSubaccount_renameOnDestroy[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccContainerCluster_autoprovisioningDefaultsManagement[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsShieldedInstance[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsImageType[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskType[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsBootDiskKmsKey[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaultsDiskSizeGb[Debug log]
TestAccContainerCluster_nodeAutoprovisioningDefaults[Debug log]
TestAccContainerCluster_nodeAutoprovisioning[Debug log]

All tests passed
View the build log or the debug log for each test

@mitj04 mitj04 marked this pull request as ready for review November 12, 2022 04:48
@shuyama1 shuyama1 requested review from shuyama1 and removed request for slevenick November 12, 2022 19:42
})
}

func TestAccContainerCluster_autoprovisioningDefaultsUpgradeSettings(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we also add another acceptance test that verifies the creation/update of blue_green upgrade? Current tests only test the Surge upgrade.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 408 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 358 insertions(+), 39 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2272
Passed tests 2025
Skipped tests: 244
Failed tests: 3

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFirebaserulesRelease_BasicRelease|TestAccContainerClusterCustomServiceAccount_withAutopilot|TestAccContainerCluster_autoprovisioningDefaultsUpgradeSettings

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccContainerClusterCustomServiceAccount_withAutopilot[Debug log]
TestAccContainerCluster_autoprovisioningDefaultsUpgradeSettings[Debug log]

All tests passed
View the build log or the debug log for each test

Comment on lines +629 to +638
"max_surge": {
Type: schema.TypeInt,
Optional: true,
Description: `The maximum number of nodes that can be created beyond the current size of the node pool during the upgrade process.`,
},
"max_unavailable": {
Type: schema.TypeInt,
Optional: true,
Description: `The maximum number of nodes that can be simultaneously unavailable during the upgrade process.`,
},
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we remove the computed from these two field. I wonder if the API will return values for these two fields if we don't explicitly specify them for surge upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The max_surge and max_unavailable values in this case have been verified to be only necessary for the SURGE. The strategy from SURGE to BLUE GREEN cannot be updated if we leave this attrs in its computed state since d.GetOk will utilise its last stetted value if its values are not present in the current tf file. As a result, even though we didn't include it in the tf file, it will assume that we have provided its (max_surge/max_unavailable) value and initiate the validation.

The ideal scenario would be to enable us to switch from an SURGE strategy to a BLUE GREEN strategy by removing the SURGE attrs (max surge and max unavailable) and adding the BLUE GREEN settings.

In a different instance, API returned zero values and set them into a state file for the blue_green_settings(which not having computed:True) and resulted in an indication that changes needed to be updated in the subsequent apply even though there were no changes in the TF file. I have added computed:True for it in the next commit.

max_surge and max_unavailable, however, are of the Int type. Due to this, it will consider computed to be zero and set its value to 0 if we don't supply computed as True.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 413 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 363 insertions(+), 39 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2278
Passed tests 2032
Skipped tests: 244
Failed tests: 2

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccLoggingBucketConfigProject_cmekSettings|TestAccFirebaserulesRelease_BasicRelease

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccLoggingBucketConfigProject_cmekSettings[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]

All tests passed
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 in general!
GA test running: https://ci-oss.hashicorp.engineering/buildConfiguration/GoogleCloud_ProviderGoogleCloudMmUpstream/356190

Will approve it after the tests pass

Comment on lines 3956 to 3963
OauthScopes: convertStringArr(config["oauth_scopes"].([]interface{})),
ServiceAccount: config["service_account"].(string),
DiskSizeGb: int64(config["disk_size"].(int)),
DiskType: config["disk_type"].(string),
ImageType: config["image_type"].(string),
BootDiskKmsKey: config["boot_disk_kms_key"].(string),
Management: expandManagement(config["management"]),
UpgradeSettings: expandUpgradeSettings(config["upgrade_settings"]),
Copy link
Member

Choose a reason for hiding this comment

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

Only nit: spacing is a bit off here.

}

return fmt.Sprintf(`
resource "google_container_cluster" "with_autoprovisioning_upgrade_settings" {
Copy link
Member

Choose a reason for hiding this comment

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

nit: spacing: we use spaces instead of tabs for resource config.


func testAccContainerCluster_autoprovisioningDefaultsUpgradeSettingsWithBlueGreenStrategy(clusterName string, duration, strategy string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_autoprovisioning_upgrade_settings" {
Copy link
Member

Choose a reason for hiding this comment

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

nit: spacing

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 413 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 363 insertions(+), 39 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2302
Passed tests 2048
Skipped tests: 244
Failed tests: 10

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccLoggingBucketConfigProject_cmekSettings|TestAccDataFusionInstance_dataFusionInstanceZoneExample|TestAccDataFusionInstance_dataFusionInstanceEventExample|TestAccDataFusionInstance_dataFusionInstanceFullExample|TestAccVertexAIIndex_updated|TestAccVertexAIIndex_vertexAiIndexStreamingExample|TestAccVertexAIIndex_vertexAiIndexExample|TestAccDataFusionInstanceIamPolicyGenerated|TestAccDataFusionInstanceIamMemberGenerated|TestAccDataFusionInstanceIamBindingGenerated

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccLoggingBucketConfigProject_cmekSettings[Debug log]
TestAccDataFusionInstance_dataFusionInstanceZoneExample[Debug log]
TestAccDataFusionInstance_dataFusionInstanceEventExample[Debug log]
TestAccDataFusionInstance_dataFusionInstanceFullExample[Debug log]
TestAccVertexAIIndex_updated[Debug log]
TestAccVertexAIIndex_vertexAiIndexStreamingExample[Debug log]
TestAccVertexAIIndex_vertexAiIndexExample[Debug log]
TestAccDataFusionInstanceIamPolicyGenerated[Debug log]
TestAccDataFusionInstanceIamMemberGenerated[Debug log]
TestAccDataFusionInstanceIamBindingGenerated[Debug log]

All tests passed
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.

Apologize for the delay on reviewing this. LGTM! Would you mind rebasing it? Should be good to go after.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 413 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 363 insertions(+), 39 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2325
Passed tests 2078
Skipped tests: 244
Failed tests: 3

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccLoggingBucketConfigProject_cmekSettings|TestAccFirebaserulesRelease_BasicRelease|TestAccContainerNodePool_withUpgradeSettings

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccLoggingBucketConfigProject_cmekSettings[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccContainerNodePool_withUpgradeSettings[Debug log]

All tests passed
View the build log or the debug log for each test

@shuyama1
Copy link
Member

shuyama1 commented Dec 7, 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.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 3 files changed, 413 insertions(+), 7 deletions(-))
Terraform Beta: Diff ( 3 files changed, 363 insertions(+), 39 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2329
Passed tests 2083
Skipped tests: 244
Failed tests: 2

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFirebaserulesRelease_BasicRelease|TestAccLoggingBucketConfigProject_cmekSettings

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccLoggingBucketConfigProject_cmekSettings[Debug log]

All tests passed
View the build log or the debug log for each test

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