Oleh Hryhorov | b58460e | 2020-02-05 15:53:48 +0200 | [diff] [blame^] | 1 | resource_registry: |
| 2 | "MCP2::NetworkAcc": ../fragments/NetworkAccVM.yaml |
| 3 | "MCP2::NetworkPrvFl": ../fragments/NetworkPrvFl.yaml |
| 4 | "MCP2::SrvInstances": ../fragments/SrvInstancesVM.yaml |
| 5 | |
Vasyl Saienko | ac363d4 | 2020-01-24 08:29:53 +0200 | [diff] [blame] | 6 | parameters: |
Vasyl Saienko | ac363d4 | 2020-01-24 08:29:53 +0200 | [diff] [blame] | 7 | image: bionic-server-cloudimg-amd64-20190612 |
Vasyl Saienko | ac363d4 | 2020-01-24 08:29:53 +0200 | [diff] [blame] | 8 | public_net_id: public |
Oleh Hryhorov | b58460e | 2020-02-05 15:53:48 +0200 | [diff] [blame^] | 9 | host_interface: 'ens3' |
Vasyl Saienko | ac363d4 | 2020-01-24 08:29:53 +0200 | [diff] [blame] | 10 | masters_size: 0 |
| 11 | worker_size: 3 |
Vasyl Saienko | 31d7e88 | 2020-01-24 13:21:29 +0200 | [diff] [blame] | 12 | cmp_size: 3 |
Vasyl Saienko | ac363d4 | 2020-01-24 08:29:53 +0200 | [diff] [blame] | 13 | gtw_size: 0 |
Oleh Hryhorov | b58460e | 2020-02-05 15:53:48 +0200 | [diff] [blame^] | 14 | lma_size: 0 |
| 15 | osd_size: 0 |
Vasyl Saienko | ac363d4 | 2020-01-24 08:29:53 +0200 | [diff] [blame] | 16 | ucp_boot_timeout: 1200 |
Oleh Hryhorov | b58460e | 2020-02-05 15:53:48 +0200 | [diff] [blame^] | 17 | cluster_public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCp0evjOaK8c8SKYK4r2+0BN7g+8YSvQ2n8nFgOURCyvkJqOHi1qPGZmuN0CclYVdVuZiXbWw3VxRbSW3EH736VzgY1U0JmoTiSamzLHaWsXvEIW8VCi7boli539QJP0ikJiBaNAgZILyCrVPN+A6mfqtacs1KXdZ0zlMq1BPtFciR1JTCRcVs5vP2Wwz5QtY2jMIh3aiwkePjMTQPcfmh1TkOlxYu5IbQyZ3G1ahA0mNKI9a0dtF282av/F6pwB/N1R1nEZ/9VtcN2I1mf1NW/tTHEEcTzXYo1R/8K9vlqAN8QvvGLZtZduGviNVNoNWvoxaXxDt8CPv2B2NCdQFZp |
| 18 | private_floating_network_cidr: '10.11.12.0/24' |
| 19 | private_floating_interface: 'ens4' |
| 20 | worker_metadata: {"labels": {"openstack-control-plane":"enabled","openstack-compute-node":"enabled","openvswitch":"enabled","role":"ceph-osd-node"}} |
Vasyl Saienko | ac363d4 | 2020-01-24 08:29:53 +0200 | [diff] [blame] | 21 | cmp_metadata: {"labels": {"openstack-compute-node":"enabled","openvswitch":"enabled", "role":"ceph-osd-node"}} |
| 22 | gtw_metadata: {"labels": {"openvswitch":"enabled"}} |
Oleh Hryhorov | b58460e | 2020-02-05 15:53:48 +0200 | [diff] [blame^] | 23 | functions_override: | |
| 24 | function network_config { |
| 25 | PUBLIC_NODE_IP_ADDRESS=${PUBLIC_INTERFACE_IP:-$(ip addr show dev ${PUBLIC_INTERFACE} | grep -Po 'inet \K[\d.]+' | egrep -v "127.0.|172.17")} |
| 26 | PUBLIC_NODE_IP_NETMASK=${PUBLIC_INTERFACE_NETMASK:-$(ip addr show dev ${PUBLIC_INTERFACE} | grep -Po 'inet \K[\d.]+\/[\d]+' | egrep -v "127.0.|172.17" | cut -d'/' -f2)} |
| 27 | |
| 28 | local public_interface=${1:-${PUBLIC_INTERFACE}} |
| 29 | local cloud_netplan_cfg="/etc/netplan/50-cloud-init.yaml" |
| 30 | local match_ip_line |
| 31 | |
| 32 | DEBIAN_FRONTEND=noninteractive apt -y install bridge-utils atop |
| 33 | |
| 34 | cat << EOF > /etc/systemd/network/10-veth-phy-br.netdev |
| 35 | [NetDev] |
| 36 | Name=veth-phy |
| 37 | Kind=veth |
| 38 | [Peer] |
| 39 | Name=veth-br |
| 40 | EOF |
| 41 | |
| 42 | sed -i 's/.*ethernets:.*/&\n veth-phy: {}/' ${cloud_netplan_cfg} |
| 43 | sed -i 's/.*ethernets:.*/&\n veth-br: {}/' ${cloud_netplan_cfg} |
| 44 | |
| 45 | match_ip_line=$(grep -nm1 "${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK}" ${cloud_netplan_cfg} | cut -d: -f1) |
| 46 | |
| 47 | sed -i "$((${match_ip_line}-1)),$((${match_ip_line}))d" ${cloud_netplan_cfg} |
| 48 | |
| 49 | cat << EOF >> ${cloud_netplan_cfg} |
| 50 | bridges: |
| 51 | br-public: |
| 52 | dhcp4: false |
| 53 | interfaces: |
| 54 | - ${PUBLIC_INTERFACE} |
| 55 | - veth-br |
| 56 | addresses: |
| 57 | - ${PUBLIC_NODE_IP_ADDRESS}/${PUBLIC_NODE_IP_NETMASK} |
| 58 | EOF |
| 59 | netplan --debug apply |
| 60 | } |