From 7d233b0f01389155afe2174e09fc4ea53204e01c Mon Sep 17 00:00:00 2001 From: Scott Hussey Date: Wed, 7 Aug 2019 16:27:41 -0500 Subject: [PATCH] (multinode) Use network roles for selecting IPs - With a extensible network configuration, selecting the correct IP for a node needs a little more intelligence Change-Id: I742270a4df440c02bb4bcc03badae3a96e094221 --- tools/multi_nodes_gate/airship_gate/lib/airship.sh | 6 ++++-- tools/multi_nodes_gate/airship_gate/lib/bgp.sh | 3 ++- tools/multi_nodes_gate/airship_gate/lib/ssh.sh | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/multi_nodes_gate/airship_gate/lib/airship.sh b/tools/multi_nodes_gate/airship_gate/lib/airship.sh index a51d147d..9f1fcdd1 100644 --- a/tools/multi_nodes_gate/airship_gate/lib/airship.sh +++ b/tools/multi_nodes_gate/airship_gate/lib/airship.sh @@ -15,7 +15,8 @@ install_ingress_ca() { shipard_cmd_stdout() { # needed to reach airship endpoints - dns_server=$(config_vm_ip "${BUILD_NAME}") + dns_netspec="$(config_netspec_for_role "dns")" + dns_server=$(config_vm_net_ip "${BUILD_NAME}" "$dns_netspec") install_ingress_ca ssh_cmd "${BUILD_NAME}" \ docker run -t --network=host \ @@ -43,7 +44,8 @@ shipyard_cmd() { } drydock_cmd_stdout() { - dns_server=$(config_vm_ip "${BUILD_NAME}") + dns_netspec="$(config_netspec_for_role "dns")" + dns_server=$(config_vm_net_ip "${BUILD_NAME}" "$dns_netspec") install_ingress_ca ssh_cmd "${BUILD_NAME}" \ docker run -t --network=host \ diff --git a/tools/multi_nodes_gate/airship_gate/lib/bgp.sh b/tools/multi_nodes_gate/airship_gate/lib/bgp.sh index 8012ab22..afcc81f8 100644 --- a/tools/multi_nodes_gate/airship_gate/lib/bgp.sh +++ b/tools/multi_nodes_gate/airship_gate/lib/bgp.sh @@ -5,7 +5,8 @@ QUAGGA_BGPD_CONF="${TEMP_DIR}/bgpd.conf" bgp_router_config() { quagga_as_number=$(config_bgp_as "quagga_as") calico_as_number=$(config_bgp_as "calico_as") - quagga_ip=$(config_vm_ip "build") + bgp_net="$(config_netspec_for_role "bgp")" + quagga_ip=$(config_vm_net_ip "build" "$bgp_net") QUAGGA_AS=${quagga_as_number} CALICO_AS=${calico_as_number} QUAGGA_IP=${quagga_ip} envsubst '${QUAGGA_AS} ${CALICO_AS} ${QUAGGA_IP}' < "${TEMPLATE_DIR}/bgpd_conf.sub" > "${QUAGGA_BGPD_CONF}" diff --git a/tools/multi_nodes_gate/airship_gate/lib/ssh.sh b/tools/multi_nodes_gate/airship_gate/lib/ssh.sh index 954c5cbf..c3318f72 100644 --- a/tools/multi_nodes_gate/airship_gate/lib/ssh.sh +++ b/tools/multi_nodes_gate/airship_gate/lib/ssh.sh @@ -24,10 +24,11 @@ ssh_config_declare() { envsubst < "${TEMPLATE_DIR}/ssh-config-global.sub" > "${SSH_CONFIG_DIR}/config" for n in $(config_vm_names) do + ssh_net="$(config_netspec_for_role "ssh")" env -i \ "SSH_CONFIG_DIR=${SSH_CONFIG_DIR}" \ "SSH_NODE_HOSTNAME=${n}" \ - "SSH_NODE_IP=$(config_vm_ip ${n})" \ + "SSH_NODE_IP=$(config_vm_net_ip ${n} "$ssh_net")" \ envsubst < "${TEMPLATE_DIR}/ssh-config-node.sub" >> "${SSH_CONFIG_DIR}/config" if [[ "$(config_vm_bootstrap ${n})" == "true" ]] then