From 76de4d1cb3da4d33457c0ef27741b262c67db1e5 Mon Sep 17 00:00:00 2001 From: peterabarr <90917602+peterabarr@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:46:35 +0100 Subject: [PATCH] feat: Added new policy to PodDisruptionBudget rebase rebase CL entry --- charts/metrics-server/CHANGELOG.md | 1 + charts/metrics-server/README.md | 2 ++ charts/metrics-server/templates/pdb.yaml | 10 ++++++++-- charts/metrics-server/values.yaml | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/charts/metrics-server/CHANGELOG.md b/charts/metrics-server/CHANGELOG.md index 0d71b0da1..fbf8d6c70 100644 --- a/charts/metrics-server/CHANGELOG.md +++ b/charts/metrics-server/CHANGELOG.md @@ -17,6 +17,7 @@ ### Added - Add options on howto secure the connection between metrics-server and the kube-apiserver. ([#1288](https://github.com/kubernetes-sigs/metrics-server/pull/1288)) _@mkilchhofer_ +- Added `unhealthyPodEvictionPolicy` to the metrics-server PDB as a user enabled feature. ([#1574](https://github.com/kubernetes-sigs/metrics-server/pull/1574)) @peterabarr ## [3.12.2] - TBC diff --git a/charts/metrics-server/README.md b/charts/metrics-server/README.md index e4e846285..4590d8008 100644 --- a/charts/metrics-server/README.md +++ b/charts/metrics-server/README.md @@ -52,6 +52,8 @@ The following table lists the configurable parameters of the _Metrics Server_ ch | `podDisruptionBudget.enabled` | If `true`, create `PodDisruptionBudget` resource. | `{}` | | `podDisruptionBudget.minAvailable` | Set the `PodDisruptionBudget` minimum available pods. | `nil` | | `podDisruptionBudget.maxUnavailable` | Set the `PodDisruptionBudget` maximum unavailable pods. | `nil` | +| `podDisruptionBudget.maxUnavailable` | Set the `PodDisruptionBudget` maximum unavailable pods. | `nil` | +| `podDisruptionBudget.unhealthyPodEvictionPolicy` | Unhealthy pod eviction policy for the PDB. | `nil` | | `defaultArgs` | Default arguments to pass to the _metrics-server_ command. | See _values.yaml_ | | `args` | Additional arguments to pass to the _metrics-server_ command. | `[]` | | `livenessProbe` | Liveness probe. | See _values.yaml_ | diff --git a/charts/metrics-server/templates/pdb.yaml b/charts/metrics-server/templates/pdb.yaml index 1f5eddf87..de7689d4a 100644 --- a/charts/metrics-server/templates/pdb.yaml +++ b/charts/metrics-server/templates/pdb.yaml @@ -9,10 +9,16 @@ metadata: spec: {{- if .Values.podDisruptionBudget.minAvailable }} minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} - {{- end }} + {{- end }} {{- if .Values.podDisruptionBudget.maxUnavailable }} maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} - {{- end }} + {{- end }} + {{- if (semverCompare ">= 1.27-0" .Capabilities.KubeVersion.Version) }} + {{- with .Values.podDisruptionBudget.unhealthyPodEvictionPolicy }} + unhealthyPodEvictionPolicy: {{ . }} + {{- end }} + {{- end }} + selector: matchLabels: {{- include "metrics-server.selectorLabels" . | nindent 6 }} diff --git a/charts/metrics-server/values.yaml b/charts/metrics-server/values.yaml index 79eaf9397..ff88d13f5 100644 --- a/charts/metrics-server/values.yaml +++ b/charts/metrics-server/values.yaml @@ -90,6 +90,7 @@ podDisruptionBudget: enabled: false minAvailable: maxUnavailable: + unhealthyPodEvictionPolicy: defaultArgs: - --cert-dir=/tmp