From b7a50fd7720612ac52f24ed5bad5e787228adb36 Mon Sep 17 00:00:00 2001 From: Antoine Boursin <93669626+UAntBou@users.noreply.github.com> Date: Fri, 17 Nov 2023 15:48:18 +0100 Subject: [PATCH] feat: Add support for topologySpreadConstraints --- charts/descheduler/README.md | 1 + charts/descheduler/templates/cronjob.yaml | 4 ++++ charts/descheduler/templates/deployment.yaml | 4 ++++ charts/descheduler/values.yaml | 7 +++++++ 4 files changed, 16 insertions(+) diff --git a/charts/descheduler/README.md b/charts/descheduler/README.md index 96296ef3b..05862be91 100644 --- a/charts/descheduler/README.md +++ b/charts/descheduler/README.md @@ -84,6 +84,7 @@ The following table lists the configurable parameters of the _descheduler_ chart | `serviceMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples after scraping, but before ingestion | `[]` | | `serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping | `[]` | | `affinity` | Node affinity to run the descheduler cronjob/deployment on specific nodes | `nil` | +| `topologySpreadConstraints` | Topology Spread Constraints to spread the descheduler cronjob/deployment across the cluster | `[]` | | `tolerations` | tolerations to run the descheduler cronjob/deployment on specific nodes | `nil` | | `suspend` | Set spec.suspend in descheduler cronjob | `false` | | `commonLabels` | Labels to apply to all resources | `{}` | diff --git a/charts/descheduler/templates/cronjob.yaml b/charts/descheduler/templates/cronjob.yaml index 6a7a6b662..25d323eb6 100644 --- a/charts/descheduler/templates/cronjob.yaml +++ b/charts/descheduler/templates/cronjob.yaml @@ -51,6 +51,10 @@ spec: affinity: {{- toYaml . | nindent 12 }} {{- end }} + {{- with .Values.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 12 }} + {{- end }} {{- if .Values.dnsConfig }} dnsConfig: {{- .Values.dnsConfig | toYaml | nindent 12 }} diff --git a/charts/descheduler/templates/deployment.yaml b/charts/descheduler/templates/deployment.yaml index a00ab7bc6..bc16eb5ea 100644 --- a/charts/descheduler/templates/deployment.yaml +++ b/charts/descheduler/templates/deployment.yaml @@ -80,6 +80,10 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/charts/descheduler/values.yaml b/charts/descheduler/values.yaml index 0500c3462..9e968bbd0 100644 --- a/charts/descheduler/values.yaml +++ b/charts/descheduler/values.yaml @@ -149,6 +149,13 @@ affinity: {} # values: # - descheduler # topologyKey: "kubernetes.io/hostname" +topologySpreadConstraints: [] +# - maxSkew: 1 +# topologyKey: kubernetes.io/hostname +# whenUnsatisfiable: DoNotSchedule +# labelSelector: +# matchLabels: +# app.kubernetes.io/name: descheduler tolerations: [] # - key: 'management' # operator: 'Equal'