* feat: deploy PDB if Keda is enabled and the minimum amount of replicas is greater than 1 * feat: add the corresponding unit-test to check PDB deployment with Keda * chore: rename the test of PDB to follow suggested pattern * chore: update the test-case suite name to the new format * Update charts/ingress-nginx/templates/controller-poddisruptionbudget.yaml Co-authored-by: Marco Ebert <marco_ebert@icloud.com> * Update charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml Co-authored-by: Marco Ebert <marco_ebert@icloud.com> --------- Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
32 lines
1.3 KiB
YAML
32 lines
1.3 KiB
YAML
{{- $replicas := .Values.controller.replicaCount }}
|
|
{{- if .Values.controller.autoscaling.enabled }}
|
|
{{- $replicas = .Values.controller.autoscaling.minReplicas }}
|
|
{{- else if .Values.controller.keda.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 }}
|
|
{{- end }}
|