diff --git a/templates/alertmanager/alertmanager-statefulset.yaml b/templates/alertmanager/alertmanager-statefulset.yaml index 41b592b0..562b91d2 100644 --- a/templates/alertmanager/alertmanager-statefulset.yaml +++ b/templates/alertmanager/alertmanager-statefulset.yaml @@ -156,9 +156,12 @@ spec: - "-config.file=/etc/cortex/cortex.yaml" {{- if gt (int .Values.alertmanager.replicas) 1}} {{- $fullName := include "cortex.alertmanagerFullname" . }} + {{- $peers := list }} {{- range $i := until (int .Values.alertmanager.replicas) }} - - "-alertmanager.cluster.peers={{ $fullName }}-{{ $i }}.{{ $fullName }}-headless.{{ $.Release.Namespace }}.svc.cluster.local:{{ $svcClusterPort }}" + {{- $peer := printf "%s-%d.%s-headless.%s.svc.cluster.local:%s" $fullName $i $.Release.Namespace $.Release.Namespace $svcClusterPort }} + {{- $peers = append $peers $peer }} {{- end }} + - "-alertmanager.cluster.peers={{ join "," $peers }}" {{- end }} {{- range $key, $value := .Values.alertmanager.extraArgs }} - "-{{ $key }}={{ $value }}"