From 8f160c723f83fc229e9df8dd3f982d7cd98f5132 Mon Sep 17 00:00:00 2001 From: M Toqeer Zia Date: Tue, 25 Aug 2026 22:15:39 +0500 Subject: [PATCH] feat(chart): add PodDisruptionBudget for hami-scheduler HA deployments Renders a PDB for the hami-scheduler Deployment only when scheduler.leaderElect is true and scheduler.replicas > 1, preventing all replicas from being evicted simultaneously during node drains or cluster upgrades. Gating strictly on replicas > 1 keeps the default single-replica install a no-op (a PDB with minAvailable: 1 against a single pod would otherwise block that pod's own eviction). Configurable via scheduler.podDisruptionBudget.minAvailable / maxUnavailable, defaulting to minAvailable: 1. Fixes #2772 Signed-off-by: M Toqeer Zia --- charts/hami/README.md | 2 ++ charts/hami/templates/scheduler/pdb.yaml | 26 ++++++++++++++++++++++++ charts/hami/values.yaml | 5 +++++ 3 files changed, 33 insertions(+) create mode 100644 charts/hami/templates/scheduler/pdb.yaml diff --git a/charts/hami/README.md b/charts/hami/README.md index f6860fb491..dbc2440d15 100644 --- a/charts/hami/README.md +++ b/charts/hami/README.md @@ -77,6 +77,8 @@ This document provides detailed descriptions of all configurable values paramete | `scheduler.livenessProbe` | Whether to enable liveness probe | `false` | | `scheduler.leaderElect` | Whether to enable leader election | `true` | | `scheduler.replicas` | Number of replicas | `1` | +| `scheduler.podDisruptionBudget.minAvailable` | Minimum number of available scheduler pods during voluntary disruptions (only rendered when `scheduler.leaderElect` is `true` and `scheduler.replicas` is greater than `1`) | `1` | +| `scheduler.podDisruptionBudget.maxUnavailable` | Maximum number of unavailable scheduler pods during voluntary disruptions; takes precedence over `minAvailable` when set | unset | ### Kube Scheduler Configuration diff --git a/charts/hami/templates/scheduler/pdb.yaml b/charts/hami/templates/scheduler/pdb.yaml new file mode 100644 index 0000000000..031335b3cc --- /dev/null +++ b/charts/hami/templates/scheduler/pdb.yaml @@ -0,0 +1,26 @@ +{{- if and .Values.scheduler.leaderElect (gt (int .Values.scheduler.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "hami-vgpu.scheduler" . }} + namespace: {{ include "hami-vgpu.namespace" . }} + labels: + app.kubernetes.io/component: hami-scheduler + {{- include "hami-vgpu.labels" . | nindent 4 }} + {{- with .Values.global.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- if .Values.global.annotations }} + annotations: {{ toYaml .Values.global.annotations | nindent 4}} + {{- end }} +spec: + {{- if hasKey .Values.scheduler.podDisruptionBudget "maxUnavailable" }} + maxUnavailable: {{ .Values.scheduler.podDisruptionBudget.maxUnavailable }} + {{- else }} + minAvailable: {{ .Values.scheduler.podDisruptionBudget.minAvailable }} + {{- end }} + selector: + matchLabels: + app.kubernetes.io/component: hami-scheduler + {{- include "hami-vgpu.selectorLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/hami/values.yaml b/charts/hami/values.yaml index 593b2fedcb..c02699e110 100644 --- a/charts/hami/values.yaml +++ b/charts/hami/values.yaml @@ -83,6 +83,11 @@ scheduler: leaderElect: true # when leaderElect is true, replicas is available, otherwise replicas is 1. replicas: 1 + # podDisruptionBudget only renders when leaderElect is true and replicas > 1; + # with a single replica it would block all voluntary node drains. + podDisruptionBudget: + minAvailable: 1 + # maxUnavailable: 1 kubeScheduler: # @param enabled indicate whether to run kube-scheduler container in the scheduler pod, it's true by default. enabled: true