Add radvd helper instance for ipv6 provisioning

Deploy an instance running radvd providing router
advertisement for the provisioning network.

Depends-On: https://review.rdoproject.org/r/25787
Change-Id: Ife0cbedb69001d8473141c93c1d5163694f855a5
This commit is contained in:
Harald Jensås 2019-09-27 19:52:30 +02:00
parent 87722bf8f2
commit 24e7a37b7e
7 changed files with 249 additions and 1 deletions

View File

@ -115,6 +115,24 @@ control the instances via IPMI. It will also prevent use of
ovb-build-nodes-json because there will be no BMC addresses.
Configuration for router advertisement daemon (radvd)
-----------------------------------------------------
**File:** environments/ipv6-radvd-configuration.yaml
**Description:** Contains the available parameters that need to be configured when using
a IPv6 network. Requires the ipv6-radvd.yaml environment.
Enable router advertisement daemon (radvd)
------------------------------------------
**File:** environments/ipv6-radvd.yaml
**Description:** Deploy the stack with a router advertisement daemon running for the
provisioning network.
Public Network External Router
------------------------------

View File

@ -0,0 +1,20 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Configuration for router advertisement daemon (radvd)
# description: |
# Contains the available parameters that need to be configured when using
# a IPv6 network. Requires the ipv6-radvd.yaml environment.
parameter_defaults:
# The Nova flavor to use for the radvd instance
# Type: string
radvd_flavor: m1.small
# The base image for the radvd instance. A CentOS 7 image is currently
# the only one supported.
# Type: string
radvd_image: CentOS-7-x86_64-GenericCloud

View File

@ -0,0 +1,12 @@
# *******************************************************************
# This file was created automatically by the sample environment
# generator. Developers should use `tox -e genconfig` to update it.
# Users are recommended to make changes to a copy of the file instead
# of the original, if any customizations are needed.
# *******************************************************************
# title: Enable router advertisement daemon (radvd)
# description: |
# Deploy the stack with a router advertisement daemon running for the
# provisioning network.
resource_registry:
OS::OVB::RouterAdvertisementDaemon: ../templates/ipv6-radvd.yaml

View File

@ -263,4 +263,22 @@ environments:
ovb-build-nodes-json because there will be no BMC addresses.
resource_registry:
OS::OVB::BMC: ../templates/bmc-none.yaml
-
name: ipv6-radvd-configuration
title: Configuration for router advertisement daemon (radvd)
description: |
Contains the available parameters that need to be configured when using
a IPv6 network. Requires the ipv6-radvd.yaml environment.
files:
templates/ipv6-radvd.yaml:
parameters:
- radvd_flavor
- radvd_image
-
name: ipv6-radvd
title: Enable router advertisement daemon (radvd)
description: |
Deploy the stack with a router advertisement daemon running for the
provisioning network.
resource_registry:
OS::OVB::RouterAdvertisementDaemon: ../templates/ipv6-radvd.yaml

174
templates/ipv6-radvd.yaml Normal file
View File

@ -0,0 +1,174 @@
heat_template_version: 2016-10-14
parameters:
key_name:
type: string
default: default
description: Nova keypair to inject into the undercloud and bmc
radvd_flavor:
type: string
default: m1.small
description: The Nova flavor to use for the radvd instance
radvd_image:
type: string
default: CentOS-7-x86_64-GenericCloud
description: |
The base image for the radvd instance. A CentOS 7 image is currently
the only one supported.
radvd_provision_address:
type: string
description: radvd address on the provision network subnet
default: fd12:3456:789a:1::fffe
IPv6_dhcpv6-statefull:
type: boolean
description: |
Controls radvd parameters AdvManagedFlag and AdvAutonomous. For stateful
addressing these should be AdvManagedFlag: on, AdvAutonomous: off, for
statelss (SLAAC) these should be AdvManagedFlag: off, AdvAutonomous: on.
default: false
networks:
type: json
private_net:
type: string
conditions:
dhcpv6-statefull:
get_param: IPv6_dhcpv6-statefull
resources:
radvd_port_private:
type: OS::Neutron::Port
properties:
name: radvd_port_private
network: {get_param: private_net}
radvd_port_provision:
type: OS::Neutron::Port
properties:
name: radvd_port_provision
network: {get_param: [networks, provision]}
port_security_enabled: False
fixed_ips:
- ip_address: {get_param: radvd_provision_address}
init_packages:
type: OS::Heat::CloudConfig
properties:
cloud_config:
package_upgrade: true
packages:
- centos-release-openstack-stein
- radvd
init_files:
type: OS::Heat::CloudConfig
properties:
cloud_config:
write_files:
- path: /etc/os-net-config/config.yaml
content:
str_replace:
template: |
network_config:
- type: interface
name: eth0
use_dhcp: false
use_dhcpv6: false
addresses:
- ip_netmask: $private_ip_netmask
routes:
- default: true
next_hop: $private_gateway
- type: interface
name: eth1
use_dhcp: false
use_dhcpv6: false
addresses:
- ip_netmask: $provision_ip_netmask
params:
$private_gateway: {get_attr: [radvd_port_private, subnets, 0, gateway_ip]}
$private_ip_netmask:
list_join:
- /
- - {get_attr: [radvd_port_private, fixed_ips, 0, ip_address]}
- {str_split: ['/', {get_attr: [radvd_port_private, subnets, 0, cidr]}, 1]}
$provision_ip_netmask:
list_join:
- /
- - {get_attr: [radvd_port_provision, fixed_ips, 0, ip_address]}
- {str_split: ['/', {get_attr: [radvd_port_provision, subnets, 0, cidr]}, 1]}
- path: /etc/radvd.conf
content:
str_replace:
template: |
interface eth1 {
AdvSendAdvert on;
AdvManagedFlag $AdvManagedFlag;
AdvOtherConfigFlag on;
AdvRASolicitedUnicast on;
AdvLinkMTU $MTU;
prefix $provision_cidr {
AdvAutonomous $AdvAutonomous;
AdvOnLink on;
};
};
params:
$provision_cidr: {get_attr: [radvd_port_provision, subnets, 0, cidr]}
$MTU: 1450
$AdvManagedFlag:
if:
- dhcpv6-statefull
- 'on'
- 'off'
$AdvAutonomous:
if:
- dhcpv6-statefull
- 'off'
- 'on'
- path: /etc/sysctl.d/98-ipv6-routing.conf
content: |
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.eth1.forwarding = 1
net.ipv6.conf.eth1.mc_forwarding = 1
init_runcmd:
type: OS::Heat::CloudConfig
properties:
cloud_config:
runcmd:
- ['sysctl','--system']
- ['yum', '-y', 'install', 'os-net-config']
- ['os-net-config', '--config', '/etc/os-net-config/config.yaml']
- ['systemctl', 'enable', 'radvd.service']
- ['systemctl', 'start', 'radvd.service']
- ['systemctl', 'status', 'radvd.service']
radvd_init:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: init_packages}
- config: {get_resource: init_files}
- config: {get_resource: init_runcmd}
radvb_server:
type: OS::Nova::Server
properties:
name: radvd
flavor: {get_param: radvd_flavor}
image: {get_param: radvd_image}
key_name: {get_param: key_name}
networks:
- {port: {get_resource: radvd_port_private}}
- {port: {get_resource: radvd_port_provision}}
config_drive: true
user_data_format: RAW
user_data: {get_resource: radvd_init}

View File

@ -11,3 +11,4 @@ resource_registry:
OS::OVB::UndercloudPorts: undercloud-ports.yaml
OS::OVB::UndercloudNetworks: undercloud-networks.yaml
OS::OVB::DHCPRelay: OS::Heat::None
OS::OVB::RouterAdvertisementDaemon: OS::Heat::None

View File

@ -127,6 +127,11 @@ resources:
networks: {get_param: networks}
dhcp_ips: {get_param: dhcp_ips}
ipv6_radvd:
type: OS::OVB::RouterAdvertisementDaemon
properties:
networks: {get_param: networks}
outputs:
baremetal_networks_routers_addresses:
value: {get_attr: [baremetal_networks, routers_addresses]}