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

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new c9b74d9  APISIX - Supports PodDisruptionBudget (#220)
c9b74d9 is described below

commit c9b74d9de83ed92c5c452cb74cc4e2e03a2b0af1
Author: Hao Xin <[email protected]>
AuthorDate: Thu Jan 27 20:00:41 2022 +0800

    APISIX - Supports PodDisruptionBudget (#220)
---
 charts/apisix/README.md          |  3 +++
 charts/apisix/templates/pdb.yaml | 34 ++++++++++++++++++++++++++++++++++
 charts/apisix/values.yaml        |  6 ++++++
 3 files changed, 43 insertions(+)

diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 847c472..cda47d9 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -71,6 +71,9 @@ The following tables lists the configurable parameters of the 
apisix chart and t
 | `apisix.podAnnotations`                  | Annotations to add to each pod    
                  | `{}`                                                    |
 | `apisix.podSecurityContext`              | Set the securityContext for 
Apache APISIX pods      | `{}`                                                  
  |
 | `apisix.securityContext`                 | Set the securityContext for 
Apache APISIX container | `{}`                                                  
  |
+| `apisix.podDisruptionBudget.enabled`     | Enable or disable 
podDisruptionBudget               | `false`                                     
            |
+| `apisix.podDisruptionBudget.minAvailable`| Set the `minAvailable` of 
podDisruptionBudget. You can specify only one of `maxUnavailable` and 
`minAvailable` in a single PodDisruptionBudget. See [Specifying a Disruption 
Budget for your 
Application](https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget)
 for more details | `Not set` |
+| `apisix.podDisruptionBudget.maxUnavailable`| Set the maxUnavailable of 
podDisruptionBudget     | `1`                                                   
  |
 | `apisix.resources`                       | Set pod resource requests & 
limits                  | `{}`                                                  
  |
 | `apisix.nodeSelector`                    | Node labels for Apache APISIX pod 
assignment        | `{}`                                                    |
 | `apisix.tolerations`                     | List of node taints to tolerate   
                  | `{}`                                                    |
diff --git a/charts/apisix/templates/pdb.yaml b/charts/apisix/templates/pdb.yaml
new file mode 100644
index 0000000..e37239f
--- /dev/null
+++ b/charts/apisix/templates/pdb.yaml
@@ -0,0 +1,34 @@
+#
+# 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 (and .Values.apisix.enabled .Values.apisix.podDisruptionBudget.enabled) 
}}
+apiVersion: policy/v1beta1
+kind: PodDisruptionBudget
+metadata:
+  name: {{ include "apisix.fullname" . }}
+  namespace: {{ .Release.Namespace }}
+  labels:
+    {{- include "apisix.labels" . | nindent 4 }}
+spec:
+{{- if .Values.apisix.podDisruptionBudget.minAvailable }}
+  minAvailable: {{ .Values.apisix.podDisruptionBudget.minAvailable }}
+{{- else }}
+  maxUnavailable: {{ .Values.apisix.podDisruptionBudget.maxUnavailable }}
+{{- end }}
+  selector:
+    matchLabels:
+{{- include "apisix.selectorLabels" . | nindent 6 }}
+{{- end }}
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index 799ec9c..4232739 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -71,6 +71,12 @@ apisix:
     # runAsNonRoot: true
     # runAsUser: 1000
 
+  # See https://kubernetes.io/docs/tasks/run-application/configure-pdb/ for 
more details
+  podDisruptionBudget:
+    enabled: false
+    minAvailable: 90%
+    maxUnavailable: 1
+
   resources: {}
     # We usually recommend not to specify default resources and to leave this 
as a conscious
     # choice for the user. This also increases chances charts run on 
environments with little

Reply via email to