{{- if .Values.podDisruptionBudget.enabled }}
{{- if .Values.controller.enabled }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: {{ include "katib.fullname" . }}-controller
  namespace: {{ include "katib.namespace" . }}
  labels:
    {{- include "katib.controller.labels" . | nindent 4 }}
spec:
  {{- if .Values.podDisruptionBudget.controller.minAvailable }}
  minAvailable: {{ .Values.podDisruptionBudget.controller.minAvailable }}
  {{- end }}
  {{- if .Values.podDisruptionBudget.controller.maxUnavailable }}
  maxUnavailable: {{ .Values.podDisruptionBudget.controller.maxUnavailable }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "katib.controller.selectorLabels" . | nindent 6 }}
{{- end }}
{{- if .Values.ui.enabled }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: {{ include "katib.fullname" . }}-ui
  namespace: {{ include "katib.namespace" . }}
  labels:
    {{- include "katib.ui.labels" . | nindent 4 }}
spec:
  {{- if .Values.podDisruptionBudget.ui.minAvailable }}
  minAvailable: {{ .Values.podDisruptionBudget.ui.minAvailable }}
  {{- end }}
  {{- if .Values.podDisruptionBudget.ui.maxUnavailable }}
  maxUnavailable: {{ .Values.podDisruptionBudget.ui.maxUnavailable }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "katib.ui.selectorLabels" . | nindent 6 }}
{{- end }}
{{- if .Values.dbManager.enabled }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: {{ include "katib.fullname" . }}-db-manager
  namespace: {{ include "katib.namespace" . }}
  labels:
    {{- include "katib.dbManager.labels" . | nindent 4 }}
spec:
  {{- if .Values.podDisruptionBudget.dbManager.minAvailable }}
  minAvailable: {{ .Values.podDisruptionBudget.dbManager.minAvailable }}
  {{- end }}
  {{- if .Values.podDisruptionBudget.dbManager.maxUnavailable }}
  maxUnavailable: {{ .Values.podDisruptionBudget.dbManager.maxUnavailable }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "katib.dbManager.selectorLabels" . | nindent 6 }}
{{- end }}
{{- end }}