2024-03-12 13:43:51 +00:00
|
|
|
# PDB is not supported for DaemonSets.
|
|
|
|
# https://github.com/kubernetes/kubernetes/issues/108124
|
|
|
|
{{- if eq .Values.controller.kind "Deployment" }}
|
2024-03-11 21:14:25 +00:00
|
|
|
{{- $replicas := .Values.controller.replicaCount }}
|
2024-03-12 13:43:51 +00:00
|
|
|
{{- if and .Values.controller.autoscaling.enabled (not .Values.controller.keda.enabled) }}
|
2024-03-11 21:14:25 +00:00
|
|
|
{{- $replicas = .Values.controller.autoscaling.minReplicas }}
|
2024-03-12 13:43:51 +00:00
|
|
|
{{- else if and .Values.controller.keda.enabled (not .Values.controller.autoscaling.enabled) }}
|
2024-03-11 21:14:25 +00:00
|
|
|
{{- $replicas = .Values.controller.keda.minReplicas }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if gt ($replicas | int) 1 }}
|
2021-08-05 12:23:22 +00:00
|
|
|
apiVersion: {{ ternary "policy/v1" "policy/v1beta1" (semverCompare ">=1.21.0-0" .Capabilities.KubeVersion.Version) }}
|
2020-02-24 19:25:57 +00:00
|
|
|
kind: PodDisruptionBudget
|
|
|
|
metadata:
|
|
|
|
labels:
|
2020-02-28 14:53:24 +00:00
|
|
|
{{- include "ingress-nginx.labels" . | nindent 4 }}
|
2020-03-04 02:53:23 +00:00
|
|
|
app.kubernetes.io/component: controller
|
2021-11-19 14:52:52 +00:00
|
|
|
{{- with .Values.controller.labels }}
|
|
|
|
{{- toYaml . | nindent 4 }}
|
|
|
|
{{- end }}
|
2020-03-04 02:53:23 +00:00
|
|
|
name: {{ include "ingress-nginx.controller.fullname" . }}
|
2023-10-24 17:53:46 +00:00
|
|
|
namespace: {{ include "ingress-nginx.namespace" . }}
|
2023-05-10 21:39:14 +00:00
|
|
|
{{- if .Values.controller.annotations }}
|
|
|
|
annotations: {{ toYaml .Values.controller.annotations | nindent 4 }}
|
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2020-02-28 14:53:24 +00:00
|
|
|
{{- include "ingress-nginx.selectorLabels" . | nindent 6 }}
|
2020-03-04 02:53:23 +00:00
|
|
|
app.kubernetes.io/component: controller
|
2023-05-25 17:26:53 +00:00
|
|
|
{{- if and .Values.controller.minAvailable (not (hasKey .Values.controller "maxUnavailable")) }}
|
2020-02-24 19:25:57 +00:00
|
|
|
minAvailable: {{ .Values.controller.minAvailable }}
|
2022-11-10 11:20:54 +00:00
|
|
|
{{- else if .Values.controller.maxUnavailable }}
|
|
|
|
maxUnavailable: {{ .Values.controller.maxUnavailable }}
|
|
|
|
{{- end }}
|
2024-09-20 12:34:38 +00:00
|
|
|
{{- if .Values.controller.unhealthyPodEvictionPolicy }}
|
|
|
|
unhealthyPodEvictionPolicy: {{ .Values.controller.unhealthyPodEvictionPolicy }}
|
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- end }}
|
2024-03-12 13:43:51 +00:00
|
|
|
{{- end }}
|