{{- if and .Values.pdb.create .Values.mode.distributed.enabled }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: {{ include "rustfs.fullname" . }}
  labels:
    {{- include "rustfs.labels" . | nindent 4 }}
    {{- with .Values.commonLabels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
spec:
  {{- if .Values.pdb.minAvailable }}
  minAvailable: {{ .Values.pdb.minAvailable }}
  {{- end }}
  {{- if or .Values.pdb.maxUnavailable (not .Values.pdb.minAvailable) }}
  maxUnavailable: {{ .Values.pdb.maxUnavailable }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "rustfs.selectorLabels" . | nindent 6 }}
{{- end }}
