{{- if and .Values.defaultBackend.enabled (gt (.Values.defaultBackend.replicaCount | int) 1) }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: {{ template "nginx-ingress.defaultBackend.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels: {{- include "nginx-ingress.labels" . | nindent 4 }}
    component: {{ .Values.defaultBackend.name }}
    {{- if .Values.commonLabels }}
    {{- include "nginx-ingress.tplValue" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
    {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "nginx-ingress.annotations" (dict "annotations" .Values.commonAnnotations "context" $) | trim | nindent 4 }}
  {{- end }}
spec:
  selector:
    matchLabels: {{- include "nginx-ingress.matchLabels" . | nindent 4 }}
      component: {{ .Values.defaultBackend.name }}
  minAvailable: {{ .Values.defaultBackend.minAvailable }}
{{- end }}
