quay-operator icon indicating copy to clipboard operation
quay-operator copied to clipboard

statefulset: Use stateful sets for posgres deployments (PROJQUAY-6672)

Open jonathankingfc opened this issue 1 year ago • 15 comments

  • Swap Postgres and Clair Postgres Deployments to StatefulSets

Summary by Sourcery

Convert Postgres deployments for Quay and Clair from Deployments to StatefulSets to improve database management and persistence

Enhancements:

  • Migrate Postgres and Clair Postgres configurations from Deployments to StatefulSets to provide better stateful application management

CI:

  • Update CI workflow to simplify test command
  • Remove manual Kubebuilder installation step

Chores:

  • Update Kustomize configurations and patches to reflect StatefulSet changes
  • Modify Kubernetes resource management to use StatefulSet kind

jonathankingfc avatar May 30 '24 17:05 jonathankingfc

/retest

jonathankingfc avatar Aug 15 '24 18:08 jonathankingfc

/retest

bcaton85 avatar Sep 09 '24 13:09 bcaton85

@jonathankingfc: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ocp-latest-e2e 0ba46ee741263ba358fabaf26489156c59ae15e3 link true /test ocp-latest-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

openshift-ci[bot] avatar Oct 15 '24 20:10 openshift-ci[bot]

@sourcery-ai summary

HammerMeetNail avatar Apr 03 '25 14:04 HammerMeetNail

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

openshift-merge-robot avatar Apr 03 '25 14:04 openshift-merge-robot

@sourcery-ai review

HammerMeetNail avatar Apr 03 '25 14:04 HammerMeetNail

@sourcery-ai guide

deshpandevlab avatar Apr 03 '25 14:04 deshpandevlab

Reviewer's Guide by Sourcery

This pull request migrates the Postgres and Clair Postgres deployments to StatefulSets for improved database management and persistence. The Kustomize configurations and patches have been updated to reflect these changes. The test command in the Makefile has been simplified, and the Kubebuilder installation process in the CI workflow has been updated. Finally, the StatefulSet kind was added to the kustomize package.

Updated class diagram for Kustomize ModelFor function

classDiagram
  class client.Object {
  }
  class apps.StatefulSet {
  }
  client.Object <|-- apps.StatefulSet
  note for apps.StatefulSet "Added StatefulSet type to ModelFor function"

File-Level Changes

Change Details Files
Migrated Postgres and Clair Postgres configurations from Deployments to StatefulSets.
  • Changed the kind of the Postgres and Clair Postgres resources from Deployment to StatefulSet.
  • Added serviceName to the specifications of the StatefulSets.
  • Removed the strategy field from the specifications of the StatefulSets.
  • Added volumeClaimTemplates to the specifications of the StatefulSets.
kustomize/components/clairpostgres/postgres.statefulset.yaml
kustomize/components/postgres/postgres.statefulset.yaml
kustomize/components/clairpostgres/kustomization.yaml
kustomize/components/clairpgupgrade/base/clair-pg.statefulset.patch.yaml
kustomize/components/clairpgupgrade/base/kustomization.yaml
kustomize/components/pgupgrade/kustomization.yaml
kustomize/components/pgupgrade/quay-pg.statefulset.patch.yaml
kustomize/components/postgres/kustomization.yaml
Updated the Kustomize configurations and patches to reflect the StatefulSet changes.
  • Updated the Kustomize files to reference the new StatefulSet resources.
  • Updated patches to be compatible with StatefulSets.
kustomize/components/clairpostgres/kustomization.yaml
kustomize/components/clairpgupgrade/base/kustomization.yaml
kustomize/components/pgupgrade/kustomization.yaml
kustomize/components/postgres/kustomization.yaml
Simplified the test command in the Makefile and updated Kubebuilder installation in CI workflow.
  • Replaced the explicit go test command with make test in the Makefile.
  • Removed the Kubebuilder installation steps from the CI workflow.
.github/workflows/ci.yaml
Makefile
Added StatefulSet to the list of known Kinds in the kustomize package.
  • Added a case for StatefulSet to the ModelFor function to return a apps.StatefulSet object.
pkg/kustomize/kustomize.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Apr 03 '25 14:04 sourcery-ai[bot]

Hey @jonathankingfc - I've reviewed your changes - here's some feedback:

Overall Comments:

* Consider adding podManagementPolicy: Parallel to the StatefulSet spec to speed up deployments.

* Consider adding updateStrategy to the StatefulSet spec to control the update process.

Here's what I looked at during the review Sourcery is free for open source - if you like our reviews please consider sharing them ✨ Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Can you provide an example of the proposed changes?

HammerMeetNail avatar Apr 03 '25 14:04 HammerMeetNail

Hey @jonathankingfc - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding podManagementPolicy: Parallel to the StatefulSet spec to speed up deployments.
  • Consider adding updateStrategy to the StatefulSet spec to control the update process.

Here's what I looked at during the review Sourcery is free for open source - if you like our reviews please consider sharing them ✨ Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@sourcery-ai how did you evaluate tests?

deshpandevlab avatar Apr 03 '25 14:04 deshpandevlab

@sourcery-ai plan

deshpandevlab avatar Apr 03 '25 15:04 deshpandevlab

@sourcery-ai review

deshpandevlab avatar Apr 03 '25 15:04 deshpandevlab

Sure! I'm generating a new review now.

sourcery-ai[bot] avatar Apr 03 '25 15:04 sourcery-ai[bot]

Hey @deshpandevlab, I've posted a new review for you!

sourcery-ai[bot] avatar Apr 03 '25 15:04 sourcery-ai[bot]

@sourcery-ai help

HammerMeetNail avatar Apr 03 '25 15:04 HammerMeetNail