Skip to content

[LFXV2-1166] Add pod disruption budget support#59

Open
bramwelt wants to merge 3 commits intomainfrom
tbramwell/LFXV2-1166-pod-disruption-budget
Open

[LFXV2-1166] Add pod disruption budget support#59
bramwelt wants to merge 3 commits intomainfrom
tbramwell/LFXV2-1166-pod-disruption-budget

Conversation

@bramwelt
Copy link
Contributor

@bramwelt bramwelt commented Mar 6, 2026

Summary

  • Add podDisruptionBudget values to Helm chart (disabled by default)
  • Create PodDisruptionBudget template supporting minAvailable and maxUnavailable

🤖 Generated with Claude Code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Issue: LFXV2-1166
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
@bramwelt bramwelt requested a review from a team as a code owner March 6, 2026 18:44
Copilot AI review requested due to automatic review settings March 6, 2026 18:44
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Walkthrough

A new Helm template for Kubernetes PodDisruptionBudget resources is added to the lfx-v2-committee-service chart. The template includes validation to prevent simultaneous configuration of both minAvailable and maxUnavailable parameters. Configuration values are introduced with the feature disabled by default, allowing operators to enable and configure disruption budgets as needed.

Changes

Cohort / File(s) Summary
PodDisruptionBudget Template
charts/lfx-v2-committee-service/templates/pdb.yaml
New Helm template for Kubernetes PodDisruptionBudget with metadata configuration, label selectors, and validation logic to prevent conflicting minAvailable/maxUnavailable settings.
Helm Values Configuration
charts/lfx-v2-committee-service/values.yaml
Added podDisruptionBudget section with enabled flag (default: false), optional minAvailable and maxUnavailable parameters, and guideline documentation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'LFXV2-1166 Add pod disruption budget support' is directly related to the changeset, which adds PodDisruptionBudget support via new template and values configuration.
Description check ✅ Passed The description accurately describes the changeset: adding podDisruptionBudget values (disabled by default) and creating a PDB template supporting minAvailable and maxUnavailable options.
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
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tbramwell/LFXV2-1166-pod-disruption-budget

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

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional PodDisruptionBudget (PDB) support to the lfx-v2-committee-service Helm chart so operators can configure disruption limits via chart values.

Changes:

  • Introduces podDisruptionBudget configuration in values.yaml (disabled by default).
  • Adds a PodDisruptionBudget manifest template supporting minAvailable and maxUnavailable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
charts/lfx-v2-committee-service/values.yaml Adds new podDisruptionBudget values block for configuring PDB behavior.
charts/lfx-v2-committee-service/templates/pdb.yaml Adds a conditional PDB template rendered when the feature is enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +19
{{- with .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- with .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The {{- with ... }} blocks under spec: trim the preceding newline, which can concatenate app: {{ .Chart.Name }} with minAvailable/maxUnavailable and render invalid YAML. Use non-trimming actions here (e.g., {{ with ... }} / {{ end }}) or otherwise ensure a newline is preserved before emitting these fields.

Suggested change
{{- with .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- with .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{ with .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{ end }}
{{ with .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{ end }}

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +19
{{- if .Values.podDisruptionBudget.enabled }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: {{ .Chart.Name }}
{{- with .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ . }}
{{- end }}
{{- with .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

When podDisruptionBudget.enabled is true, this template can render an invalid PDB if neither minAvailable nor maxUnavailable is set, and it can also render an invalid PDB if both are set. Add Helm-time validation (e.g., fail/required) to enforce that exactly one of these values is provided when enabled.

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +10
# minAvailable: 1
# maxUnavailable: 1
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The values docs currently suggest both minAvailable and maxUnavailable can be configured, but PodDisruptionBudget requires exactly one of them. Consider updating these comments to indicate they are mutually exclusive and that one must be set when podDisruptionBudget.enabled=true.

Suggested change
# minAvailable: 1
# maxUnavailable: 1
# minAvailable: 1 # Specify exactly one of minAvailable or maxUnavailable when enabled=true
# maxUnavailable: 1 # Mutually exclusive with minAvailable; uncomment only one of these fields

Copilot uses AI. Check for mistakes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Issue: LFXV2-1166
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
asithade
asithade previously approved these changes Mar 6, 2026
Copy link
Contributor

@asithade asithade left a comment

Choose a reason for hiding this comment

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

LGTM

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Issue: LFXV2-1166
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
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

🤖 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/lfx-v2-committee-service/templates/pdb.yaml`:
- Around line 17-22: The PDB template can render an invalid empty spec when
.Values.podDisruptionBudget.enabled is true but neither
.Values.podDisruptionBudget.minAvailable nor
.Values.podDisruptionBudget.maxUnavailable is set; fix it by adding a
guard/validation that checks hasKey .Values.podDisruptionBudget "minAvailable"
or hasKey .Values.podDisruptionBudget "maxUnavailable" (or both) before
rendering the spec, and if both are missing call fail with a clear message
(e.g., using Helm's fail function) so the chart errors out instead of producing
an invalid PDB; update the conditional logic around the spec generation that
currently uses hasKey checks for minAvailable/maxUnavailable to enforce this
combined requirement.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e573b12-f6b3-47b5-8e4a-3263713425f2

📥 Commits

Reviewing files that changed from the base of the PR and between 6d8d941 and de43823.

📒 Files selected for processing (2)
  • charts/lfx-v2-committee-service/templates/pdb.yaml
  • charts/lfx-v2-committee-service/values.yaml

Comment on lines +17 to +22
{{- if hasKey .Values.podDisruptionBudget "minAvailable" }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if hasKey .Values.podDisruptionBudget "maxUnavailable" }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing validation: PDB requires at least one of minAvailable or maxUnavailable.

When podDisruptionBudget.enabled is true but neither minAvailable nor maxUnavailable is set, this template renders a PDB without a disruption budget spec, which is invalid. Kubernetes requires at least one of these fields.

🐛 Proposed fix to add validation

Add this validation after line 6:

 {{- if and (hasKey .Values.podDisruptionBudget "minAvailable") (hasKey .Values.podDisruptionBudget "maxUnavailable") }}
   {{- fail "podDisruptionBudget: cannot set both minAvailable and maxUnavailable" }}
 {{- end }}
+{{- if not (or (hasKey .Values.podDisruptionBudget "minAvailable") (hasKey .Values.podDisruptionBudget "maxUnavailable")) }}
+  {{- fail "podDisruptionBudget: must set either minAvailable or maxUnavailable when enabled" }}
+{{- end }}
 ---
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/lfx-v2-committee-service/templates/pdb.yaml` around lines 17 - 22, The
PDB template can render an invalid empty spec when
.Values.podDisruptionBudget.enabled is true but neither
.Values.podDisruptionBudget.minAvailable nor
.Values.podDisruptionBudget.maxUnavailable is set; fix it by adding a
guard/validation that checks hasKey .Values.podDisruptionBudget "minAvailable"
or hasKey .Values.podDisruptionBudget "maxUnavailable" (or both) before
rendering the spec, and if both are missing call fail with a clear message
(e.g., using Helm's fail function) so the chart errors out instead of producing
an invalid PDB; update the conditional logic around the spec generation that
currently uses hasKey checks for minAvailable/maxUnavailable to enforce this
combined requirement.

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.

3 participants