{{- if .Values.maxUnavailable }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: "{{ template "consul.fullname" . }}-pdb"
  labels:
    heritage: {{ .Release.Service | quote }}
    release: {{ .Release.Name | quote }}
    chart: {{ template "consul.chart" . }}
    component: "{{ .Release.Name }}-{{ .Values.Component }}"
spec:
  maxUnavailable: {{ .Values.maxUnavailable }}
  selector:
    matchLabels:
      component: "{{ .Release.Name }}-{{ .Values.Component }}"
{{- end }}
