- job_name: keep_balance
bearer_token: __MANAGEMENT_TOKEN__
static_configs:
- - targets: ['__CONTROLLER_INT_IP__:9005']
+ - targets: ['__KEEPBALANCE_INT_IP__:9005']
labels:
instance: keep-balance.__CLUSTER__
cluster: __CLUSTER__
cluster: __CLUSTER__
# Nodes
+ {%- set node_list = "__NODELIST__".split(',') %}
+ {%- set nodes = [] %}
+ {%- for node in node_list %}
+ {%- set _ = nodes.append(node.split('.')[0]) %}
+ {%- endfor %}
- job_name: node
static_configs:
- {% for node in [
- 'controller',
- 'keep0',
- 'workbench',
- 'shell',
- ] %}
+ {% for node in nodes %}
- targets: [ "{{ node }}.__DOMAIN__:9100" ]
labels:
instance: "{{ node }}.__CLUSTER__"
[shell.${DOMAIN}]=shell
)
+# Comma-separated list of nodes. This is used to dynamically adjust
+# salt pillars.
+NODELIST=""
+for node in "${!NODES[@]}"; do
+ if [ -z "$NODELIST" ]; then
+ NODELIST="$node"
+ else
+ NODELIST="$NODELIST,$node"
+ fi
+done
+
+# The mapping of roles to nodes. This is used to dinamically adjust
+# salt pillars.
+declare -A ROLES
+for node in "${!NODES[@]}"; do
+ roles="${NODES[$node]}"
+
+ # Split the comma-separated roles into an array
+ IFS=',' read -ra roles_array <<< "$roles"
+
+ for role in "${roles_array[@]}"; do
+ if [ -n "${ROLES[$role]:-}" ]; then
+ ROLES["$role"]="${ROLES[$role]},$node"
+ else
+ ROLES["$role"]=$node
+ fi
+ done
+done
+
# Host SSL port where you want to point your browser to access Arvados
# Defaults to 443 for regular runs, and to 8443 when called in Vagrant.
# You can point it to another port if desired
arguments ${@}
declare -A NODES
+declare -A ROLES
+declare NODELIST
if [[ -s ${CONFIG_FILE} && -s ${CONFIG_FILE}.secrets ]]; then
source ${CONFIG_FILE}.secrets
s#__ENABLE_BALANCER__#${ENABLE_BALANCER}#g;
s#__BALANCER_NODENAME__#${BALANCER_NODENAME}#g;
s#__BALANCER_BACKENDS__#${BALANCER_BACKENDS}#g;
+ s#__NODELIST__#${NODELIST}#g;
s#__DISPATCHER_INT_IP__#${DISPATCHER_INT_IP}#g;
s#__KEEPBALANCE_INT_IP__#${KEEPBALANCE_INT_IP}#g;
s#__COMPUTE_AMI__#${COMPUTE_AMI}#g;
s#__ENABLE_BALANCER__#${ENABLE_BALANCER}#g;
s#__BALANCER_NODENAME__#${BALANCER_NODENAME}#g;
s#__BALANCER_BACKENDS__#${BALANCER_BACKENDS}#g;
+ s#__NODELIST__#${NODELIST}#g;
s#__DISPATCHER_INT_IP__#${DISPATCHER_INT_IP}#g;
s#__KEEPBALANCE_INT_IP__#${KEEPBALANCE_INT_IP}#g;
s#__COMPUTE_AMI__#${COMPUTE_AMI}#g;