39 lines
1.7 KiB
YAML
39 lines
1.7 KiB
YAML
# PDB is not supported for DaemonSets.
|
|
# https://github.com/kubernetes/kubernetes/issues/108124
|
|
{{- if eq .Values.controller.kind "Deployment" }}
|
|
{{- $replicas := .Values.controller.replicaCount }}
|
|
{{- if and .Values.controller.autoscaling.enabled (not .Values.controller.keda.enabled) }}
|
|
{{- $replicas = .Values.controller.autoscaling.minReplicas }}
|
|
{{- else if and .Values.controller.keda.enabled (not .Values.controller.autoscaling.enabled) }}
|
|
{{- $replicas = .Values.controller.keda.minReplicas }}
|
|
{{- end }}
|
|
{{- if gt ($replicas | int) 1 }}
|
|
apiVersion: {{ ternary "policy/v1" "policy/v1beta1" (semverCompare ">=1.21.0-0" .Capabilities.KubeVersion.Version) }}
|
|
kind: PodDisruptionBudget
|
|
metadata:
|
|
labels:
|
|
{{- include "ingress-nginx.labels" . | nindent 4 }}
|
|
app.kubernetes.io/component: controller
|
|
{{- with .Values.controller.labels }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
name: {{ include "ingress-nginx.controller.fullname" . }}
|
|
namespace: {{ include "ingress-nginx.namespace" . }}
|
|
{{- if .Values.controller.annotations }}
|
|
annotations: {{ toYaml .Values.controller.annotations | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
{{- include "ingress-nginx.selectorLabels" . | nindent 6 }}
|
|
app.kubernetes.io/component: controller
|
|
{{- if and .Values.controller.minAvailable (not (hasKey .Values.controller "maxUnavailable")) }}
|
|
minAvailable: {{ .Values.controller.minAvailable }}
|
|
{{- else if .Values.controller.maxUnavailable }}
|
|
maxUnavailable: {{ .Values.controller.maxUnavailable }}
|
|
{{- end }}
|
|
{{- if .Values.controller.unhealthyPodEvictionPolicy }}
|
|
unhealthyPodEvictionPolicy: {{ .Values.controller.unhealthyPodEvictionPolicy }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|