# grafana_charts_poddisruptionbudget-memcached-frontend.yaml
{{- if and .Values.memcachedFrontend.enabled (gt (int .Values.memcachedFrontend.replicas) 1) }}
{{- if kindIs "invalid" .Values.memcachedFrontend.maxUnavailable }}
{{- fail "`.Values.memcachedFrontend.maxUnavailable` must be set when `.Values.memcachedFrontend.replicas` is greater than 1." }}
{{- else }}
apiVersion: {{ include "loki.pdb.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
  name: {{ include "loki.memcachedFrontendFullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "loki.memcachedFrontendLabels" . | nindent 4 }}
spec:
  selector:
    matchLabels:
      {{- include "loki.memcachedFrontendSelectorLabels" . | nindent 6 }}
  {{- with .Values.memcachedFrontend.maxUnavailable }}
  maxUnavailable: {{ . }}
  {{- end }}
  {{- with .Values.memcachedFrontend.minAvailable }}
  minAvailable: {{ . }}
  {{- end }}
{{- end }}
{{- end }}