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

Cloud SQL create and update polish #7159

Merged
merged 6 commits into from
May 10, 2024
Merged

Conversation

fredzqm
Copy link
Contributor

@fredzqm fredzqm commented May 10, 2024

Description

  1. Explain why update instance is needed

  2. Make create database optional. It fails if CSQL is in the middle of some operations.
    Common example is linking an instance just created in cloud console.

  3. Update the create setting a bit to match the default query insights configs.
    Otherwise, any instances created via CLI would override it to 0... I consider this a CSQL bug, but see also http://cl/629192474

When customer click edit instance, do nothing and then click save, they see this:
Screenshot 2024-05-09 at 8 58 40 PM

  1. CSQL database creation is optional because the backend would try that as well. If there is an ongoing LRO, we CLI can skip this step.

Scenarios Tested

Print update reason:
Screenshot 2024-05-10 at 10 39 32 AM

Sample Commands

@fredzqm fredzqm changed the title Set defaults for query insights Cloud SQL create and update polish May 10, 2024
@@ -27,13 +27,14 @@ export async function provisionCloudSql(args: {
const existingInstance = await cloudSqlAdminClient.getInstance(projectId, instanceId);
silent || utils.logLabeledBullet("dataconnect", `Found existing instance ${instanceId}.`);
connectionName = existingInstance?.connectionName || "";
if (!checkInstanceConfig(existingInstance, enableGoogleMlIntegration)) {
const why = checkInstanceConfig(existingInstance, enableGoogleMlIntegration);
if (why) {
// TODO: Return message from checkInstanceConfig to explain exactly what changes are made
Copy link
Member

Choose a reason for hiding this comment

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

This TODO can be removed now, right?

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

const settings = instance.settings;
// CloudSQL instances must have public IP enabled to be used with Firebase Data Connect.
if (!settings.ipConfiguration?.ipv4Enabled) {
return false;
return "enable public IP";
Copy link
Member

Choose a reason for hiding this comment

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

Should this add to an array of reasons, so this method returns all the things that need to be updated, rather than just the first one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Changed it to append to the reason string, so will display it as a list.

@@ -95,23 +106,23 @@ export async function provisionCloudSql(args: {
export function checkInstanceConfig(
Copy link
Member

Choose a reason for hiding this comment

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

nit: Maybe rename to getUpdateReason and have this return an array of string reasons?

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

@fredzqm fredzqm enabled auto-merge (squash) May 10, 2024 17:40
@fredzqm
Copy link
Contributor Author

fredzqm commented May 10, 2024

Thank you for the review~ Addressed feedbacks~

@fredzqm fredzqm changed the base branch from master to dataconnect May 10, 2024 17:59
@fredzqm fredzqm disabled auto-merge May 10, 2024 18:01
@fredzqm fredzqm merged commit 746c042 into dataconnect May 10, 2024
34 of 35 checks passed
@fredzqm fredzqm deleted the fz/query-insights-default branch May 10, 2024 18:01
joehan added a commit that referenced this pull request May 20, 2024
* Cloud SQL create and update polish (#7159)

* improve logged message execute SQL commands (#7156)

* Error handling and logging when linking CSQL instance (#7158)

* Display accurate message for INACCESSIBLE_SCHEMA error (#7157)

* handle INACCESSIBLE_SCHEMA case separately

* error msg

* m

* m

* m

* merge

* feedbacks

* Jh idx no metadata calls (#7179)

* Avoid triggering metadata server calls in idx

* Remove outdated service account check

* Update Firebase Logo (#7180)

* unleash turtles (#7174)

* unleash turtles

* Update CHANGELOG.md

* Flag flip for gen kit (#7175)

* Flag flip for gen kit

* Update CHANGELOG.md

* update icons

---------

Co-authored-by: Bryan Kendall <bkend@google.com>
Co-authored-by: joehan <joehanley@google.com>

* Use client instead of size 1 pool (#7182)

* Fix schema validation (#7185)

* Fix schema validation

* Also depend on redhat.yaml

* fix typo

---------

Co-authored-by: Fred Zhang <fredzqm@google.com>
Co-authored-by: Harold Shen <hlshen@google.com>
Co-authored-by: Bryan Kendall <bkend@google.com>
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.

None yet

2 participants