{{- if and .Values.alertmanager.enabled .Values.alertmanager.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: {{ template "kube-prometheus-stack.fullname" . }}-alertmanager
  namespace: {{ template "kube-prometheus-stack.namespace" . }}
  labels:
    app: {{ template "kube-prometheus-stack.name" . }}-alertmanager
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
spec:
  {{- if .Values.alertmanager.podDisruptionBudget.minAvailable }}
  minAvailable: {{ .Values.alertmanager.podDisruptionBudget.minAvailable }}
  {{- end }}
  {{- if .Values.alertmanager.podDisruptionBudget.maxUnavailable }}
  maxUnavailable: {{ .Values.alertmanager.podDisruptionBudget.maxUnavailable }}
  {{- end }}
  selector:
    matchLabels:
      app: alertmanager
      alertmanager: {{ template "kube-prometheus-stack.fullname" . }}-alertmanager
{{- end }}
