valkey-kustom/resources/node/files/conf/sentinel.conf.tpl
Philippe Caseiro 09c6791509
Some checks failed
Build and Push Image / Build and push image (push) Failing after 13s
fix(node): use headless service in all the scripts
2025-05-28 11:11:12 +02:00

47 lines
1.6 KiB
Smarty

{{- $hostname := env "HOSTNAME" }}
{{- $service := env "VALKEY_HEADLESS_SERVICE" }}
{{- $namespace := env "NAMESPACE" }}
{{- $port := env "VALKEY_PORT" }}
{{- $name := env "VALKEY_NAME" }}
{{- $sentinel_port := env "VALKEY_SENTINEL_PORT" }}
{{- $replicas := env "VALKEY_REPLICAS" }}
{{- $domain := printf "%s.%s.svc.cluster.local" $service $namespace }}
{{- $fqdn := printf "%s.%s" $hostname $domain }}
{{- $hostid := sha1sum $hostname }}
{{- $quorum := env "VALKEY_QUORUM" }}
#-REPLICAS:{{ $replicas }}
dir "/tmp"
port {{ $sentinel_port }}
sentinel monitor mymaster SENTINEL_MASTER {{ $port }} {{ $quorum }}
sentinel down-after-milliseconds mymaster 60000
# User-supplied sentinel configuration:
# End of sentinel configuration
{{ printf "sentinel myid %s" $hostid }}
sentinel announce-hostnames yes
sentinel resolve-hostnames yes
sentinel announce-port {{ $sentinel_port }}
sentinel announce-ip {{ $fqdn }}
# Generated by CONFIG REWRITE
latency-tracking-info-percentiles 50 99 99.9
protected-mode no
# gotemplate-pause!
user default on nopass sanitize-payload ~* &* +@all
# gotemplate-resume!
sentinel config-epoch mymaster 0
sentinel leader-epoch mymaster 0
sentinel current-epoch 0
{{- range $i, $e := until ( int $replicas ) }}
{{- $ndeHostname := printf "%s-%d" $name $i }}
{{- $ndeFQDN := printf "%s.%s" $ndeHostname $domain }}
{{- $nodeID := sha1sum $ndeHostname }}
{{- if (ne $fqdn $ndeFQDN) }}
sentinel {{ printf "known-sentinel mymaster %s %s %s" $ndeFQDN $sentinel_port $nodeID }}
sentinel {{ printf "known-replica mymaster %s %s" $ndeFQDN $port }}
{{- end}}
{{- end}}