From 696ecce86b238d9129d63b4a48fe9d32cbdf944e Mon Sep 17 00:00:00 2001 From: phuhung273 Date: Mon, 17 Nov 2025 19:56:14 +0700 Subject: [PATCH] feat(chart): VPA Updater PodDisruptionBudget Signed-off-by: phuhung273 --- .../charts/vertical-pod-autoscaler/Chart.yaml | 2 +- .../charts/vertical-pod-autoscaler/README.md | 5 ++++- .../templates/updater-pdb.yaml | 22 +++++++++++++++++++ .../vertical-pod-autoscaler/values.yaml | 10 +++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 vertical-pod-autoscaler/charts/vertical-pod-autoscaler/templates/updater-pdb.yaml diff --git a/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/Chart.yaml b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/Chart.yaml index 9b67747c8f65..d238155bb827 100644 --- a/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/Chart.yaml +++ b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.5.0 +version: 0.6.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/README.md b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/README.md index 5b3be213e44f..8ff89a301e8c 100644 --- a/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/README.md +++ b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/README.md @@ -4,7 +4,7 @@ WARNING: This chart is currently under development and is not ready for producti Automatically adjust resources for your workloads -![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) +![Version: 0.6.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.5.1](https://img.shields.io/badge/AppVersion-1.5.1-informational?style=flat-square) @@ -107,6 +107,9 @@ The Vertical Pod Autoscaler (VPA) automatically adjusts the CPU and memory resou | updater.leaderElection.resourceNamespace | string | `""` | | | updater.leaderElection.retryPeriod | string | `"2s"` | | | updater.podAnnotations | object | `{}` | | +| updater.podDisruptionBudget.enabled | bool | `true` | | +| updater.podDisruptionBudget.maxUnavailable | int or string | `nil` | Maximum number/percentage of pods that can be unavailable after the eviction. IMPORTANT: You can specify either 'minAvailable' or 'maxUnavailable', but not both. | +| updater.podDisruptionBudget.minAvailable | int or string | `1` | Minimum number/percentage of pods that must be available after the eviction. IMPORTANT: You can specify either 'minAvailable' or 'maxUnavailable', but not both. | | updater.podLabels | object | `{}` | | | updater.replicas | int | `2` | | | updater.serviceAccount.annotations | object | `{}` | | diff --git a/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/templates/updater-pdb.yaml b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/templates/updater-pdb.yaml new file mode 100644 index 000000000000..2c9e6746caf3 --- /dev/null +++ b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/templates/updater-pdb.yaml @@ -0,0 +1,22 @@ +{{- if and .Values.updater.enabled .Values.updater.podDisruptionBudget.enabled -}} +{{- if and .Values.updater.podDisruptionBudget.minAvailable .Values.updater.podDisruptionBudget.maxUnavailable }} + {{- fail "Only one of updater.podDisruptionBudget.minAvailable or updater.podDisruptionBudget.maxUnavailable should be set." }} +{{- end }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "vertical-pod-autoscaler.updater.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "vertical-pod-autoscaler.updater.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "vertical-pod-autoscaler.updater.selectorLabels" . | nindent 6 }} + {{- if .Values.updater.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.updater.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.updater.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.updater.podDisruptionBudget.maxUnavailable }} + {{- end }} +{{- end -}} diff --git a/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/values.yaml b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/values.yaml index bf7cc24c333f..4cc63ce4a5b7 100644 --- a/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/values.yaml +++ b/vertical-pod-autoscaler/charts/vertical-pod-autoscaler/values.yaml @@ -227,3 +227,13 @@ updater: renewDeadline: 10s # Duration the clients should wait between attempting acquisition and renewal of a leadership. retryPeriod: 2s + + # PodDisruptionBudget for the Updater. + podDisruptionBudget: + enabled: true + # -- (int or string) Minimum number/percentage of pods that must be available after the eviction. + # IMPORTANT: You can specify either 'minAvailable' or 'maxUnavailable', but not both. + minAvailable: 1 + # -- (int or string) Maximum number/percentage of pods that can be unavailable after the eviction. + # IMPORTANT: You can specify either 'minAvailable' or 'maxUnavailable', but not both. + maxUnavailable: