This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new e1a06d8981 [#8174] fix(chart): add pod disrutption budget in helm 
charts (#9292)
e1a06d8981 is described below

commit e1a06d8981e635d8809444a87a0cecc42bf32089
Author: Danhua Wang <[email protected]>
AuthorDate: Fri Dec 5 14:48:25 2025 +0800

    [#8174] fix(chart): add pod disrutption budget in helm charts (#9292)
    
    ### What changes were proposed in this pull request?
    
    Add Pod disrutption budget for gravitino chart and IRC chart
    
    ### Why are the changes needed?
    
    Fix: #8174
    
    ### Does this PR introduce _any_ user-facing change?
    
    N/A
    
    ### How was this patch tested?
    
    CI
---
 .../templates/poddisruptionbudget.yaml             | 51 +++++++++++++++
 .../gravitino-iceberg-rest-server/values.yaml      | 74 ++++++++++++++++++++++
 .../gravitino/templates/poddisruptionbudget.yaml   | 51 +++++++++++++++
 dev/charts/gravitino/values.yaml                   | 74 ++++++++++++++++++++++
 4 files changed, 250 insertions(+)

diff --git 
a/dev/charts/gravitino-iceberg-rest-server/templates/poddisruptionbudget.yaml 
b/dev/charts/gravitino-iceberg-rest-server/templates/poddisruptionbudget.yaml
new file mode 100644
index 0000000000..bcda165119
--- /dev/null
+++ 
b/dev/charts/gravitino-iceberg-rest-server/templates/poddisruptionbudget.yaml
@@ -0,0 +1,51 @@
+{{- /*
+    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 }}
+{{- $minAvailableSet := and (ne (toString 
.Values.podDisruptionBudget.minAvailable) "") (or 
.Values.podDisruptionBudget.minAvailable (eq 
(.Values.podDisruptionBudget.minAvailable | int) 0)) }}
+{{- $maxUnavailableSet := ne (toString 
.Values.podDisruptionBudget.maxUnavailable) "" }}
+{{- if and $minAvailableSet $maxUnavailableSet }}
+{{- fail "podDisruptionBudget.minAvailable and 
podDisruptionBudget.maxUnavailable cannot both be specified. Please specify 
only one." }}
+{{- end }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: {{ include "gravitino-iceberg-rest-server.fullname" . }}
+  namespace: {{ include "gravitino-iceberg-rest-server.namespace" . }}
+  labels:
+    {{- include "gravitino-iceberg-rest-server.labels" . | nindent 4 }}
+    {{- with .Values.podDisruptionBudget.labels }}
+    {{- toYaml . | nindent 4 }}
+    {{- end }}
+  {{- with .Values.podDisruptionBudget.annotations }}
+  annotations:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+spec:
+  selector:
+    matchLabels:
+      app: {{ include "gravitino-iceberg-rest-server.name" . }}
+      release: {{ .Release.Name }}
+  {{- if $minAvailableSet }}
+  minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
+  {{- end }}
+  {{- if $maxUnavailableSet }}
+  maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
+  {{- end }}
+{{- end }}
diff --git a/dev/charts/gravitino-iceberg-rest-server/values.yaml 
b/dev/charts/gravitino-iceberg-rest-server/values.yaml
index afbf030c5a..a695c1cd10 100644
--- a/dev/charts/gravitino-iceberg-rest-server/values.yaml
+++ b/dev/charts/gravitino-iceberg-rest-server/values.yaml
@@ -350,3 +350,77 @@ nodeSelector: {}
 tolerations: []
 
 affinity: {}
+
+## PodDisruptionBudget configuration
+## PodDisruptionBudgets limit the number of pods that can be down 
simultaneously during voluntary disruptions
+## (such as node drains, cluster upgrades, or pod evictions), ensuring high 
availability and service continuity.
+## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
+##
+podDisruptionBudget:
+  ## @param podDisruptionBudget.enabled Enable PodDisruptionBudget creation
+  ## Set to true to create a PodDisruptionBudget resource for the Iceberg REST 
Server deployment
+  ##
+  enabled: false
+
+  ## @param podDisruptionBudget.minAvailable Minimum number/percentage of pods 
that must remain available
+  ## Specify either an integer (e.g., 1, 2) or a percentage string (e.g., 
"50%")
+  ## This ensures at least this many pods stay running during voluntary 
disruptions
+  ##
+  ## Examples:
+  ##   minAvailable: 1           # At least 1 pod must remain available
+  ##   minAvailable: 2           # At least 2 pods must remain available
+  ##   minAvailable: "50%"       # At least 50% of pods must remain available
+  ##
+  ## When to use minAvailable:
+  ## - Use when you want to guarantee a minimum number of pods stay running
+  ## - Recommended for production deployments to ensure service availability
+  ## - With single replica (replicas: 1), minAvailable: 1 prevents all 
voluntary disruptions
+  ## - With multiple replicas, allows disruptions while maintaining minimum 
availability
+  ## Only used when podDisruptionBudget.enabled is true
+  ##
+  minAvailable: 1
+
+  ## @param podDisruptionBudget.maxUnavailable Maximum number/percentage of 
pods that can be unavailable
+  ## Specify either an integer (e.g., 1, 2) or a percentage string (e.g., 
"50%")
+  ## This limits how many pods can be down simultaneously during voluntary 
disruptions
+  ##
+  ## Examples:
+  ##   maxUnavailable: 1         # At most 1 pod can be unavailable
+  ##   maxUnavailable: 2         # At most 2 pods can be unavailable
+  ##   maxUnavailable: "25%"     # At most 25% of pods can be unavailable
+  ##
+  ## When to use maxUnavailable:
+  ## - Use when you want to control the rate of disruptions
+  ## - Useful for rolling updates and gradual scaling operations
+  ## - More flexible than minAvailable when scaling up/down
+  ##
+  ## IMPORTANT: Specify either minAvailable OR maxUnavailable, not both
+  ## If both are specified, Kubernetes will reject the PodDisruptionBudget and 
fail with an API validation error
+  ##
+  maxUnavailable: ""
+
+  ## @param podDisruptionBudget.labels Additional labels to apply to the 
PodDisruptionBudget resource
+  ## These labels are merged with the default Helm labels
+  ##
+  labels: {}
+  #   custom-label: value
+
+  ## @param podDisruptionBudget.annotations Additional annotations to apply to 
the PodDisruptionBudget resource
+  ## Useful for adding metadata or integration with other tools
+  ##
+  annotations: {}
+  #   custom-annotation: value
+
+## Relationship between PDB and replica count:
+## - Single replica (replicas: 1) + minAvailable: 1 = No voluntary disruptions 
allowed
+##   This prevents node drains and upgrades from evicting the only pod
+## - Multiple replicas (replicas: 3) + minAvailable: 2 = At least 2 pods must 
stay running
+##   Allows 1 pod to be disrupted at a time for maintenance
+## - Multiple replicas (replicas: 3) + maxUnavailable: 1 = At most 1 pod can 
be down
+##   Equivalent to minAvailable: 2 in this case
+##
+## Best practices:
+## - For production: Enable PDB with appropriate minAvailable or maxUnavailable
+## - For development/testing: Keep PDB disabled (default) for faster iterations
+## - Consider your replica count when setting PDB values
+## - Test PDB behavior in staging before applying to production
diff --git a/dev/charts/gravitino/templates/poddisruptionbudget.yaml 
b/dev/charts/gravitino/templates/poddisruptionbudget.yaml
new file mode 100644
index 0000000000..38c898edf7
--- /dev/null
+++ b/dev/charts/gravitino/templates/poddisruptionbudget.yaml
@@ -0,0 +1,51 @@
+{{- /*
+    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 }}
+{{- $minAvailableSet := and (ne (toString 
.Values.podDisruptionBudget.minAvailable) "") (or 
.Values.podDisruptionBudget.minAvailable (eq 
(.Values.podDisruptionBudget.minAvailable | int) 0)) }}
+{{- $maxUnavailableSet := ne (toString 
.Values.podDisruptionBudget.maxUnavailable) "" }}
+{{- if and $minAvailableSet $maxUnavailableSet }}
+{{- fail "podDisruptionBudget.minAvailable and 
podDisruptionBudget.maxUnavailable cannot both be specified. Please specify 
only one." }}
+{{- end }}
+apiVersion: policy/v1
+kind: PodDisruptionBudget
+metadata:
+  name: {{ include "gravitino.fullname" . }}
+  namespace: {{ include "gravitino.namespace" . }}
+  labels:
+    {{- include "gravitino.labels" . | nindent 4 }}
+    {{- with .Values.podDisruptionBudget.labels }}
+    {{- toYaml . | nindent 4 }}
+    {{- end }}
+  {{- with .Values.podDisruptionBudget.annotations }}
+  annotations:
+    {{- toYaml . | nindent 4 }}
+  {{- end }}
+spec:
+  selector:
+    matchLabels:
+      app: {{ include "gravitino.name" . }}
+      release: {{ .Release.Name }}
+  {{- if $minAvailableSet }}
+  minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
+  {{- end }}
+  {{- if $maxUnavailableSet }}
+  maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
+  {{- end }}
+{{- end }}
diff --git a/dev/charts/gravitino/values.yaml b/dev/charts/gravitino/values.yaml
index 0aedc1f199..a93a2998a6 100644
--- a/dev/charts/gravitino/values.yaml
+++ b/dev/charts/gravitino/values.yaml
@@ -559,3 +559,77 @@ tolerations: []
 ## ref: 
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
 ##
 affinity: {}
+
+## PodDisruptionBudget configuration
+## PodDisruptionBudgets limit the number of pods that can be down 
simultaneously during voluntary disruptions
+## (such as node drains, cluster upgrades, or pod evictions), ensuring high 
availability and service continuity.
+## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
+##
+podDisruptionBudget:
+  ## @param podDisruptionBudget.enabled Enable PodDisruptionBudget creation
+  ## Set to true to create a PodDisruptionBudget resource for the Gravitino 
deployment
+  ##
+  enabled: false
+
+  ## @param podDisruptionBudget.minAvailable Minimum number/percentage of pods 
that must remain available
+  ## Specify either an integer (e.g., 1, 2) or a percentage string (e.g., 
"50%")
+  ## This ensures at least this many pods stay running during voluntary 
disruptions
+  ##
+  ## Examples:
+  ##   minAvailable: 1           # At least 1 pod must remain available
+  ##   minAvailable: 2           # At least 2 pods must remain available
+  ##   minAvailable: "50%"       # At least 50% of pods must remain available
+  ##
+  ## When to use minAvailable:
+  ## - Use when you want to guarantee a minimum number of pods stay running
+  ## - Recommended for production deployments to ensure service availability
+  ## - With single replica (replicas: 1), minAvailable: 1 prevents all 
voluntary disruptions
+  ## - With multiple replicas, allows disruptions while maintaining minimum 
availability
+  ## - Only used when podDisruptionBudget.enabled: true. Set explicitly when 
enabling PDB.
+  ##
+  minAvailable: 1
+
+  ## @param podDisruptionBudget.maxUnavailable Maximum number/percentage of 
pods that can be unavailable
+  ## Specify either an integer (e.g., 1, 2) or a percentage string (e.g., 
"50%")
+  ## This limits how many pods can be down simultaneously during voluntary 
disruptions
+  ##
+  ## Examples:
+  ##   maxUnavailable: 1         # At most 1 pod can be unavailable
+  ##   maxUnavailable: 2         # At most 2 pods can be unavailable
+  ##   maxUnavailable: "25%"     # At most 25% of pods can be unavailable
+  ##
+  ## When to use maxUnavailable:
+  ## - Use when you want to control the rate of disruptions
+  ## - Useful for rolling updates and gradual scaling operations
+  ## - More flexible than minAvailable when scaling up/down
+  ##
+  ## IMPORTANT: Specify either minAvailable OR maxUnavailable, not both
+  ## If both are specified, Kubernetes will reject the PodDisruptionBudget and 
fail with an API validation error
+  ##
+  maxUnavailable: ""
+
+  ## @param podDisruptionBudget.labels Additional labels to apply to the 
PodDisruptionBudget resource
+  ## These labels are merged with the default Helm labels
+  ##
+  labels: {}
+  #   custom-label: value
+
+  ## @param podDisruptionBudget.annotations Additional annotations to apply to 
the PodDisruptionBudget resource
+  ## Useful for adding metadata or integration with other tools
+  ##
+  annotations: {}
+  #   custom-annotation: value
+
+## Relationship between PDB and replica count:
+## - Single replica (replicas: 1) + minAvailable: 1 = No voluntary disruptions 
allowed
+##   This prevents node drains and upgrades from evicting the only pod
+## - Multiple replicas (replicas: 3) + minAvailable: 2 = At least 2 pods must 
stay running
+##   Allows 1 pod to be disrupted at a time for maintenance
+## - Multiple replicas (replicas: 3) + maxUnavailable: 1 = At most 1 pod can 
be down
+##   Equivalent to minAvailable: 2 in this case
+##
+## Best practices:
+## - For production: Enable PDB with appropriate minAvailable or maxUnavailable
+## - For development/testing: Keep PDB disabled (default) for faster iterations
+## - Consider your replica count when setting PDB values
+## - Test PDB behavior in staging before applying to production

Reply via email to