File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ cluster:
1515 awareness:
1616 {{- if eq $zoneAwareEnabled " true" }}
1717 attributes: zone,k8s_node_name
18+ force:
19+ zone:
20+ values: $ {ALL_ZONES}
1821 {{- else }}
1922 attributes: k8s_node_name
2023 {{- end }}
6871 attr:
6972 k8s_node_name: $ {NODE_NAME}
7073 {{- if eq $zoneAwareEnabled " true" }}
71- zone: $ {ZONE_NAME }
74+ zone: $ {CURRENT_ZONE }
7275 {{- end }}
7376 name: $ {POD_NAME}
7477 store:
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ if [ "${ZONE_AWARE_ENABLED}" = "true" ]; then
1010 echo " Error: ZONE_AWARE_ENABLED is true but NODE_NAME is not set"
1111 exit 1
1212 fi
13- ZONE_NAME=" "
13+ CURRENT_ZONE=" "
14+ ZONES=()
1415 IFS=' ;' read -ra PARTS <<< " ${ZONE_AWARE_MAPPING}"
1516 for PART in " ${PARTS[@]} " ; do
1617 IFS=' :' read -ra ZONE_PART <<< " ${PART}"
@@ -21,20 +22,24 @@ if [ "${ZONE_AWARE_ENABLED}" = "true" ]; then
2122 for NODE in " ${NODE_LIST[@]} " ; do
2223 NODE_NAME_TRIMMED=" ${NODE// / } "
2324 if [ " ${NODE_NAME_TRIMMED} " = " ${NODE_NAME} " ]; then
24- export ZONE_NAME=" ${ZONE} "
25+ export CURRENT_ZONE=" ${ZONE} "
26+ ZONES+=(" ${ZONE} " )
2527 break
2628 fi
2729 done
28- if [ -n " ${ZONE_NAME } " ]; then
30+ if [ -n " ${CURRENT_ZONE } " ]; then
2931 break
3032 fi
3133 fi
3234 done
33- if [ -z " ${ZONE_NAME } " ]; then
35+ if [ -z " ${CURRENT_ZONE } " ]; then
3436 echo " Error: ZONE_AWARE_ENABLED is true but failed to find zone for node ${NODE_NAME} in ZONE_AWARE_MAPPING: ${ZONE_AWARE_MAPPING} "
3537 exit 1
3638 fi
3739fi
40+ # join ZONES array with comma
41+ ALL_ZONES=$( IFS=,; echo " ${ZONES[*]} " )
42+ export ALL_ZONES
3843# remove initial master nodes block if cluster has been formed
3944if [ -f " ${CLUSTER_FORMED_FILE} " ]; then
4045 sed -i ' /# INITIAL_MASTER_NODES_BLOCK_START/,/# INITIAL_MASTER_NODES_BLOCK_END/d' config/elasticsearch.yml
You can’t perform that action at this time.
0 commit comments