Skip to content

fix: set deployment strategy to Recreate for SQLite [backport #1012] - #1015

Merged
kalbasit merged 1 commit into
release-0.9from
backport-1012-to-release-0.9
Mar 2, 2026
Merged

kalbasit merged 1 commit into
release-0.9from
backport-1012-to-release-0.9

Conversation

@kalbasit

@kalbasit kalbasit commented Mar 2, 2026

Copy link
Copy Markdown
Owner

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

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 enabled auto-merge (squash) March 2, 2026 00:41
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. helm labels Mar 2, 2026
@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 addresses a critical issue where Kubernetes deployments utilizing SQLite with ReadWriteOnce Persistent Volumes could experience hung rollouts due to the default RollingUpdate strategy. The change introduces a mechanism within the Helm chart to automatically configure the deployment strategy as Recreate when SQLite is detected, ensuring robust and successful application updates without manual intervention.

Highlights

  • Deployment Strategy for SQLite: Implemented conditional logic in the Helm chart to automatically set the Kubernetes deployment strategy to Recreate when SQLite is used as the database type, addressing issues with RollingUpdate and ReadWriteOnce Persistent Volumes.
  • Helm Chart Configuration: Introduced a new strategy parameter in the Helm chart's values.yaml and values.schema.json to allow explicit configuration of the deployment strategy, while ensuring SQLite deployments always default to Recreate.
  • Unit Test Coverage: Added comprehensive unit tests to verify that the deployment strategy is correctly rendered for various scenarios, including default RollingUpdate, user-defined strategies, and the forced Recreate for SQLite.
  • Documentation Update: Updated the user guide's Helm Chart Reference to document the new strategy parameter and its specific behavior for SQLite.
Changelog
  • charts/ncps/templates/deployment.yaml
    • Added conditional logic to set the deployment strategy based on the database type.
    • Set strategy.type to Recreate if config.database.type is "sqlite".
    • Allowed user-defined strategy if provided and not SQLite.
    • Defaulted strategy.type to RollingUpdate otherwise.
  • charts/ncps/tests/deployment_test.yaml
    • Removed an isNotEmpty assertion for initContainers.
    • Added tests to verify strategy.type rendering when a strategy is explicitly provided.
    • Added tests for default RollingUpdate for non-SQLite databases.
    • Added tests for Recreate strategy for SQLite deployments.
    • Added tests for RollingUpdate strategy for PostgreSQL deployments.
    • Added tests to confirm user-defined RollingUpdate is overridden to Recreate for SQLite.
  • charts/ncps/values.schema.json
    • Added a new strategy property of type object with a description.
  • charts/ncps/values.yaml
    • Added a strategy section with comments explaining its purpose and SQLite override.
  • docs/docs/User Guide/Installation/Helm Chart/Chart Reference.md
    • Added a new entry for the strategy parameter in the chart reference table.
Activity
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. ↩

@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

@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

@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 implements the Recreate deployment strategy for SQLite to prevent rollout issues with ReadWriteOnce persistent volumes. The changes are well-implemented across the Helm chart, including updates to values.yaml, the schema, and documentation. The new logic is also covered by an expanded test suite. I have identified a minor flaw in one of the new test cases and provided a suggestion for a fix to ensure it accurately validates the intended behavior.

Comment on lines +442 to +445
set:
mode: deployment
strategy:
type: Recreate

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.

medium

This test case is flawed as it relies on the default database type (sqlite), which means it doesn't correctly test that a user-provided strategy is applied for non-sqlite databases. To properly test the {{- else if .Values.strategy }} logic, please explicitly set a different database type, such as postgresql.

    set:
      mode: deployment
      config:
        database:
          type: postgresql
          postgresql:
            host: localhost
      strategy:
        type: Recreate

@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 (13c48fd) to head (a1c023b).
⚠️ Report is 1 commits behind head on release-0.9.

Additional details and impacted files
@@             Coverage Diff             @@
##           release-0.9   #1015   +/-   ##
===========================================
  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 e29921f into release-0.9 Mar 2, 2026
12 checks passed
@kalbasit
kalbasit deleted the backport-1012-to-release-0.9 branch March 2, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant