Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support PDB in apisix-ingress-controller #695

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions charts/apisix-ingress-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ The same for container level, you need to set:
| nameOverride | string | `""` | Default values for apisix-ingress-controller. This is a YAML-formatted file. Declare variables to be passed into your templates. |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podDisruptionBudget | object | `{"enabled":false,"maxUnavailable":1,"minAvailable":"90%"}` | See https://kubernetes.io/docs/tasks/run-application/configure-pdb/ for more details |
| podDisruptionBudget.enabled | bool | `false` | Enable or disable podDisruptionBudget |
| podDisruptionBudget.maxUnavailable | int | `1` | Set the maxUnavailable of podDisruptionBudget |
| podDisruptionBudget.minAvailable | string | `"90%"` | 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 |
| podSecurityContext | object | `{}` | |
| priorityClassName | string | `""` | |
| rbac.create | bool | `true` | Specifies whether RBAC resources should be created |
Expand Down
38 changes: 38 additions & 0 deletions charts/apisix-ingress-controller/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# 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.podDisruptionBudget.enabled (or (and .Values.autoscaling.enabled (gt (.Values.autoscaling.minReplicas | int) 1)) (and (not .Values.autoscaling.enabled) (gt (.Values.replicaCount | int) 1))) }}
{{ if semverCompare "<1.21-0" .Capabilities.KubeVersion.Version -}}
apiVersion: policy/v1beta1
{{- else -}}
apiVersion: policy/v1
{{- end }}
kind: PodDisruptionBudget
metadata:
name: {{ include "apisix-ingress-controller.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "apisix-ingress-controller.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- else }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "apisix-ingress-controller.selectorLabels" . | nindent 6 }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/apisix-ingress-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ serviceMonitor:
# ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs
metricRelabelings: {}

# -- See https://kubernetes.io/docs/tasks/run-application/configure-pdb/ for more details
podDisruptionBudget:
# -- Enable or disable podDisruptionBudget
enabled: false
# -- 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
minAvailable: 90%
# -- Set the maxUnavailable of podDisruptionBudget
maxUnavailable: 1

podSecurityContext: {}
# fsGroup: 2000
Expand Down
Loading