This is an automated email from the ASF dual-hosted git repository.
adutra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new c5fd3683b feat: Add Pod Disruption Budget support to Helm chart (#2380)
c5fd3683b is described below
commit c5fd3683b9d225c3d0eafc67d5750af2a47c621b
Author: Bryan Maloyer <[email protected]>
AuthorDate: Wed Aug 20 14:13:22 2025 +0200
feat: Add Pod Disruption Budget support to Helm chart (#2380)
---
helm/polaris/README.md | 5 +
helm/polaris/templates/poddisruptionbudget.yaml | 45 +++++
helm/polaris/tests/poddisruptionbudget_test.yaml | 210 +++++++++++++++++++++++
helm/polaris/values.yaml | 15 ++
4 files changed, 275 insertions(+)
diff --git a/helm/polaris/README.md b/helm/polaris/README.md
index 1cc84f6de..192c7c3d3 100644
--- a/helm/polaris/README.md
+++ b/helm/polaris/README.md
@@ -311,6 +311,11 @@ ct install --namespace polaris --charts ./helm/polaris
| persistence.relationalJdbc.secret.username | string | `"username"` | The
secret key holding the database username for authentication |
| persistence.type | string | `"in-memory"` | The type of persistence to use.
Two built-in types are supported: in-memory and relational-jdbc. The
eclipse-link type is also supported but is deprecated. |
| podAnnotations | object | `{}` | Annotations to apply to polaris pods. |
+| podDisruptionBudget | object |
`{"annotations":{},"enabled":false,"maxUnavailable":null,"minAvailable":null}`
| Pod disruption budget settings. |
+| podDisruptionBudget.annotations | object | `{}` | Annotations to add to the
pod disruption budget. |
+| podDisruptionBudget.enabled | bool | `false` | Specifies whether a pod
disruption budget should be created. |
+| podDisruptionBudget.maxUnavailable | string | `nil` | The maximum number of
pods that can be unavailable during disruptions. Can be an absolute number (ex:
5) or a percentage of desired pods (ex: 50%). IMPORTANT: Cannot be used
simultaneously with minAvailable. |
+| podDisruptionBudget.minAvailable | string | `nil` | The minimum number of
pods that should remain available during disruptions. Can be an absolute number
(ex: 5) or a percentage of desired pods (ex: 50%). IMPORTANT: Cannot be used
simultaneously with maxUnavailable. |
| podLabels | object | `{}` | Additional Labels to apply to polaris pods. |
| podSecurityContext | object |
`{"fsGroup":10001,"seccompProfile":{"type":"RuntimeDefault"}}` | Security
context for the polaris pod. See
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/. |
| podSecurityContext.fsGroup | int | `10001` | GID 10001 is compatible with
Polaris OSS default images; change this if you are using a different image. |
diff --git a/helm/polaris/templates/poddisruptionbudget.yaml
b/helm/polaris/templates/poddisruptionbudget.yaml
new file mode 100644
index 000000000..c7e9217af
--- /dev/null
+++ b/helm/polaris/templates/poddisruptionbudget.yaml
@@ -0,0 +1,45 @@
+{{/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/}}
+
+{{- if .Values.podDisruptionBudget.enabled -}}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+ name: {{ include "polaris.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ {{- include "polaris.labels" . | nindent 4 }}
+ {{- if .Values.podDisruptionBudget.annotations }}
+ annotations:
+ {{- tpl (toYaml .Values.podDisruptionBudget.annotations) . | nindent 4 }}
+ {{- end }}
+spec:
+ {{- if and .Values.podDisruptionBudget.minAvailable
.Values.podDisruptionBudget.maxUnavailable }}
+ {{- fail "podDisruptionBudget.minAvailable and
podDisruptionBudget.maxUnavailable cannot be both set." -}}
+ {{- end }}
+ {{- if .Values.podDisruptionBudget.minAvailable }}
+ minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
+ {{- end }}
+ {{- if .Values.podDisruptionBudget.maxUnavailable }}
+ maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
+ {{- end }}
+ selector:
+ matchLabels:
+ {{- include "polaris.selectorLabels" . | nindent 6 }}
+{{- end }}
diff --git a/helm/polaris/tests/poddisruptionbudget_test.yaml
b/helm/polaris/tests/poddisruptionbudget_test.yaml
new file mode 100644
index 000000000..b117e2978
--- /dev/null
+++ b/helm/polaris/tests/poddisruptionbudget_test.yaml
@@ -0,0 +1,210 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+chart:
+ version: 1.2.3
+ appVersion: 4.5.6
+
+release:
+ name: polaris-release
+ namespace: polaris-ns
+
+templates:
+ - poddisruptionbudget.yaml
+
+tests:
+
+ # kind
+ - it: should not create PDB by default
+ asserts:
+ - containsDocument:
+ kind: PodDisruptionBudget
+ apiVersion: policy/v1
+ not: true
+ - it: should create PDB when enabled
+ set:
+ podDisruptionBudget.enabled: true
+ asserts:
+ - containsDocument:
+ kind: PodDisruptionBudget
+ apiVersion: policy/v1
+
+ # metadata.name (with PDB enabled)
+ - it: should set PDB name
+ set:
+ podDisruptionBudget.enabled: true
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release
+ - it: should set PDB name with override
+ set:
+ podDisruptionBudget.enabled: true
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-release-polaris-override
+ - it: should set PDB name with full override
+ set:
+ podDisruptionBudget.enabled: true
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: metadata.name
+ value: polaris-override
+
+ # metadata.namespace (with PDB enabled)
+ - it: should set PDB namespace
+ set:
+ podDisruptionBudget.enabled: true
+ asserts:
+ - equal:
+ path: metadata.namespace
+ value: polaris-ns
+
+ # metadata.labels (with PDB enabled)
+ - it: should set PDB default labels
+ set:
+ podDisruptionBudget.enabled: true
+ asserts:
+ - isSubset:
+ path: metadata.labels
+ content:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ app.kubernetes.io/version: 4.5.6
+ app.kubernetes.io/managed-by: Helm
+ helm.sh/chart: polaris-1.2.3
+
+ # metadata.annotations (with PDB enabled)
+ - it: should not set annotations by default
+ set:
+ podDisruptionBudget.enabled: true
+ asserts:
+ - isNull:
+ path: metadata.annotations
+ - it: should set custom annotations
+ set:
+ podDisruptionBudget.enabled: true
+ podDisruptionBudget.annotations:
+ example.com/policy: "critical"
+ kubernetes.io/description: "PDB for Polaris"
+ asserts:
+ - equal:
+ path: metadata.annotations
+ value:
+ example.com/policy: "critical"
+ kubernetes.io/description: "PDB for Polaris"
+ - it: should template annotations
+ set:
+ podDisruptionBudget.enabled: true
+ podDisruptionBudget.annotations:
+ app.example.com/release: "{{ .Release.Name }}"
+ asserts:
+ - equal:
+ path: metadata.annotations
+ value:
+ app.example.com/release: "polaris-release"
+
+ - it: should set custom maxUnavailable
+ set:
+ podDisruptionBudget.enabled: true
+ podDisruptionBudget.maxUnavailable: 2
+ asserts:
+ - equal:
+ path: spec.maxUnavailable
+ value: 2
+ - isNull:
+ path: spec.minAvailable
+ - it: should set maxUnavailable percentage
+ set:
+ podDisruptionBudget.enabled: true
+ podDisruptionBudget.maxUnavailable: "50%"
+ asserts:
+ - equal:
+ path: spec.maxUnavailable
+ value: "50%"
+ - isNull:
+ path: spec.minAvailable
+
+ # spec.minAvailable
+ - it: should set minAvailable and unset maxUnavailable
+ set:
+ podDisruptionBudget.enabled: true
+ podDisruptionBudget.minAvailable: 2
+ podDisruptionBudget.maxUnavailable: null
+ asserts:
+ - equal:
+ path: spec.minAvailable
+ value: 2
+ - isNull:
+ path: spec.maxUnavailable
+ - it: should set minAvailable percentage
+ set:
+ podDisruptionBudget.enabled: true
+ podDisruptionBudget.minAvailable: "75%"
+ podDisruptionBudget.maxUnavailable: null
+ asserts:
+ - equal:
+ path: spec.minAvailable
+ value: "75%"
+ - isNull:
+ path: spec.maxUnavailable
+
+ # spec.selector.matchLabels
+ - it: should set selector labels to match deployment
+ set:
+ podDisruptionBudget.enabled: true
+ asserts:
+ - equal:
+ path: spec.selector.matchLabels
+ value:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+ - it: should set selector labels with name override
+ set:
+ podDisruptionBudget.enabled: true
+ nameOverride: polaris-override
+ asserts:
+ - equal:
+ path: spec.selector.matchLabels
+ value:
+ app.kubernetes.io/name: polaris-override
+ app.kubernetes.io/instance: polaris-release
+ - it: should set selector labels with full name override
+ set:
+ podDisruptionBudget.enabled: true
+ fullnameOverride: polaris-override
+ asserts:
+ - equal:
+ path: spec.selector.matchLabels
+ value:
+ app.kubernetes.io/name: polaris
+ app.kubernetes.io/instance: polaris-release
+
+ # validation tests
+ - it: should fail when both minAvailable and maxUnavailable are set
+ set:
+ podDisruptionBudget.enabled: true
+ podDisruptionBudget.minAvailable: 1
+ podDisruptionBudget.maxUnavailable: 1
+ asserts:
+ - failedTemplate:
+ errorMessage: "podDisruptionBudget.minAvailable and
podDisruptionBudget.maxUnavailable cannot be both set."
diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml
index 8201d6f48..fddd9cc4e 100644
--- a/helm/polaris/values.yaml
+++ b/helm/polaris/values.yaml
@@ -62,6 +62,21 @@ podLabels: {}
# -- Additional Labels to apply to polaris configmap.
configMapLabels: {}
+# -- Pod disruption budget settings.
+podDisruptionBudget:
+ # -- Specifies whether a pod disruption budget should be created.
+ enabled: false
+ # -- The minimum number of pods that should remain available during
disruptions.
+ # Can be an absolute number (ex: 5) or a percentage of desired pods (ex:
50%).
+ # IMPORTANT: Cannot be used simultaneously with maxUnavailable.
+ minAvailable: ~
+ # -- The maximum number of pods that can be unavailable during disruptions.
+ # Can be an absolute number (ex: 5) or a percentage of desired pods (ex:
50%).
+ # IMPORTANT: Cannot be used simultaneously with minAvailable.
+ maxUnavailable: ~
+ # -- Annotations to add to the pod disruption budget.
+ annotations: {}
+
# -- The number of old ReplicaSets to retain to allow rollback (if not set,
the default Kubernetes value is set to 10).
revisionHistoryLimit: ~