Skip to content

Add in-place vertical scaling guide for Postgres#911

Open
tamalsaha wants to merge 2 commits into
masterfrom
postgres-inplace-vscale-docs
Open

Add in-place vertical scaling guide for Postgres#911
tamalsaha wants to merge 2 commits into
masterfrom
postgres-inplace-vscale-docs

Conversation

@tamalsaha

@tamalsaha tamalsaha commented Jun 30, 2026

Copy link
Copy Markdown
Member

What

Adds documentation for the InPlace mode of the Postgres VerticalScaling OpsRequest.

  • New guide: docs/guides/postgres/scaling/vertical-scaling/in-place/ — in-place vs restart, deploying a 3-replica cluster, in-place CPU scaling (verified by unchanged Pod UID / restartCount / primary role), in-place memory increase with memoryPolicy: ResizeOnly (shared_buffers left unchanged, reloadable GUCs re-applied live), eligibility and the automatic fallback table, and the autoscaler. Includes example YAMLs under yamls/.
  • Adds a short In-Place Vertical Scaling section to the vertical-scaling overview that links to the new guide.

spec.mode defaults to Restart, so the docs make clear existing behavior is unchanged and that unsupported clusters fall back automatically.

Related

Documents the feature implemented in kubedb/postgres#911, kubeops/petset#50, kubedb/apimachinery#1790, and kubedb/autoscaler#310.

Summary by CodeRabbit

  • New Features

    • Added a new documentation guide for in-place vertical scaling of Postgres (CPU/memory changes applied without pod recreation or primary failover).
    • Provided ready-to-use sample manifests for a Postgres demo cluster and in-place vertical scaling requests.
  • Documentation

    • Expanded the vertical scaling overview with an “In-Place Vertical Scaling” section, including eligibility rules, expected live-change behavior, and clear fallback to the restart-based workflow when in-place resizing isn’t applicable.

Document the InPlace mode of the Postgres VerticalScaling OpsRequest: scaling
CPU/memory of running Pods via the Kubernetes pods/resize subresource without
recreating Pods or failing over the primary. Covers in-place vs restart, CPU
scaling, memory increase with ResizeOnly (shared_buffers untouched, reloadable
GUCs re-applied), eligibility and automatic fallback, and the autoscaler. Adds a
short In-Place section to the vertical-scaling overview.

Signed-off-by: Tamal Saha <tamal@appscode.com>
kodiak-appscode[bot]
kodiak-appscode Bot previously approved these changes Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 72b17e1d-a332-4b6b-ab07-4677da8aac10

📥 Commits

Reviewing files that changed from the base of the PR and between 243a2f8 and 96f6bb6.

📒 Files selected for processing (5)
  • docs/guides/postgres/scaling/vertical-scaling/in-place/index.md
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace-memory.yaml
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace.yaml
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/postgres.yaml
  • docs/guides/postgres/scaling/vertical-scaling/overview/index.md
✅ Files skipped from review due to trivial changes (3)
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/postgres.yaml
  • docs/guides/postgres/scaling/vertical-scaling/overview/index.md
  • docs/guides/postgres/scaling/vertical-scaling/in-place/index.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace.yaml
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace-memory.yaml

📝 Walkthrough

Walkthrough

Adds a new in-place vertical scaling guide for PostgreSQL, with supporting Postgres and PostgresOpsRequest manifests. Updates the vertical scaling overview to describe spec.verticalScaling.mode: InPlace and its fallback behavior.

Changes

In-Place Vertical Scaling Postgres Documentation

Layer / File(s) Summary
Overview: in-place mode subsection
docs/guides/postgres/scaling/vertical-scaling/overview/index.md
Adds a subsection describing spec.verticalScaling.mode: InPlace behavior, fallback conditions, and a link to the new guide.
New guide: intro, deploy, and resizePolicy verification
docs/guides/postgres/scaling/vertical-scaling/in-place/index.md, docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/postgres.yaml
Front-matter, tutorial prerequisites, scaling mode comparison, Postgres cluster manifest, deploy walkthrough, initial state inspection, and resizePolicy checks.
In-place CPU scaling flow and verification
docs/guides/postgres/scaling/vertical-scaling/in-place/index.md, docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace.yaml
In-place CPU OpsRequest YAML plus steps to apply it, wait for success, and verify unchanged Pod identity and primary role with updated resources.
In-place memory scaling, eligibility, autoscaler, and cleanup
docs/guides/postgres/scaling/vertical-scaling/in-place/index.md, docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace-memory.yaml
Memory ResizeOnly OpsRequest YAML, memory increase walkthrough, eligibility/fallback rules, autoscaler behavior, and cleanup commands.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • souravbiswassanto
  • sheikh-arman

Poem

🐇 I hopped through docs from page to page,
In-place scaling took the stage.
CPU and memory, snug and bright,
Resize without a restart in sight.
The pods stay calm, the guide is clear —
A tidy hop for the docs this year.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a new in-place vertical scaling guide for Postgres.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch postgres-inplace-vscale-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/guides/postgres/scaling/vertical-scaling/in-place/index.md`:
- Line 13: The markdown in the guide uses non-descriptive link text (“here”),
which should be replaced to satisfy MD059 and improve navigation. Update the
links in the affected content so the anchor text clearly names the destination,
using descriptive labels such as “KubeDB getting started” and “KubeDB setup
guide” rather than generic text; apply the same change to both referenced links
in the document.

In `@docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/postgres.yaml`:
- Around line 6-18: The sample cluster manifest in postgres.yaml is missing the
initial CPU and memory requests that the guide assumes later. Update the
manifest in the Postgres YAML sample, and the corresponding inline YAML snippet
if present, to explicitly set the starting resources used by the walkthrough
(including the values referenced by the vertical scaling steps), or otherwise
remove the hard-coded initial resource assumptions from the guide text. Use the
existing cluster spec structure around the storage and replica settings to place
the resources consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c6267da-68bf-4ad4-8074-5b93a5004f29

📥 Commits

Reviewing files that changed from the base of the PR and between d9a1f1a and 243a2f8.

📒 Files selected for processing (5)
  • docs/guides/postgres/scaling/vertical-scaling/in-place/index.md
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace-memory.yaml
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/pg-vertical-scaling-inplace.yaml
  • docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/postgres.yaml
  • docs/guides/postgres/scaling/vertical-scaling/overview/index.md

section_menu_id: guides
---

> New to KubeDB? Please start [here](/docs/README.md).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use descriptive link text instead of here.

Both links trip MD059 and are harder to navigate with screen readers or link lists. Rename them to the destination itself, e.g. KubeDB getting started and KubeDB setup guide.

Also applies to: 33-34

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 13-13: Link text should be descriptive

(MD059, descriptive-link-text)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/guides/postgres/scaling/vertical-scaling/in-place/index.md` at line 13,
The markdown in the guide uses non-descriptive link text (“here”), which should
be replaced to satisfy MD059 and improve navigation. Update the links in the
affected content so the anchor text clearly names the destination, using
descriptive labels such as “KubeDB getting started” and “KubeDB setup guide”
rather than generic text; apply the same change to both referenced links in the
document.

Source: Linters/SAST tools

Comment on lines +6 to +18
spec:
version: "13.13"
replicas: 3
standbyMode: Hot
storageType: Durable
storage:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
deletionPolicy: WipeOut

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Pin the initial resources in the sample cluster manifest.

The guide later assumes this cluster starts with cpu: 500m and memory: 1Gi, but this YAML never sets them. That makes the walkthrough depend on operator defaults and can invalidate the later “keeps memory at 1Gi” claim. Please either declare those resources here (and in the inline YAML snippet) or stop hard-coding the initial values in the guide.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/guides/postgres/scaling/vertical-scaling/in-place/yamls/postgres.yaml`
around lines 6 - 18, The sample cluster manifest in postgres.yaml is missing the
initial CPU and memory requests that the guide assumes later. Update the
manifest in the Postgres YAML sample, and the corresponding inline YAML snippet
if present, to explicitly set the starting resources used by the walkthrough
(including the values referenced by the vertical scaling steps), or otherwise
remove the hard-coded initial resource assumptions from the guide text. Use the
existing cluster spec structure around the storage and replica settings to place
the resources consistently.

- Move mode/memoryPolicy under spec.verticalScaling (they are fields on
  PostgresVerticalScalingSpec, not the top-level OpsRequest spec) in all example
  YAMLs, inline blocks, and prose.
- Enable spec.configuration.tuning on the example Postgres so the in-place memory
  increase actually re-applies the reloadable GUCs; show shared_buffers unchanged
  vs effective_cache_size updated, and link the pgtune guide.
- Simplify the psql exec to the canonical `psql -U postgres -c` form.

Signed-off-by: Tamal Saha <tamal@appscode.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.

1 participant