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

Use rqlite instead of Postgres #3335

Merged

Conversation

sgalsaleh
Copy link
Member

@sgalsaleh sgalsaleh commented Oct 19, 2022

What this PR does / why we need it:

Replaces Postgres with rqlite because:

  • rqlite supports data replication at the application layer which removes the need for infrastructure-distributed storage.
  • rqlite is more lightweight

Which issue(s) this PR fixes:

Fixes SC-60222

Special notes for your reviewer:

New Installs:

  • New installs will deploy and use an instance of rqlite instead of Postgres.

Upgrades and migration notes:

  • Postgres's schema is always updated to the most recent version (e.g. currently the schema in KOTS 1.88) before running the migration. This makes the migration process much simpler since there would only be a single permutation for the migration to cover. It also ensures a smoother migration process from older versions of KOTS that have outdated schemas.

  • The migration process will only be triggered if Postgres is detected AND the migration did not run previously. This ensures that the migration does not run again even if Postgres still exists in the cluster for some reason after the migration (e.g. KOTS failed to clean up Postgres resources).

  • A Postgres instance is detected if the kotsadm-postgres secret exists in the cluster with a connection string / URI.

  • Postgres resources will be cleaned up and removed from the cluster after a successful upgrade.

  • Two migration tests were added:
    - One that tests upgrading from an older version of KOTS (v1.57.0) and ensures the migration runs successfully.
    - A more thorough integration test that validates the integrity of both the schema and the data before and after the migration.

  • Timestamps in Postgres are converted to Unix timestamps (integers) when stored in or migrated to rqlite.

  • Byte arrays in Postgres are converted to Base64 encoded strings when stored in or migrated to rqlite.

Other notes:

  • Adds a kots enable-ha CLI command that will enable HA mode by scaling up the kotsadm-rqlite StatefulSet to 3 replicas and distribute them across different nodes. The command will print an error message if the criteria to enable HA are not met. The criteria right now is having at least 3 nodes in the cluster.

Steps to reproduce

  • Regular KOTS Install. OR:
  • Regular KOTS upgrade from an older version.

Does this PR introduce a user-facing change?


Does this PR require documentation?

replicatedhq/replicated-docs#713

@sgalsaleh sgalsaleh force-pushed the salah/sc-60222/deploy-rqlite-instead-of-postgres-and-migrate branch 3 times, most recently from 8855bbc to 061f34d Compare October 19, 2022 19:15
@sgalsaleh sgalsaleh added the type::feature New feature or request label Oct 19, 2022
@sgalsaleh sgalsaleh force-pushed the salah/sc-60222/deploy-rqlite-instead-of-postgres-and-migrate branch from 2cee580 to 4e3acec Compare October 20, 2022 18:10
@sgalsaleh sgalsaleh force-pushed the salah/sc-60222/deploy-rqlite-instead-of-postgres-and-migrate branch from d5511e4 to e94ad33 Compare October 20, 2022 22:22
@sgalsaleh sgalsaleh marked this pull request as ready for review October 24, 2022 20:10
pkg/ha/ha.go Outdated Show resolved Hide resolved
pkg/k8sutil/kotsadm.go Outdated Show resolved Hide resolved
@sgalsaleh sgalsaleh merged commit 26b52ad into main Oct 25, 2022
@sgalsaleh sgalsaleh deleted the salah/sc-60222/deploy-rqlite-instead-of-postgres-and-migrate branch October 25, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants