# helm_charts_master-pdb.yaml
{{- if .Values.master.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  name: {{ template "mariadb.fullname" . }}
  labels:
    app: "{{ template "mariadb.name" . }}"
    component: "master"
    chart: {{ template "mariadb.chart" . }}
    release: {{ .Release.Name | quote }}
    heritage: {{ .Release.Service | quote }}
spec:
{{- if .Values.master.podDisruptionBudget.minAvailable }}
  minAvailable: {{ .Values.master.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.master.podDisruptionBudget.maxUnavailable }}
  maxUnavailable: {{ .Values.master.podDisruptionBudget.maxUnavailable }}
{{- end }}
  selector:
    matchLabels:
      app: "{{ template "mariadb.name" . }}"
      component: "master"
      release: {{ .Release.Name | quote }}
{{- end }}