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 AlloyDB Cluster Major Version Upgrade #11639

Closed
wants to merge 2 commits into from

Conversation

GauravJain21
Copy link
Contributor

@GauravJain21 GauravJain21 commented Sep 5, 2024

Add support for AlloyDB Cluster Major Version Upgrade

This PR adds support for allowing users to upgrade their AlloyDB cluster's PG major version by just updating the database_version field inside the cluster.

Release Note Template for Downstream PRs (will be copied)

alloydb: added support for upgrading `database_version` in `google_alloydb_cluster` resource

@github-actions github-actions bot requested a review from zli82016 September 5, 2024 06:56
Copy link

github-actions bot commented Sep 5, 2024

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

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

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

google provider: Diff ( 2 files changed, 126 insertions(+), 6 deletions(-))
google-beta provider: Diff ( 2 files changed, 126 insertions(+), 6 deletions(-))

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

google provider: Diff ( 3 files changed, 133 insertions(+), 11 deletions(-))
google-beta provider: Diff ( 3 files changed, 133 insertions(+), 11 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 68
Skipped tests: 4
Affected tests: 2

Click here to see the affected service packages
  • alloydb

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_update
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

1 similar comment
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 68
Skipped tests: 4
Affected tests: 2

Click here to see the affected service packages
  • alloydb

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_update
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccAlloydbCluster_update[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccAlloydbCluster_upgrade[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccAlloydbCluster_update[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccAlloydbCluster_upgrade[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@GauravJain21
Copy link
Contributor Author

This is failing because the beta provider is trying to hit the v1beta endpoint which isn't rolled out yet. The API rollout is in progress and v1beta is supposed to be visible this week.

@zli82016 Can you please review this CL ignoring the VCR test?

mmv1/templates/terraform/pre_update/alloydb_cluster.go.erb Outdated Show resolved Hide resolved
}
upgradeUrl = strings.Replace(upgradeUrl, "/v1/", "/v1alpha/", 1)

upgradeClusterTimeout := 72 * time.Hour
Copy link
Member

Choose a reason for hiding this comment

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

Is the timeout 72 hour? It is too long for an operation's wait time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Actually, AlloyDB cluster upgrade is an LRO which can take up to 3 days in worst case.

Are there any repercussions of keeping this long a wait time? Will the TF code break or will there be any issues that can come due to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confirmed with the team, we have 58 hours of wait time out on this LRO.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the information. Do you know how long will it cost on average?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are no average numbers as we haven't done the profiling on the AlloyDB fleet.

The upgrades in our shadow testing takes around 1 to 3 hours for initial numbers.

The total time depends on the size of the database and the number of database objects.

Copy link
Member

@zli82016 zli82016 Sep 16, 2024

Choose a reason for hiding this comment

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

A client side field skip_await_version_upgrade defaulted to true can be used to indicated waiting for the LRO or not.
Doc: https://googlecloudplatform.github.io/magic-modules/develop/client-side-fields/

Example: skip_await_rollout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Zhenhua for helping me with this flag! Can you help me understand the there a problem with a long wait time?

Copy link
Member

Choose a reason for hiding this comment

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

The purpose of this flag is to allow the users to do other tasks with Terraform instead of having to wait for long time. Without the flag, the users have to wait until the update is complete and cannot do anything else.

Copy link
Member

Choose a reason for hiding this comment

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

@GauravJain21 , do you have any questions about this flag? Thanks.

@zli82016
Copy link
Member

zli82016 commented Sep 6, 2024

There is a yaml lint error:

repo/mmv1/products/alloydb/Cluster.yaml
  Error: 269:116 [trailing-spaces] trailing spaces

@github-actions github-actions bot requested a review from zli82016 September 9, 2024 05:50
@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.

google provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))
google-beta provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 69
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • alloydb

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

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

google provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))
google-beta provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 69
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • alloydb

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

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

google provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))
google-beta provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccAlloydbCluster_upgrade[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 69
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • alloydb

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

@GauravJain21
Copy link
Contributor Author

This PR will likely keep failing till the API rollout is not complete. I will update here when the API rollout is complete and we have allow listed the TF project used to run the VCR tests.

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccAlloydbCluster_upgrade[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@zli82016
Copy link
Member

zli82016 commented Sep 9, 2024

/gcbrun

1 similar comment
@zli82016
Copy link
Member

zli82016 commented Sep 9, 2024

/gcbrun

@zli82016
Copy link
Member

zli82016 commented Sep 9, 2024

Do you mind removing output_upgrade.log, which caused the presubmit checks being cancelled? Thanks.

@GauravJain21
Copy link
Contributor Author

@zli82016 ohh, my bad! Removed the file from the PR.

Thanks!

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

google provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))
google-beta provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 69
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • alloydb

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccAlloydbCluster_upgrade[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

Copy link
Member

@zli82016 zli82016 left a comment

Choose a reason for hiding this comment

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

Add a flag to skip the long LRO updating.

@GauravJain21
Copy link
Contributor Author

Add a flag to skip the long LRO updating.

Can you please help me understand what this means and why to do it?

@github-actions github-actions bot requested a review from zli82016 September 23, 2024 05:05
@zli82016
Copy link
Member

Add a flag to skip the long LRO updating.

Can you please help me understand what this means and why to do it?

Please see the comment .

skip_await_version_upgrade is defaulted to true. The users can set skip_await_version_upgrade to false in the Terraform configuration. When skip_await_version_upgrade is set to true, the users don't need to wait for the long LRO to complete. When it is set to false, the users will wait for the long LRO to complete. Because of the version upgrading may take too long, the flag provides the users an option to wait or not.

@c2thorn
Copy link
Member

c2thorn commented Sep 24, 2024

Hi @GauravJain21

Tomorrow, the Magic Modules repository is scheduled to undergo a language migration from Ruby to Go. You can view more details about this in our announcement here: hashicorp/terraform-provider-google#19583 (or go/mm-migration-announcement if you are a Googler)

This open pull request may become incompatible due to most YAML and .erb files converting to Go-compatible files.

Our team (Magic Modules repository maintainers) has tooling to automatically convert changes to the new language, and we can prepare a new commit for this pull request that is compatible with the migration.

In order to push the new changes to your pull request, we would need to force push the commit to your fork's branch. Our tooling saves a backup branch before converting, so we could rollback or open a new pull request if needed. We would also work with you and the PR reviewer in the event additional changes are needed.

You also have the option to update the pull request yourself after the migration. You can view a preview branch and updated documentation related to the migration changes.

We will take no action until we have your explicit permission to push changes to your fork's branch used for this pull request. Let me or your reviewer know if you have any further questions!

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

google provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))
google-beta provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 69
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • alloydb

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccAlloydbCluster_upgrade[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

Copy link

@zli82016 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link
Member

@zli82016 zli82016 left a comment

Choose a reason for hiding this comment

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

Add the field skip_await_version_upgrade

Copy link

@GauravJain21, this PR is waiting for action from you. If no action is taken, this PR will be closed in 28 days.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

@github-actions github-actions bot requested a review from zli82016 October 14, 2024 06:51
@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.

google provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))
google-beta provider: Diff ( 3 files changed, 132 insertions(+), 11 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 74
Passed tests: 69
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • alloydb

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAlloydbCluster_upgrade

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccAlloydbCluster_upgrade[Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@zli82016
Copy link
Member

This is failing because the beta provider is trying to hit the v1beta endpoint which isn't rolled out yet. The API rollout is in progress and v1beta is supposed to be visible this week.

@zli82016 Can you please review this CL ignoring the VCR test?

@GauravJain21 , what is the status of the API rollout? Is this PR ready for review? Thanks.

Copy link

@GauravJain21, this PR is waiting for action from you. If no action is taken, this PR will be closed in 28 days.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

Copy link

@GauravJain21, this PR is waiting for action from you. If no action is taken, this PR will be closed in 14 days.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

Copy link

@GauravJain21, this PR is waiting for action from you. If no action is taken, this PR will be closed in 2 weekdays.

Please address any comments or change requests, or re-request review from a core reviewer if no action is required.

Image showing the re-request review button

This notification can be disabled with the disable-automatic-closure label.

Copy link

@GauravJain21, this PR is being closed due to inactivity.

@github-actions github-actions bot closed this Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants