J release changes
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / kong / templates / pdb.yaml
1 {{- if .Values.podDisruptionBudget.enabled }}
2 {{- if and (not .Values.autoscaling.enabled) (le (int .Values.replicaCount) 1) }}
3 {{- fail "Enabling PodDisruptionBudget with replicaCount: 1 and no autoscaling prevents pod restarts during upgrades" }}
4 {{- end }}
5 {{- if and .Values.autoscaling.enabled (le (int .Values.autoscaling.minReplicas) 1) }}
6 {{- fail "Enabling PodDisruptionBudget with autoscaling.minReplicas: 1 prevents pod restarts during upgrades" }}
7 {{- end }}
8 apiVersion: policy/v1
9 kind: PodDisruptionBudget
10 metadata:
11   name: {{ template "kong.fullname" . }}
12   namespace: {{ template "kong.namespace" . }}
13   labels:
14     {{- include "kong.metaLabels" . | nindent 4 }}
15 spec:
16   {{- if .Values.podDisruptionBudget.minAvailable }}
17   minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
18   {{- end  }}
19   {{- if .Values.podDisruptionBudget.maxUnavailable }}
20   maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
21   {{- end  }}
22   selector:
23     matchLabels:
24       {{- include "kong.metaLabels" . | nindent 6 }}
25       app.kubernetes.io/component: app
26 {{- end }}