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 CloudSQL option for accounts-db, ledger-db #383

Merged
merged 17 commits into from
Nov 30, 2020
Merged

Add CloudSQL option for accounts-db, ledger-db #383

merged 17 commits into from
Nov 30, 2020

Conversation

cloud-pharaoh
Copy link
Member

@cloud-pharaoh cloud-pharaoh commented Oct 20, 2020

Change summary: Adds a Cloud SQL option for the in-cluster Postgres ledger-db and accounts-db.

Added:

  • setup script for the Cloud SQL instance
  • setup script for workload identity configuring Cloud SQL access from pods
  • two K8s jobs to populate Cloud SQL DBs with test data - source: Google Cloud Solutions team
  • a version of the k8s deployments with cloud SQL proxy sidecar containers
  • README with setup steps
  • link from main README to the cloudsql directory

Follow-up work (filed issues for these).

  • Add instructions without Workload Identity
  • Deploy one cloud sql proxy to be accessed by both services (suggestion by @bharathkkb)
  • Add tests for the Cloud SQL option, tests should run the setup scripts.
  • Add kustomize to each deploy option (default, workload identity, cloud sql, ledger monolith) to avoid duplicating manifests within the repo, causing the YAML to get out of sync with the latest releases
  • Test with ASM-enabled cluster to verify Cloud SQL proxy -> Cloud SQL connectivity when there is another sidecar container in the pod (Envoy)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 20, 2020
@cloud-pharaoh cloud-pharaoh changed the title Add deployment option with Cloud SQL for accounts-db WIP: Add deployment option with Cloud SQL for accounts-db Oct 20, 2020
@cloud-pharaoh cloud-pharaoh marked this pull request as draft October 20, 2020 19:50
@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@askmeegs
Copy link
Collaborator

Hi Amina! This looks good, I got the Cloud SQL instructions working on my ASM-enabled WI cluster.
A few small readme comments, otherwise I have only 1 outstanding concern which is -- the in-cluster postgres accounts db loads in test data (here) with a test user and password / prepopulates contacts.

Ideally we have consistency between the in-cluster and Cloud SQL postgres DBs. Not sure how to turn the load_testdata script into a set of raw SQL commands. But ideally we add this data in the step when the user creates the tables manually.

@mathieu-benoit
Copy link
Contributor

mathieu-benoit commented Oct 30, 2020

Hi @askmeegs and @cloud-pharaoh, I think that's indeed a great idea to have an option to leverage Cloud SQL here.

I may have few questions:

Just sharing and wondering, thanks!

@github-actions
Copy link

github-actions bot commented Nov 9, 2020

🚀 PR staged at http://35.223.94.0

@cloud-pharaoh
Copy link
Member Author

Hi @askmeegs and @cloud-pharaoh, I think that's indeed a great idea to have an option to leverage Cloud SQL here.

Hi Mathieu,
Thanks for these comments and questions :)

I may have few questions:

  • I think this command gcloud services enable sqladmin.googleapis.com in your instructions is missing otherwise the cloud-sql-proxy containers will complain. At least I needed to do this to make them running properly.

Good catch. I do that in terraform in my test set up and I didn't realize it wasn't here. Added to the instructions.

  • Any chance to leverage the new and smaller gcr.io/cloudsql-docker/gce-proxy:1.18.0-alpine image instead of gcr.io/cloudsql-docker/gce-proxy:1.17?

No reason why we cannot. Just needs to be tested to make sure all is good. @askmeegs

The comment seems to imply that is the default behavior or am I misunderstanding?

  • I'm wondering, is it possible to move the ledger-db in Cloud SQL too? I think that will complete this PR to get rid of the postgresql as containers and have a more robust and cloud native way to deal with postgresql.

Very possible. I just wanted to show an example with one of them. @askmeegs up to you now Megan if you want to do it later or as part of this PR.

A k8s Job would be a good way to run this initialization script.

Just sharing and wondering, thanks!

@github-actions
Copy link

github-actions bot commented Nov 9, 2020

🚀 PR staged at http://35.223.94.0

@github-actions
Copy link

github-actions bot commented Nov 9, 2020

🚀 PR staged at http://35.223.94.0

@askmeegs askmeegs self-assigned this Nov 22, 2020
@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@askmeegs askmeegs changed the title WIP: Add deployment option with Cloud SQL for accounts-db Add CloudSQL option for accounts-db, ledger-db Nov 23, 2020
@askmeegs askmeegs marked this pull request as ready for review November 23, 2020 00:20
@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

1 similar comment
@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

Copy link
Contributor

@mathieu-benoit mathieu-benoit left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link

🚀 PR staged at http://35.223.94.0

@askmeegs askmeegs merged commit 536f921 into master Nov 30, 2020
@askmeegs askmeegs deleted the cloudsql branch December 15, 2020 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants