Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge "Simplify host entries generation" into stable/ussuri
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Jul 22, 2020
2 parents d15dac9 + eefa55e commit 8adccac
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 63 deletions.
78 changes: 34 additions & 44 deletions overcloud.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -402,42 +402,41 @@ resources:
VipHosts:
type: OS::Heat::Value
properties:
type: json
type: comma_delimited_list
value:
entries:
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, ctlplane]}
HOST: {get_param: CloudNameCtlplane}
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, ctlplane]}
HOST: {get_param: CloudNameCtlplane}
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- if network.name == 'External' %}
# Special case the External hostname param, which is CloudName
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudName}
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudName}
{%- elif network.name == 'InternalApi' %}
# Special case the Internal API hostname param, which is CloudNameInternal
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudNameInternal}
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudNameInternal}
{%- elif network.name == 'StorageMgmt' %}
# Special case StorageMgmt hostname param, which is CloudNameStorageManagement
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudNameStorageManagement}
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudNameStorageManagement}
{%- else %}
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudName{{network.name}}}
- str_replace:
template: IP HOST
params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudName{{network.name}}}
{%- endif %}
{%- endfor %}

Expand Down Expand Up @@ -807,32 +806,23 @@ resources:
for_each:
hostname: {get_param: DeploymentServerBlacklist}

# Single value comma delimited lists may be stored in strings
# that fails lists concat. Make them always lists (nested are OK)
HostsValue:
HostsEntryValue:
type: OS::Heat::Value
properties:
type: json
type: comma_delimited_list
value:
entries:
list_concat_unique:
list_concat:
- - {get_param: UndercloudHostsEntries}
- - if:
- add_vips_to_etc_hosts
- {get_attr: [VipHosts, value, entries]}
- {get_attr: [VipHosts, value]}
- []
{%- for role in roles %}
- {get_attr: [{{role.name}}, hosts_entry, entries]}
- {get_attr: [{{role.name}}, hosts_entry]}
{%- endfor %}
- - {get_param: ExtraHostFileEntries}

HostsEntryValue:
type: OS::Heat::Value
properties:
value:
yaql:
expression: coalesce($.data, []).where($ != null).where($ != []).flatten().distinct()
data: {get_attr: [HostsValue, value, entries]}

CloudNames:
type: OS::Heat::Value
properties:
Expand Down Expand Up @@ -1147,7 +1137,7 @@ resources:
VipHostsEntries:
if:
- add_vips_to_etc_hosts
- {get_attr: [VipHosts, value, entries]}
- {get_attr: [VipHosts, value]}
- []
KeystoneResourcesConfigs:
map_merge:
Expand Down Expand Up @@ -1184,7 +1174,7 @@ outputs:
value:
list_concat_unique:
- {get_attr: [HostsEntryValue, value]}
- {get_attr: [VipHosts, value, entries]}
- {get_attr: [VipHosts, value]}
EnabledServices:
description: The services enabled on each role
value:
Expand Down
37 changes: 18 additions & 19 deletions puppet/role.role.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -633,33 +633,32 @@ outputs:
HOSTNAME: {get_attr:[{{server_resource_name}}, name]}
hosts_entry:
value:
entries:
- str_replace:
template: PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
params:
PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
DOMAIN: {get_param: CloudDomain}
PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
- str_replace:
template: PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
params:
PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
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([]) %}
- str_replace:
template: {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
params:
DOMAIN: {get_param: CloudDomain}
- str_replace:
template: {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
params:
DOMAIN: {get_param: CloudDomain}
{%- 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]}
{{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 %}
{%- endif %}
{%- endfor %}
- str_replace:
template: CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
params:
DOMAIN: {get_param: CloudDomain}
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
- str_replace:
template: CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
params:
DOMAIN: {get_param: CloudDomain}
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
nova_server_resource:
description: Heat resource handle for {{role.name}} server
value:
Expand Down

0 comments on commit 8adccac

Please sign in to comment.