{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: {{ include "vault-secrets-webhook.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
  name: {{ template "vault-secrets-webhook.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    helm.sh/chart: {{ template "vault-secrets-webhook.chart" . }}
    app.kubernetes.io/name: {{ template "vault-secrets-webhook.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/component: mutating-webhook
spec:
  {{- with .Values.podDisruptionBudget.minAvailable }}
  minAvailable: {{ . }}
  {{- end }}
  {{- with .Values.podDisruptionBudget.maxUnavailable }}
  maxUnavailable: {{ . }}
  {{- end }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ template "vault-secrets-webhook.name" . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
