Check for available networks for a role

For network isolation, we specifcy available networks for role.
Therefore, there is no point in creating noop network resources for
networks that are not available/connected. This results in redundant
host entries for not available networks on overcloud nodes.

If a network is not available for a role we don't need to create
those extra noop resources.

For Undercloud/Standalone role we keep all networks in roles data
as the default ServiceNetMap specifies non ctlplane networks though
they map to ctlplane.

Change-Id: I07822ec0cba7eed352c0010eb893b5e5a522e95c
Closes-Bug: #1800811
This commit is contained in:
Rabi Mishra 2018-10-31 14:27:16 +05:30
parent 5413ca926d
commit 5d275fb922
5 changed files with 52 additions and 4 deletions

View File

@ -523,7 +523,7 @@ resources:
depends_on: {{role.name}}AllNodesDeployment
properties:
name: {{role.name}}AllNodesValidationDeployment
config: {get_resource: AllNodesValidationConfig}
config: {get_resource: {{role.name}}AllNodesValidationConfig}
servers: {get_attr: [{{role.name}}Servers, value]}
{{role.name}}IpListMap:
@ -531,7 +531,7 @@ resources:
properties:
ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]}
{%- for network in networks %}
{%- if network.enabled|default(true) %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]}
{%- else %}
{{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]}
@ -851,18 +851,22 @@ resources:
# ServiceNetMap's attribute values are available.
depends_on: ServiceNetMap
{%- for role in roles %}
# All Nodes Validations
AllNodesValidationConfig:
{{role.name}}AllNodesValidationConfig:
type: OS::TripleO::AllNodes::Validation
properties:
PingTestIps:
list_join:
- ' '
-
{%- for network in networks if network.enabled|default(true) %}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
- yaql:
expression: coalesce($.data, []).first(null)
data: {get_attr: [{{primary_role_name}}, {{network.name_lower}}_ip_address]}
{%- endif %}
{%- endfor %}
{%- endfor %}
# Optional ExtraConfig for all nodes - all roles are passed in here, but

View File

@ -262,6 +262,7 @@ parameters:
dns_nameservers attribute will be used.
type: comma_delimited_list
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}InterfaceRoutes:
default: []
description: >
@ -270,6 +271,7 @@ parameters:
Unless the default is changed, the parameter is automatically resolved
from the subnet host_routes attribute.
type: json
{%- endif %}
{%- endfor %}
ServerDeletionPolicy:
@ -336,6 +338,7 @@ conditions:
{%- endif %}
- ""
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{role.name}}_{{network.name}}_fixed_ip_set:
not:
equals:
@ -346,6 +349,7 @@ conditions:
equals:
- {get_param: {{network.name}}InterfaceRoutes}
- []
{%- endif %}
{%- endfor %}
ctlplane_subnet_cidr_set:
not:
@ -454,6 +458,7 @@ resources:
type: OS::TripleO::{{role.name}}::NodeUserData
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}Port:
type: OS::TripleO::{{role.name}}::Ports::{{network.name}}Port
properties:
@ -485,6 +490,7 @@ resources:
{%- endif %}
- {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex}
{%- endif %}
{%- endfor %}
NetworkConfig:
@ -520,12 +526,14 @@ resources:
- {get_attr: [{{server_resource_name}}, addresses, ctlplane, 0, subnets, 0, dns_nameservers]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
{{network.name}}InterfaceRoutes:
if:
- {{network.name_lower}}_interface_routes_set
- {get_param: {{network.name}}InterfaceRoutes}
- {get_attr: [{{network.name}}Port, host_routes]}
{%- endif %}
{%- endfor %}
NetIpMap:
@ -542,9 +550,11 @@ resources:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}Ip: {get_attr: [{{network.name}}Port, ip_address]}
{{network.name}}IpSubnet: {get_attr: [{{network.name}}Port, ip_subnet]}
{{network.name}}IpUri: {get_attr: [{{network.name}}Port, ip_address_uri]}
{%- endif %}
{%- endfor %}
NetHostMap:
@ -553,6 +563,7 @@ resources:
type: json
value:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower}}:
fqdn:
list_join:
@ -565,6 +576,7 @@ resources:
- '.'
- - {get_attr: [{{server_resource_name}}, name]}
- {{network.name.lower()}}
{%- endif %}
{%- endfor %}
ctlplane:
fqdn:
@ -698,7 +710,9 @@ resources:
{{role.name.lower()}}:
tripleo::clouddomain: {get_param: CloudDomain}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
fqdn_{{network.name_lower}}: {get_attr: [NetHostMap, value, {{network.name_lower}}, fqdn]}
{%- endif %}
{%- endfor %}
fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
fqdn_canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@ -756,8 +770,10 @@ resources:
str_replace:
template: "[PRIMARYIP]*,[PRIMARYHOST.DOMAIN]*,[PRIMARYHOST]*,\
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
[{{network.name}}IP]*,[{{network.name}}HOST.DOMAIN]*,\
[{{network.name}}HOST]*,\
{%- endif %}
{%- endfor %}
[CTLPLANEIP]*,[CTLPLANEHOST.DOMAIN]*,[CTLPLANEHOST]*"
params:
@ -765,8 +781,10 @@ resources:
DOMAIN: {get_param: CloudDomain}
PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
{{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
{%- endif %}
{%- endfor %}
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@ -796,7 +814,9 @@ outputs:
description: Mapping of network names to hostnames
value:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower|default(network.name.lower())}}: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower()) }}, fqdn]}
{%- endif %}
{%- endfor %}
ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
canonical: {get_attr: [NetHostMap, value, canonical, fqdn]}
@ -806,7 +826,9 @@ outputs:
template: |
PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
{%- endif %}
{%- endfor %}
CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
params:
@ -814,8 +836,10 @@ outputs:
DOMAIN: {get_param: CloudDomain}
PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
{{network.name}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
{%- endif %}
{%- endfor %}
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
@ -883,9 +907,11 @@ outputs:
description: The os-collect-config configuration associated with this server resource
value: {get_attr: [{{server_resource_name}}, os_collect_config]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name_lower|default(network.name.lower())}}_ip_address:
description: IP address of the server in the {{network.name}} network
value: {get_attr: [{{network.name}}Port, ip_address]}
{%- endif %}
{%- endfor %}
role_group_vars:
value:

View File

@ -11,6 +11,12 @@
tags:
- primary
- controller
networks:
- External
- InternalApi
- Storage
- StorageMgmt
- Tenant
disable_constraints: True
ServicesDefault:
- OS::TripleO::Services::Aide

View File

@ -10,6 +10,12 @@
tags:
- primary
- controller
networks:
- External
- InternalApi
- Storage
- StorageMgmt
- Tenant
ServicesDefault:
- OS::TripleO::Services::Aide
- OS::TripleO::Services::AodhApi

View File

@ -13,6 +13,12 @@
tags:
- primary
- controller
networks:
- External
- InternalApi
- Storage
- StorageMgmt
- Tenant
ServicesDefault:
- OS::TripleO::Services::Aide
- OS::TripleO::Services::AodhApi