{{- if .Values.podDisruptionBudget.enabled -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: {{ template "pihole.fullname" . }}-pdb
  labels:
    app: {{ template "pihole.name" . }}
    chart: {{ template "pihole.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
  minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
  maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
  selector:
    matchLabels:
      app: {{ template "pihole.name" . }}
{{- end }}
