For RR config, get compute host IPs from etcd and /etc/hosts

This is a more robust and less Fuel-specific method than using
/etc/hiera/astute.yaml or /etc/hiera/nodes.yaml.  Specifically it is
difficult to know which of /etc/hiera/astute.yaml or
/etc/hiera/nodes.yaml will be updated in a given redeployment
situation, and hence which of those will contain the latest compute
node information.

Change-Id: Ie1b88709840719546dd1b924fc6e8922c829d27c
This commit is contained in:
Neil Jerram 2016-03-08 14:25:12 +00:00
parent b2c0af1a80
commit 7bfd81a34d
1 changed files with 14 additions and 4 deletions

View File

@ -1,18 +1,28 @@
#!/bin/bash
# Copyright 2015 Metaswitch Networks
# Copyright 2015-2016 Metaswitch Networks
exec > /tmp/calico_route_reflector.log 2>&1
exec >> /tmp/calico_route_reflector.log 2>&1
set -x
echo "================ `date` ================"
echo "Hi, I'm a route_reflector node!"
# Calculate IP addresses of route reflector peers.
this_node_address=$(python get_node_ip.py `hostname`)
controller_node_addresses=$(python get_node_ips_by_role.py controller)
client_peers=$(python get_node_ips_by_role.py compute)
route_reflector_peers=("${controller_node_addresses[@]/$this_node_address}")
# Get compute host names from etcd.
compute_hosts=$(etcdctl ls /calico/felix/v1/host | xargs -n1 basename)
# Use /etc/hosts to convert each compute host name to an IP address.
client_peers=
for compute in $compute_hosts; do
compute=$(awk "/$compute/{print \$1;}" /etc/hosts)
client_peers="$client_peers $compute"
done
# Generate basic config for a BIRD BGP route reflector.
cat > /etc/bird/bird.conf <<EOF
# Configure logging