diff --git a/charts/validators/templates/statefulset.yaml b/charts/validators/templates/statefulset.yaml index 5bea92392..b760076b7 100644 --- a/charts/validators/templates/statefulset.yaml +++ b/charts/validators/templates/statefulset.yaml @@ -2,7 +2,21 @@ {{- $root := . -}} {{- $counter := 0 }} {{- range (untilStep (int .Values.validatorsKeyIndex) (int (add .Values.validatorsKeyIndex .Values.validatorsCount)) 1) }} -{{ $counter = int (add1 $counter) }} + +{{ $rpcEndpoints := list }} +{{- if $.Values.beaconChainRpcEndpointsRandomized }} +{{- $rpcList := list }} +{{- range (untilStep $counter (len $.Values.beaconChainRpcEndpointsRandomized) 1) }} +{{ $rpcList = append $rpcList (index $.Values.beaconChainRpcEndpointsRandomized .) }} +{{- end }} +{{ $rpcList = append $rpcList $.Values.beaconChainRpcEndpointsRandomized }} +{{ $rpcEndpoints = include "flatten" $rpcList }} +{{- if ge $counter (len $.Values.beaconChainRpcEndpointsRandomized) }} + {{- $counter = 1 }} +{{- else }} + {{ $counter = int (add1 $counter) }} +{{- end }} +{{- end }} --- apiVersion: apps/v1 @@ -94,7 +108,7 @@ spec: env: {{- if $.Values.beaconChainRpcEndpointsRandomized }} - name: BEACON_CHAIN_RPC_ENDPOINTS_RANDOMIZED - value: "{{ $.Values.beaconChainRpcEndpointsRandomized | join "," }}" + value: "{{ $rpcEndpoints }}" {{- end }} {{- if $.Values.beaconChainRpcEndpoints }} - name: BEACON_CHAIN_RPC_ENDPOINTS