{{- if .Values.client.podDisruptionBudget.enabled }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
  labels:
    app: {{ template "elasticsearch.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    component: "{{ .Values.client.name }}"
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "elasticsearch.client.fullname" . }}
spec:
{{- if .Values.client.podDisruptionBudget.minAvailable }}
  minAvailable: {{ .Values.client.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.client.podDisruptionBudget.maxUnavailable }}
  maxUnavailable: {{ .Values.client.podDisruptionBudget.maxUnavailable }}
{{- end }}
  selector:
    matchLabels:
      app: {{ template "elasticsearch.name" . }}
      component: "{{ .Values.client.name }}"
      release: {{ .Release.Name }}
{{- end }}
