{{- if .Values.proxy.pdb.enabled -}}
{{- if .Capabilities.APIVersions.Has "policy/v1" -}}
apiVersion: policy/v1
{{- else -}}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
  labels:
    app.kubernetes.io/name: {{ template "pomerium.proxy.name" . }}
    helm.sh/chart: {{ template "pomerium.chart" . }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/component: proxy
  name: {{ template "pomerium.proxy.fullname" . }}-pdp
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ template "pomerium.proxy.name" . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
  minAvailable: {{ .Values.proxy.pdb.minAvailable }}
{{- end }}
