Skip to content

fix: set deployment strategy to Recreate for SQLite - #1012

Merged
kalbasit merged 5 commits into
mainfrom
03-01-fix_set_deployment_strategy_to_recreate_for_sqlite
Mar 2, 2026
Merged

kalbasit merged 5 commits into
mainfrom
03-01-fix_set_deployment_strategy_to_recreate_for_sqlite

Conversation

@kalbasit

@kalbasit kalbasit commented Mar 2, 2026

Copy link
Copy Markdown
Owner

The Helm chart now uses the Recreate deployment strategy when mode is
set to deployment and SQLite is being used as the database.

Without this strategy, Kubernetes defaults to RollingUpdate, which can
cause rollouts to hang when a new pod is scheduled on a different node
than the old one but cannot mount the PersistentVolume (PV) because it
is ReadWriteOnce (RWO) and still attached to the old pod. This is
particularly relevant for SQLite which relies on a single PVC for
storage.

The change handles this by conditionally setting strategy.type based on
the database type in deployment.yaml. Unit tests have been added to
verify the correct rendering for both SQLite (Recreate) and other
databases (RollingUpdate).

fixes #1010

The Helm chart now uses the Recreate deployment strategy when mode is
set to deployment and SQLite is being used as the database.

Without this strategy, Kubernetes defaults to RollingUpdate, which can
cause rollouts to hang when a new pod is scheduled on a different node
than the old one but cannot mount the PersistentVolume (PV) because it
is ReadWriteOnce (RWO) and still attached to the old pod. This is
particularly relevant for SQLite which relies on a single PVC for
storage.

The change handles this by conditionally setting strategy.type based on
the database type in deployment.yaml. Unit tests have been added to
verify the correct rendering for both SQLite (Recreate) and other
databases (RollingUpdate).

fixes #1010
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. helm labels Mar 2, 2026

kalbasit commented Mar 2, 2026 •

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where Kubernetes rollouts could hang when using SQLite as the database with the default RollingUpdate deployment strategy. The change introduces conditional logic to apply a Recreate strategy specifically for SQLite, which is necessary due to the ReadWriteOnce nature of PersistentVolumes and SQLite's reliance on a single PVC. This ensures smoother and more reliable deployments for SQLite-based configurations.

Highlights

  • Deployment Strategy for SQLite: Implemented conditional logic in deployment.yaml to set the Kubernetes deployment strategy to Recreate when SQLite is used as the database type, addressing issues with PersistentVolume access during rollouts.
  • Default Deployment Strategy: Ensured that for all other database types, the deployment strategy remains RollingUpdate as the default behavior.
  • Unit Tests: Added new unit tests to deployment_test.yaml to verify the correct application of Recreate for SQLite and RollingUpdate for PostgreSQL based on the configured database type.
Changelog
  • charts/ncps/templates/deployment.yaml
    • Added an if/else block to conditionally set the spec.strategy.type based on config.database.type.
    • Set strategy.type to Recreate if config.database.type is "sqlite".
    • Set strategy.type to RollingUpdate otherwise.
  • charts/ncps/tests/deployment_test.yaml
    • Added a test case to assert that spec.strategy.type is "Recreate" when config.database.type is "sqlite".
    • Added a test case to assert that spec.strategy.type is "RollingUpdate" when config.database.type is "postgresql".
Activity
  • No activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request correctly changes the deployment strategy to Recreate for SQLite to prevent issues with ReadWriteOnce persistent volumes during updates. The changes in deployment.yaml are accompanied by new tests in deployment_test.yaml that verify the new logic. I've suggested an improvement to make the deployment strategy for other databases configurable, which enhances the chart's flexibility.

Comment thread charts/ncps/templates/deployment.yaml Resolved
@dosubot

dosubot Bot commented Mar 2, 2026

Copy link
Copy Markdown

Related Documentation

Checked 7 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@kalbasit kalbasit added the backport release-0.9 Backport PR automatically label Mar 2, 2026
@kalbasit

kalbasit commented Mar 2, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

Comment thread charts/ncps/tests/deployment_test.yaml Dismissed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request correctly identifies and fixes an issue where RollingUpdate deployments with SQLite and RWO PersistentVolumes can hang. The proposed solution is to use the Recreate strategy for SQLite. The implementation, however, has a critical flaw that breaks deployments with default values and also doesn't enforce the SQLite rule as strongly as intended. I've provided a suggestion to fix the logic and improve its robustness, aligning with the rule to prevent unsafe configurations in Helm charts. I've also suggested an additional test case to cover the override scenario.

Comment thread charts/ncps/templates/deployment.yaml Resolved
Comment thread charts/ncps/tests/deployment_test.yaml Resolved
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

@kalbasit
kalbasit enabled auto-merge (squash) March 2, 2026 00:29
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 5.04%. Comparing base (4e909d8) to head (f660012).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1012   +/-   ##
=====================================
  Coverage   5.04%   5.04%           
=====================================
  Files          6       6           
  Lines        436     436           
=====================================
  Hits          22      22           
  Misses       410     410           
  Partials       4       4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kalbasit
kalbasit merged commit 81dac8a into main Mar 2, 2026
16 checks passed
@kalbasit
kalbasit deleted the 03-01-fix_set_deployment_strategy_to_recreate_for_sqlite branch March 2, 2026 00:41
kalbasit added a commit that referenced this pull request Mar 2, 2026
The Helm chart now uses the Recreate deployment strategy when mode is
set to deployment and SQLite is being used as the database.

Without this strategy, Kubernetes defaults to RollingUpdate, which can
cause rollouts to hang when a new pod is scheduled on a different node
than the old one but cannot mount the PersistentVolume (PV) because it
is ReadWriteOnce (RWO) and still attached to the old pod. This is
particularly relevant for SQLite which relies on a single PVC for
storage.

The change handles this by conditionally setting strategy.type based on
the database type in deployment.yaml. Unit tests have been added to
verify the correct rendering for both SQLite (Recreate) and other
databases (RollingUpdate).

fixes #1010

(cherry picked from commit 81dac8a)
@kalbasit

kalbasit commented Mar 2, 2026

Copy link
Copy Markdown
Owner Author

Successfully created backport PR for release-0.9:

kalbasit added a commit that referenced this pull request Mar 2, 2026
…1015)

Bot-based backport to `release-0.9`, triggered by a label in #1012.

The Helm chart now uses the Recreate deployment strategy when mode is
set to deployment and SQLite is being used as the database.

Without this strategy, Kubernetes defaults to RollingUpdate, which can
cause rollouts to hang when a new pod is scheduled on a different node
than the old one but cannot mount the PersistentVolume (PV) because it
is ReadWriteOnce (RWO) and still attached to the old pod. This is
particularly relevant for SQLite which relies on a single PVC for
storage.

The change handles this by conditionally setting strategy.type based on
the database type in deployment.yaml. Unit tests have been added to
verify the correct rendering for both SQLite (Recreate) and other
databases (RollingUpdate).

fixes #1010
kalbasit added a commit that referenced this pull request Jun 8, 2026
## Summary

The `[Unreleased]` section was populated in #1309 but skewed toward the
recent CDC-drain, in-flight-staging, and Ent-migration work, omitting
several user-facing features and fixes that also landed since v0.9.4.
This backfills the missing notable changes, each cross-referenced by PR.

**Added**
- `ncps fsck` command + Helm fsck CronJob (#975, #996, #998, #999,
#1000, #1004, #1006, #1176)
- Closure pinning HTTP endpoints `POST`/`DELETE /pin/{hash}.narinfo`,
`GET /pins` (#1108)
- pprof server via `--pprof-addr` (#1063)
- CDC lazy chunking as a feature + `--cache-cdc-lazy-cleanup-schedule` +
recovery cron (#1082, #1083, #1089, #1096)
- Helm: auto `GOMEMLIMIT` (#1061), configurable temp volume /
`volumeClaimTemplate` (#1074, #1077), SQLite `Recreate` strategy (#1012)
- Startup storage reporting + deprecated-narinfo warning (#959, #961)
- `docker-dev` image (#1097)

**Fixed**
- `store/tmp` no longer wiped on startup (#1313)
- `nix-hash` NAR verification (#1101)
- Prometheus counters primed at startup (#1337, #1343)
- 404 on un-reassemblable chunked NARs (#1319), purged narinfo no longer
500 (#1318), fail-fast tmp validation (#1086)
- Further CDC/cache reliability fixes (#1317, #1346, #1341, #1342,
#1331, #1347)

**Changed**
- CDC config now persisted in the DB config table (#971)

Dependency bumps, CI/test-only changes, and the internal Ent-conversion
PRs are intentionally excluded; the existing Ent-migration entry already
covers that work.

## Test plan

- [x] `nix fmt` reports no changes (docs-only edit)
- [x] CHANGELOG section structure intact
(Added/Fixed/Changed/Removed/Migration/CI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release-0.9 Backport PR automatically helm size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helm: chart should set .spec.strategy.type Recreate when using mode: deployment with sqlite.

2 participants