Skip to content

feat(chart): add optional PodDisruptionBudget for the operator pod - #550

Merged
Abhra303 merged 2 commits into
dragonflydb:mainfrom
somaz94:feat/chart-poddisruptionbudget
Jul 29, 2026
Merged

feat(chart): add optional PodDisruptionBudget for the operator pod#550
Abhra303 merged 2 commits into
dragonflydb:mainfrom
somaz94:feat/chart-poddisruptionbudget

Conversation

@somaz94

@somaz94 somaz94 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Adds an optional PodDisruptionBudget template to the operator Helm chart, disabled by default and toggleable via podDisruptionBudget.enabled. Useful when running the operator with replicaCount > 1 so voluntary disruptions (e.g. node drains) keep at least one operator pod available. The chart already exposes the sibling HA primitives (replicaCount, priorityClassName, topologySpreadConstraints, affinity) — this fills the remaining gap.

Supports minAvailable (default 1) / maxUnavailable (mutually exclusive, minAvailable wins) and the optional unhealthyPodEvictionPolicy (k8s 1.27+). The PDB selector matches the deployment's pod selector (selectorLabels + control-plane: controller-manager).

Validation (helm v3.18.1)

  • helm lint — 0 charts failed
  • disabled (default): PDB not rendered
  • enabled (default minAvailable: 1): renders with correct selector
  • enabled with maxUnavailable + unhealthyPodEvictionPolicy: renders correctly
  • both minAvailable and maxUnavailable set: minAvailable takes precedence
  • minAvailable: 0 is preserved (not treated as unset)

The chart version is intentionally left unbumped — it is bumped at release time (per maintainer review).

related: #280

Follows up on the closed #281 with a single-purpose, scoped change (PDB only — no ServiceMonitor / kube-rbac-proxy changes).

somaz94 added a commit to somaz94/somaz94 that referenced this pull request Jun 16, 2026
@somaz94
somaz94 marked this pull request as ready for review June 23, 2026 09:40
Comment thread charts/dragonfly-operator/Chart.yaml Outdated
Signed-off-by: somaz <genius5711@gmail.com>
@somaz94
somaz94 force-pushed the feat/chart-poddisruptionbudget branch from c71167e to 82002a2 Compare July 9, 2026 01:57
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "dragonfly-operator.fullname" . }}

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.

can you please name it {{ include "dragonfly-operator.fullname" . }}-controller-manger-pod-disruption-budget instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in e874513 — renamed to {{ include "dragonfly-operator.fullname" . }}-controller-manager-pod-disruption-budget.

One note: I used the corrected spelling manager (your suggestion had a typo manger). Happy to switch to the literal manger if you actually intended that.

I also fixed a small related issue the bot flagged: the minAvailable guard used a truthiness test, so a valid minAvailable: 0 fell through to maxUnavailable. Changed it to not (kindIs "invalid" ...) so 0 is preserved. helm lint + template renders (default / 0 / maxUnavailable) all pass.

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.

no, it was indeed a typo :)

Copilot AI 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.

Pull request overview

Adds optional PodDisruptionBudget (PDB) support to the dragonfly-operator Helm chart so operator pods can be protected from voluntary disruptions in HA deployments.

Changes:

  • Introduces podDisruptionBudget values (enabled flag + minAvailable/maxUnavailable + unhealthyPodEvictionPolicy) in values.yaml.
  • Adds a new PodDisruptionBudget template that targets the operator Deployment’s pod selector labels.

Reviewed changes

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

File Description
charts/dragonfly-operator/values.yaml Adds chart values to configure an optional PDB for the operator.
charts/dragonfly-operator/templates/poddisruptionbudget.yaml Adds the PDB manifest template gated by podDisruptionBudget.enabled.

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

Comment on lines +12 to +16
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- else if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
Comment on lines +156 to +166
# -- A [PodDisruptionBudget] for the operator pod, useful when running more
# than one replica (replicaCount > 1) so voluntary disruptions (e.g. node
# drains) keep at least one operator pod available.
## Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
podDisruptionBudget:
# When set true a PodDisruptionBudget is created for the operator pod
enabled: false
# minAvailable and maxUnavailable are mutually exclusive; minAvailable takes
# precedence when both are set. Each may be an integer or a percentage string.
minAvailable: 1
maxUnavailable: ""

@Abhra303 Abhra303 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.

LGTM, Good Work!

@somaz94

somaz94 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @Abhra303! Quick note on the two Copilot comments so they're not left hanging:

  • minAvailable: 0 — already handled: the template gates on {{ if not (kindIs "invalid" .Values.podDisruptionBudget.minAvailable) }}, i.e. "set and not nil", not a truthiness test. Verified minAvailable: 0 renders minAvailable: 0 (no fallback), and an unset minAvailable with maxUnavailable set falls through to maxUnavailable as intended.
  • Chart version — as you noted, the v1.7.0 in the description was a typo; Chart.yaml is intentionally left at v1.6.1 (version bump handled at release time).

Nothing else outstanding on my side — ready whenever you are 🙂

@somaz94

somaz94 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

This has been approved and mergeable with CI green since 07-14. Is there anything still needed from my side, or is it just waiting for a merge window? Happy to rebase if it's gone stale in the meantime.

@Abhra303
Abhra303 merged commit c94297f into dragonflydb:main Jul 29, 2026
2 checks passed
@Abhra303

Copy link
Copy Markdown
Contributor

Hey, Thanks!

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