J release changes
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / kong / templates / pdb.yaml
old mode 100755 (executable)
new mode 100644 (file)
index f52b6fb..8d918c5
@@ -1,10 +1,17 @@
 {{- if .Values.podDisruptionBudget.enabled }}
-apiVersion: policy/v1beta1
+{{- if and (not .Values.autoscaling.enabled) (le (int .Values.replicaCount) 1) }}
+{{- fail "Enabling PodDisruptionBudget with replicaCount: 1 and no autoscaling prevents pod restarts during upgrades" }}
+{{- end }}
+{{- if and .Values.autoscaling.enabled (le (int .Values.autoscaling.minReplicas) 1) }}
+{{- fail "Enabling PodDisruptionBudget with autoscaling.minReplicas: 1 prevents pod restarts during upgrades" }}
+{{- end }}
+apiVersion: policy/v1
 kind: PodDisruptionBudget
 metadata:
-  name: "{{ template "kong.fullname" . }}"
+  name: {{ template "kong.fullname" . }}
+  namespace: {{ template "kong.namespace" . }}
   labels:
-    app: "{{ template "kong.name" . }}"
+    {{- include "kong.metaLabels" . | nindent 4 }}
 spec:
   {{- if .Values.podDisruptionBudget.minAvailable }}
   minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
@@ -14,7 +21,6 @@ spec:
   {{- end  }}
   selector:
     matchLabels:
-      app: {{ template "kong.name" . }}
-      release: {{ .Release.Name }}
-      component: app
-{{- end }}
\ No newline at end of file
+      {{- include "kong.metaLabels" . | nindent 6 }}
+      app.kubernetes.io/component: app
+{{- end }}