Make NetCidrMapValue contain list of cidrs in each net

Prior to routed networks we only had one subnet per network.
With routed networks each network can have multiple subnets.
The NetCidrMapValue should contain a list storing the cidr
of each subnet for each network.

Ceph:
  list_join is used to make a comma separated list of
  cidrs for public_network, monitor_address_block,
  cluster_network and radosgw_address_block.

Partial: blueprint tripleo-routed-networks-templates
Depends-On: Ia8e219b30d4f8b199b882e95fe2834252a92c15a
Depends-On: I1ace0a02e6aa2610559fee0d8576e6f1bc98d699
Change-Id: I68e064d23ec5d43f59146d974cae604d2c5fdb52
This commit is contained in:
Harald Jensås 2018-10-25 20:07:00 +02:00
parent 00cecfe2f3
commit 8665a0d97b
11 changed files with 74 additions and 17 deletions

View File

@ -12,7 +12,10 @@ description: "
fixed_ips:
- ip_address: 127.0.0.1
subnets:
- cidr: 127.0.0.0/24"
- cidr: 127.0.0.0/24
network:
tags:
- 127.0.0.0/24"
parameters:
name:
@ -39,6 +42,9 @@ outputs:
subnets:
value:
{get_param: [DeployedServerPortMap, {get_param: name}, subnets]}
network:
value:
{get_param: [DeployedServerPortMap, {get_param: name}, network]}
name:
value: {get_param: name}
status:

View File

@ -83,6 +83,7 @@ outputs:
monitoring_subscription: {get_param: MonitoringSubscriptionMemcached}
config_settings:
memcached_network:
# TODO(hjensas): Replace with get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, MemcachedNetwork]}
str_replace:
template:
"%{hiera('$NETWORK_subnet')}"

View File

@ -67,6 +67,7 @@ outputs:
snmp::agentaddress: {get_param: SnmpdBindHost}
snmp::snmpd_options: {get_param: SnmpdOptions}
snmpd_network:
# TODO(hjensas): Replace with get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, SnmpdNetwork]}
str_replace:
template: "%{hiera('$NETWORK_subnet')}"
params:

View File

@ -231,9 +231,18 @@ resources:
ceph_docker_image: {get_attr: [DockerImageUrlParts, value, image]}
ceph_docker_image_tag: {get_attr: [DockerImageUrlParts, value, image_tag]}
containerized_deployment: true
public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
monitor_address_block: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
public_network:
list_join:
- ','
- get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]
monitor_address_block:
list_join:
- ','
- get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]
cluster_network:
list_join:
- ','
- get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]
user_config: true
ceph_stable: true
ceph_origin: distro

View File

@ -58,7 +58,10 @@ resources:
vars:
radosgw_keystone: true
radosgw_keystone_ssl: false
radosgw_address_block: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephRgwNetwork]}]}
radosgw_address_block:
list_join:
- ','
- get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephRgwNetwork]}]
radosgw_civetweb_port: {get_param: [EndpointMap, CephRgwInternal, port]}
outputs:

View File

@ -195,10 +195,7 @@ outputs:
OS::stack_id:
description: {{network.name_lower}} network
value: {get_resource: {{network.name}}Network}
subnet_cidr:
description: The {{network.name}} networks base subnet in CIDR notation.
value: {get_attr: [{{network.name}}Subnet, cidr]}
subnet_cidrs:
network_cidrs:
description: List of {{network.name}} network's subnets in CIDR notation.
value:
list_concat:

View File

@ -2,6 +2,11 @@ heat_template_version: rocky
description: Create networks to split out Overcloud traffic
parameters:
CtlplaneNetworkCidrs:
type: json
description: Cidrs for the ctlplane network.
resources:
{%- for network in networks %}
{%- set network_name = network.compat_name|default(network.name) %}
@ -16,12 +21,14 @@ resources:
outputs:
net_cidr_map:
value:
# NOTE(gfidente): we need to replace the null value with a
# string to work around https://bugs.launchpad.net/heat/+bug/1700025
# NOTE(hjensas): If a network does not have any network_cidrs, fall back
# to the ctlplane (provisioning) network.
{%- for network in networks %}
{%- set network_name = network.compat_name|default(network.name) %}
{{network.name_lower}}:
yaql:
data: {get_attr: [{{network_name}}Network, subnet_cidr]}
expression: str($.data).replace('null', 'disabled')
data:
network_cidrs: {get_attr: [{{network_name}}Network, network_cidrs]}
ctlplane_cidrs: {get_param: CtlplaneNetworkCidrs}
expression: switch(not isList($.data.network_cidrs) => $.data.ctlplane_cidrs, $.data.network_cidrs => $.data.network_cidrs)
{%- endfor %}

View File

@ -350,11 +350,11 @@ resources:
map_replace:
- map_merge:
- {get_attr: [Networks, net_cidr_map]}
- ctlplane: {get_attr: [ControlVirtualIP, subnets, 0, cidr]}
# NOTE(hjensas): When ctlplane network and subnets are created by the
# undercloud installer, the subnet cidrs are added as tags.
- ctlplane: {get_attr: [ControlVirtualIP, network, tags]}
- keys:
ctlplane: {get_param: NeutronControlPlaneID}
values:
disabled: {get_attr: [ControlVirtualIP, subnets, 0, cidr]}
ServiceNetMap:
type: OS::TripleO::ServiceNetMap
@ -811,9 +811,11 @@ resources:
# creates the network architecture
Networks:
type: OS::TripleO::Network
properties:
CtlplaneNetworkCidrs: {get_attr: [ControlVirtualIP, network, tags]}
ControlVirtualIP:
depends_on: [Networks, ServiceNetMap]
depends_on: ServiceNetMap
type: OS::TripleO::Network::Ports::ControlPlaneVipPort
properties:
name: control_virtual_ip

View File

@ -91,6 +91,7 @@ outputs:
apache::server_signature: 'Off'
apache::server_tokens: 'Prod'
apache_remote_proxy_ips_network:
# TODO(hjensas): Replace with get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, ApacheNetwork]}
str_replace:
template:
"%{hiera('$NETWORK_subnet')}"

View File

@ -94,6 +94,7 @@ outputs:
params:
$NETWORK: {get_param: [ServiceNetMap, DesignateApiNetwork]}
tripleo::profile::base::designate::rndc_allowed_addresses:
# TODO(hjensas): Replace with get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, DesignateApiNetwork]}
- str_replace:
template:
"%{hiera('$NETWORK_subnet')}"

View File

@ -0,0 +1,29 @@
---
upgrade:
- |
Tags are now used on the ``ctlplane`` network to store the list of cidrs
associated with the subnets on the ``ctlplane`` network. Users of
Deployed Server (pre-provisioned servers) need to update the port map
(``DeployedServerPortMap``) to include the required data. For example::
parameter_defaults:
DeployedServerPortMap:
controller0-ctlplane:
fixed_ips:
- ip_address: 192.168.24.9
subnets:
- cidr: 192.168.24.0/24
network:
tags:
- 192.168.24.0/24
- 192.168.25.0/24
compute0-ctlplane:
fixed_ips:
- ip_address: 192.168.25.8
subnets:
- cidr: 192.168.25.0/24
network:
tags:
- 192.168.24.0/24
- 192.168.25.0/24