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