Skip to content

Feat: add support for deployment strategy#82

Open
alekc wants to merge 2 commits intosourcebot-dev:mainfrom
alekc:deployment-strategy
Open

Feat: add support for deployment strategy#82
alekc wants to merge 2 commits intosourcebot-dev:mainfrom
alekc:deployment-strategy

Conversation

@alekc
Copy link
Copy Markdown

@alekc alekc commented Mar 29, 2026

Sourcebot mounts a PersistentVolumeClaim for its /data directory. The most common PVC storage class access mode is ReadWriteOnce (RWO), which allows the volume to be mounted by only one node at a time.

With the default RollingUpdate strategy, Kubernetes starts the new pod before terminating the old one. When both pods attempt to bind the same RWO volume simultaneously, the new pod gets stuck in Pending or ContainerCreating.

This makes rolling updates effectively broken for single-node PVC setups — which is the majority of self-hosted deployments.

What this PR does

  • Adds a sourcebot.strategy value to configure the Kubernetes deployment strategy
  • Defaults to RollingUpdate (Kubernetes default, correct for RWX volumes or no persistence)
  • Users with RWO volumes can now switch to Recreate to ensure the old pod is fully terminated before the new one starts, allowing the volume to detach cleanly
sourcebot:
  strategy:
    type: Recreate

Impact: no breaking change, default behaviour is maintained with type: RollingUpdate

Summary by CodeRabbit

  • New Features

    • Added configurable deployment strategy: choose RollingUpdate (default) for gradual updates or Recreate for immediate pod replacement. Validation ensures only supported strategy options and associated settings are accepted.
  • Chores

    • Helm chart version updated to 0.1.67.

… configuration

Signed-off-by: Alexander Chernov <alexander@chernov.it>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52dc4f96-4895-421e-a3fd-4f136e3e81dd

📥 Commits

Reviewing files that changed from the base of the PR and between 3cdbb59 and 2d3e1a9.

📒 Files selected for processing (1)
  • charts/sourcebot/values.schema.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • charts/sourcebot/values.schema.json

Walkthrough

Helm chart version bumped to 0.1.67 and a new configurable Deployment strategy was added: sourcebot.strategy (type: RollingUpdate or Recreate) with optional rollingUpdate settings. The deployment template conditionally renders spec.strategy when sourcebot.strategy is provided; values and JSON schema updated accordingly.

Changes

Cohort / File(s) Summary
Chart Version Update
charts/sourcebot/Chart.yaml
Version changed from 0.1.66 to 0.1.67.
Deployment Template
charts/sourcebot/templates/deployment.yaml
Deployment template now conditionally renders spec.strategy when sourcebot.strategy is set.
Values Schema
charts/sourcebot/values.schema.json
Added sourcebot.strategy schema with oneOf branches: type: "RollingUpdate" (allows rollingUpdate object) or type: "Recreate"; both require type and disallow additional properties.
Values File
charts/sourcebot/values.yaml
Added sourcebot.strategy block with default type: RollingUpdate; minor trailing-whitespace cleanup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding support for configuring deployment strategy in the Helm chart.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@charts/sourcebot/values.schema.json`:
- Around line 39-50: The schema currently allows a "strategy" object with "type"
and "rollingUpdate" together even when "type" is "Recreate"; update the
"strategy" definition to validate that "rollingUpdate" is only permitted when
"type" is "RollingUpdate" (e.g., replace the loose properties with a
conditional/oneOf rule using "if": {"properties": {"type": {"const":
"Recreate"}}}, "then": {"not": {"required": ["rollingUpdate"]}} or equivalent,
or use oneOf branches for the two strategy shapes) so that the "strategy" object
rejects any object that has type "Recreate" and a "rollingUpdate" property while
still allowing "rollingUpdate" when type is "RollingUpdate".
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 80eb5c3e-3cae-4a2c-957b-c2cd0649cd2d

📥 Commits

Reviewing files that changed from the base of the PR and between cc8e9b1 and 3cdbb59.

📒 Files selected for processing (4)
  • charts/sourcebot/Chart.yaml
  • charts/sourcebot/templates/deployment.yaml
  • charts/sourcebot/values.schema.json
  • charts/sourcebot/values.yaml

@brendan-kellam
Copy link
Copy Markdown
Contributor

@alekc thanks for the PR! will take a look today

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.

2 participants