Skip to content

Make postgres use a PVC in the kessel-relations template#831

Merged
Rajagopalan-Ranganathan merged 1 commit intoproject-kessel:mainfrom
bsquizz:pvc_2
Mar 5, 2026
Merged

Make postgres use a PVC in the kessel-relations template#831
Rajagopalan-Ranganathan merged 1 commit intoproject-kessel:mainfrom
bsquizz:pvc_2

Conversation

@bsquizz
Copy link
Contributor

@bsquizz bsquizz commented Mar 5, 2026

Similar to #830 -- but in the correct file

Summary by Sourcery

Deployment:

  • Add a PersistentVolumeClaim resource and mount it into the Postgres pod to persist database data across restarts.

@app-sre-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 5, 2026

Reviewer's Guide

Configures the kessel-relations Postgres deployment to use a named PersistentVolumeClaim for its data directory and defines the PVC resource in the same manifest.

File-Level Changes

Change Details Files
Mount Postgres data directory from a PersistentVolumeClaim instead of ephemeral storage.
  • Add a volumeMount for a postgres-data volume at /temp/data in the Postgres container spec
  • Declare a postgres-data volume on the pod, backed by a PersistentVolumeClaim named postgres-data
deploy/kessel-relations.yaml
Define a PersistentVolumeClaim resource for Postgres data storage.
  • Add a PersistentVolumeClaim named postgres-data in the target namespace
  • Request 1Gi of ReadWriteOnce storage for the PVC
deploy/kessel-relations.yaml

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!

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

@Rajagopalan-Ranganathan Rajagopalan-Ranganathan merged commit a993880 into project-kessel:main Mar 5, 2026
10 of 14 checks passed
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The volume is mounted at /temp/data, which is unlikely to be where the Postgres container actually stores its data (commonly /var/lib/postgresql/data or PGDATA); consider aligning the mountPath with the image’s data directory so the PVC actually persists the database.
  • You’re using a hard-coded 1Gi request for the postgres-data PVC; consider parameterizing the storage size (e.g., via an environment variable or template variable) so different environments can tune storage requirements without editing the manifest.
  • If this PVC name (postgres-data) is intended to be shared between multiple Postgres deployments, double-check that this won’t cause ReadWriteOnce conflicts across pods/nodes; otherwise, consider using distinct PVC names per deployment.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The volume is mounted at `/temp/data`, which is unlikely to be where the Postgres container actually stores its data (commonly `/var/lib/postgresql/data` or `PGDATA`); consider aligning the mountPath with the image’s data directory so the PVC actually persists the database.
- You’re using a hard-coded `1Gi` request for the `postgres-data` PVC; consider parameterizing the storage size (e.g., via an environment variable or template variable) so different environments can tune storage requirements without editing the manifest.
- If this PVC name (`postgres-data`) is intended to be shared between multiple Postgres deployments, double-check that this won’t cause `ReadWriteOnce` conflicts across pods/nodes; otherwise, consider using distinct PVC names per deployment.

## Individual Comments

### Comment 1
<location path="deploy/kessel-relations.yaml" line_range="103-101" />
<code_context>
+            volumeMounts:
+            - name: postgres-data
+              mountPath: /temp/data
+          volumes:
+          - name: postgres-data
+            persistentVolumeClaim:
+              claimName: postgres-data
</code_context>
<issue_to_address>
**issue (bug_risk):** The indentation of the `- name: postgres-data` line makes the YAML invalid.

Because `- name: postgres-data` is aligned with `volumes:`, it’s not actually in the `volumes` list and will cause a YAML parse error. Indent it under `volumes:` (e.g., two spaces further) so it becomes a proper list item.
</issue_to_address>

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.

cpu: ${SPICEDB_POSTGRES_CPU_REQUEST}
memory: ${SPICEDB_POSTGRES_MEMORY_REQUEST}
volumeMounts:
- name: postgres-data
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): The indentation of the - name: postgres-data line makes the YAML invalid.

Because - name: postgres-data is aligned with volumes:, it’s not actually in the volumes list and will cause a YAML parse error. Indent it under volumes: (e.g., two spaces further) so it becomes a proper list item.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The volumes block appears to be indented as a child of the container rather than as a sibling of containers under the pod spec, which will result in an invalid pod spec; it should be moved up one level so it sits alongside containers.
  • The PersistentVolumeClaim name and requested storage size are currently hard-coded (postgres-data, 1Gi); consider parameterizing these so different deployments or environments can tune or avoid name collisions without editing the template.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `volumes` block appears to be indented as a child of the container rather than as a sibling of `containers` under the pod spec, which will result in an invalid pod spec; it should be moved up one level so it sits alongside `containers`.
- The `PersistentVolumeClaim` name and requested storage size are currently hard-coded (`postgres-data`, `1Gi`); consider parameterizing these so different deployments or environments can tune or avoid name collisions without editing the template.

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.

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.

3 participants