11{{- include "redpanda.validateReplicas" . }}
22kind : workload
33name : {{ include "redpanda.clusterName" . }}
4- description : {{ include "redpanda.clusterName" . }}
4+ description : Redpanda broker cluster
55gvc : {{ .Values.global.cpln.gvc }}
66tags :
77 # Brokers must resolve peer FQDNs for Raft consensus before they are Ready.
@@ -25,11 +25,16 @@ spec:
2525 - ' -c'
2626 - |
2727 ORDINAL=$(echo "$HOSTNAME" | awk -F'-' '{print $NF}')
28+ CLUSTER_NAME=$(echo "$HOSTNAME" | sed 's/-[0-9]*$//')
2829 ADMIN="localhost:{{ .Values.redpanda.listeners.adminApi.port }}"
29- until curl -sf "http://${ADMIN}/v1/health" | grep -q '"is_healthy":true'; do sleep 2; done
30+ ADMIN_HOSTS=""
31+ for i in $(seq 0 $(( {{ .Values.redpanda.replicas }} - 1 ))); do
32+ ADMIN_HOSTS="${ADMIN_HOSTS:+${ADMIN_HOSTS},}${CLUSTER_NAME}-${i}.${CLUSTER_NAME}:{{ .Values.redpanda.listeners.adminApi.port }}"
33+ done
34+ until curl -sf "http://${ADMIN}/v1/cluster/health_overview" 2>/dev/null | grep -qE '"is_healthy"\s*:\s*true'; do sleep 2; done
3035 [ "$ORDINAL" != "0" ] && exit 0
3136 {{- range .Values.redpanda.auth.users }}
32- rpk security user create {{ .username }} --password "$REDPANDA_{{ .username | upper | replace "-" "_" }}_PASSWORD" --mechanism {{ $.Values.redpanda.auth.saslMechanism }} --api-addr "$ADMIN " || true
37+ rpk security user create {{ .username }} --password "$REDPANDA_{{ .username | upper | replace "-" "_" }}_PASSWORD" --mechanism {{ $.Values.redpanda.auth.saslMechanism }} -X admin.hosts="${ADMIN_HOSTS} " || true
3338 {{- end }}
3439 # Transfer all partition leadership off this broker before Kubernetes sends
3540 # SIGTERM. By the time SIGTERM arrives the broker holds no leadership, so
3944 command :
4045 - /bin/bash
4146 - ' -c'
42- - rpk cluster maintenance enable --wait --api-addr localhost:{{ .Values.redpanda.listeners.adminApi.port }} || true
47+ - rpk cluster maintenance enable --wait -X admin.hosts= localhost:{{ .Values.redpanda.listeners.adminApi.port }} || true
4348 cpu : ' {{ .Values.redpanda.cpu }}'
4449 {{- if .Values.redpanda.minCpu }}
4550 minCpu : ' {{ .Values.redpanda.minCpu }}'
9196 initialDelaySeconds : 20
9297 periodSeconds : 10
9398 successThreshold : 1
94- httpGet :
95- path : /v1/health
96- port : {{ .Values.redpanda.listeners.adminApi.port }}
99+ exec :
100+ command :
101+ - /bin/bash
102+ - ' -c'
103+ - curl -sf http://localhost:{{ .Values.redpanda.listeners.adminApi.port }}/v1/cluster/health_overview | grep -qE '"is_healthy"\s*:\s*true'
97104 timeoutSeconds : 5
98105 volumes :
99106 - path : /var/lib/redpanda/data
0 commit comments