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

Update spanner instance edition logic for direct controller #3948

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

anhdle-sso
Copy link
Collaborator

@anhdle-sso anhdle-sso commented Mar 11, 2025

Change description

  • Default Edition to STANDARD as EDITION_UNSPECIFIED no longer allowed.
  • Block Edition downgrade due to API restrictions.

Tests you have done

  • Run make ready-pr to ensure this PR is ready for review.
  • Perform necessary E2E testing for changed resources.

@@ -93,6 +93,12 @@ func SpannerInstanceSpec_ToProto(mapCtx *direct.MapContext, in *krm.SpannerInsta
out.DisplayName = in.DisplayName
out.NodeCount = direct.ValueOf(in.NumNodes)
out.ProcessingUnits = direct.ValueOf(in.ProcessingUnits)
// if edition is unspecified, Spanner API default edition to STANDARD.
// Spanner API bans downgrade edition from STANDARD to unspecifed,
// which cause infinite reconcile loop.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good to know.
Is "unspecified" allowed? In other words, does the server give a default value when creating a SpannerInstance without the edition? Is it allowed to downgrade edition to other values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unspecicied value is no longer allowed. STANDARD is the new default. Downgrading is technically possible but I plan to block it due to the constrains (from other resources).

Copy link
Collaborator

@yuwenma yuwenma left a comment

Choose a reason for hiding this comment

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

/approve

Looks good. One question about whether we should consider to allow unsetting the field.

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yuwenma

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@anhdle-sso
Copy link
Collaborator Author

/approve

Looks good. One question about whether we should consider to allow unsetting the field.

@anhdle-sso anhdle-sso closed this Mar 11, 2025
@anhdle-sso
Copy link
Collaborator Author

/approve

Looks good. One question about whether we should consider to allow unsetting the field.

I added the logic where we blocked downgrade edition. If users do not specify edition, we default to standard in mapping but won't update the edition (because it is treated as downgrade). Effectively, the field become unmanaged.

@anhdle-sso anhdle-sso reopened this Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants