{{- if .Values.pdb.create }}
kind: PodDisruptionBudget
apiVersion: policy/v1
metadata:
  name: {{ include "sealed-secrets.fullname" . }}
  namespace: {{ include "sealed-secrets.namespace" . }}
  labels: {{- include "sealed-secrets.labels" . | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "sealed-secrets.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
    {{- end }}
  annotations:
    {{- if .Values.commonAnnotations }}
    {{- include "sealed-secrets.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
spec:
  {{- if regexMatch "64$" (typeOf .Values.pdb.minAvailable) }}
  minAvailable: {{ .Values.pdb.minAvailable }}
  {{- end }}
  {{- if regexMatch "64$" (typeOf .Values.pdb.maxUnavailable) }}
  maxUnavailable: {{ .Values.pdb.maxUnavailable }}
  {{- end }}
  selector:
    matchLabels: {{- include "sealed-secrets.matchLabels" . | nindent 6 }}
{{- end }}
