Skip to content

Conversation

@davidaparicio
Copy link

@davidaparicio davidaparicio commented Jan 22, 2026

thx to @Clement-Diot to reveal this issue (we need to use "recreate" strategy) :)

Summary

Add optional deployment strategy configuration to the Helm chart, enabling users to specify RollingUpdate or Recreate strategy types.

Motivation

The default Kubernetes RollingUpdate strategy causes deployment deadlocks with single-replica deployments using ReadWriteOnce PVCs (the chart's default configuration). During rolling updates, the new pod cannot mount the PVC because it's still attached to the old pod, creating a deadlock situation.

Changes

templates/deployment.yaml: Added conditional strategy block that renders only when strategy values are provided
README.md: Documented new strategy.* configuration options

Key Features

  • Backward Compatible: Strategy section is optional; existing deployments continue using Kubernetes defaults
  • Flexible: Supports both RollingUpdate (with customizable maxSurge/maxUnavailable) and Recreate strategies
  • Solves ReadWriteOnce issue: Users can now set strategy.type: Recreate to avoid PVC mounting conflicts

Example Usage

For single replica with ReadWriteOnce PVC (recommended)

strategy:
  type: Recreate

For custom rolling updates

strategy:
  type: RollingUpdate
  rollingUpdate:
    maxSurge: 1
    maxUnavailable: 0

My Test Plan

  • helm template without strategy values (backward compatibility) ✅
    • helm template test-pgadmin . --dry-run
  • helm template with RollingUpdate strategy ✅
    • helm template test-pgadmin . --set strategy.type=RollingUpdate --set strategy.rollingUpdate.maxSurge=1 --set strategy.rollingUpdate.maxUnavailable=0
  • helm template with Recreate strategy ✅
    • helm template test-pgadmin . --set strategy.type=Recreate | grep -A 12 "kind: Deployment"

Summary by CodeRabbit

  • New Features
    • Deployment strategy control: choose between RollingUpdate and Recreate for deployments.
    • Rolling update configuration: set max surge and max unavailable during rolling updates.
    • Sensible defaults: new options include Kubernetes-default values for immediate use and smooth integration.

✏️ Tip: You can customize this high-level summary in your review settings.

…t-Diot

Signed-off-by: David Aparicio <david.aparicio@free.fr>
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

Adds three Helm values for Deployment strategy: strategy.type, strategy.rollingUpdate.maxSurge, and strategy.rollingUpdate.maxUnavailable. README documents the options and the Deployment template conditionally renders a strategy block with type and rollingUpdate fields when .Values.strategy is provided.

Changes

Cohort / File(s) Summary
Documentation
pkg/helm/README.md
Adds entries documenting strategy.type, strategy.rollingUpdate.maxSurge, and strategy.rollingUpdate.maxUnavailable
Template Implementation
pkg/helm/templates/deployment.yaml
Adds conditional Helm template to emit a strategy section with type, and if type is RollingUpdate, includes rollingUpdate.maxSurge and rollingUpdate.maxUnavailable

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 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 describes the main change: adding deployment strategy support to the Helm chart, which is the core feature across both modified files.
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.


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

@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

🤖 Fix all issues with AI agents
In `@pkg/helm/templates/deployment.yaml`:
- Around line 13-21: The template accesses
.Values.strategy.rollingUpdate.maxSurge and
.Values.strategy.rollingUpdate.maxUnavailable unguarded which will nil-panic
when strategy.type is "RollingUpdate" but .Values.strategy.rollingUpdate is
missing; update the deployment template to either (a) wrap the rollingUpdate
block in an additional guard like {{- if .Values.strategy.rollingUpdate }} ...
{{- end }} so it only renders when rollingUpdate exists, or (b) use the Helm
default function to provide safe fallbacks (e.g. default values for
.Values.strategy.rollingUpdate.maxSurge and .maxUnavailable) and reference
.Values.strategy and strategy.type to keep behavior identical when set.

Signed-off-by: David Aparicio <david.aparicio@free.fr>
@davidaparicio
Copy link
Author

Test Results

  1. No strategy (default):
spec:
  replicas: 1
  selector:
    ...

→ Kubernetes uses default RollingUpdate with 25% values

  1. Only strategy type:
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
  selector:
    ...

→ Kubernetes applies default rollingUpdate parameters (25%)

  1. Full RollingUpdate configuration:
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    ...

→ Uses custom values

  1. Recreate strategy:
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    ...

→ No rollingUpdate section (as expected)

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