{{- if .Values.middleManager.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  labels:
    app: {{ template "druid.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    component: {{ .Values.middleManager.name }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "druid.middleManager.fullname" . }}
spec:
{{- if .Values.middleManager.podDisruptionBudget.minAvailable }}
  minAvailable: {{ .Values.middleManager.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.middleManager.podDisruptionBudget.maxUnavailable }}
  maxUnavailable: {{ .Values.middleManager.podDisruptionBudget.maxUnavailable }}
{{- end }}
  selector:
    matchLabels:
      app: {{ template "druid.name" . }}
      component: {{ .Values.middleManager.name }}
      release: {{ .Release.Name }}
{{- end }}