{{- if .Values.controller.podDisruptionBudget.enabled -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: {{ .Values.controller.name }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "aws-efs-csi-driver.labels" . | nindent 4 }}
spec:
  selector:
    matchLabels:
      app: {{ .Values.controller.name }}
      app.kubernetes.io/name: {{ include "aws-efs-csi-driver.name" . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
  {{- if .Values.controller.podDisruptionBudget.unhealthyPodEvictionPolicy }}
  unhealthyPodEvictionPolicy: {{ .Values.controller.podDisruptionBudget.unhealthyPodEvictionPolicy }}
  {{- end }}
  {{- if .Values.controller.podDisruptionBudget.maxUnavailable }}
  maxUnavailable: {{ .Values.controller.podDisruptionBudget.maxUnavailable }}
  {{- end }}
  {{- if .Values.controller.podDisruptionBudget.minAvailable }}
  minAvailable: {{ .Values.controller.podDisruptionBudget.minAvailable }}
  {{- end }}
{{- end -}}