Native Redis Cluster deployed: {{ .Values.cluster.shards }} writable shards,
{{ .Values.cluster.replicasPerShard }} replica(s) per shard,
{{ include "redis-cluster.nodeCount" . }} total Redis instances.

Every shard's persistent members have REQUIRED hostname anti-affinity. A shard
cannot place two copies on one Kubernetes worker.

{{- if .Values.auth.enabled }}

Get the password:

  kubectl get secret -n {{ .Release.Namespace }} {{ include "redis-cluster.secretName" . }} \
    -o jsonpath='{.data.{{ include "redis-cluster.secretKey" . }}}' | base64 -d
{{- end }}
{{- if .Values.redisInsight.enabled }}

RedisInsight:
{{- if .Values.redisInsight.ingress.enabled }}
  {{ ternary "https" "http" .Values.redisInsight.ingress.tls.enabled }}://{{ .Values.redisInsight.ingress.host }}
{{- else }}
  kubectl port-forward -n {{ .Release.Namespace }} service/{{ include "redis-cluster.redisInsightName" . }} 5540:80
  http://127.0.0.1:5540
{{- end }}
{{- end }}

Cluster-aware client startup endpoint:

  {{ include "redis-cluster.fullname" . }}.{{ .Release.Namespace }}.svc:{{ .Values.redis.port }}
{{- if .Values.externalAccess.enabled }}

External cluster-aware client startup endpoint:

  kubectl get service -n {{ .Release.Namespace }} \
    {{ include "redis-cluster.fullname" . }}-external \
    -o jsonpath='{.status.loadBalancer.ingress[0].ip}{.status.loadBalancer.ingress[0].hostname}'

Use that returned address on port {{ .Values.externalAccess.port }}.

The external bootstrap LoadBalancer is discovery only. Redis advertises one
dynamic LoadBalancer VIP per member on the same port, so MOVED/ASK redirects
remain routable from outside Kubernetes without fixed addresses or port fan-out.
{{- end }}

Check all 16384 slots and primary/replica assignments:

  kubectl exec -n {{ .Release.Namespace }} \
    {{ include "redis-cluster.fullname" . }}-s0-n0-0 -c redis -- \
    redis-cli --cluster check 127.0.0.1:{{ .Values.redis.port }}

Do not use a standalone or Sentinel client. The client must support Redis
Cluster redirects and connect to the per-node hostnames returned in the slot map.

StatefulSets use updateStrategy=OnDelete so independent members cannot all roll
at once. Follow the one-member-at-a-time upgrade procedure in README.md.

{{- if .Values.metrics.enabled }}

Metrics: http://<pod>:{{ .Values.metrics.port }}/metrics (redis_exporter).
{{- if not .Values.metrics.serviceMonitor.enabled }}
Set metrics.serviceMonitor.enabled=true (plus the correct selector labels) when
using Prometheus Operator.
{{- end }}
{{- end }}
