Simplify host entries generation
This removes a resource and the the unnecessary yaql function. Also replaces json data types with lists to reduce memory footprint. Change-Id: I04a6114ca3d2703ca2891d6807d49b78ffee0f97 Related-Bug: #1886203
This commit is contained in:
parent
2acb0d376b
commit
d573f4e878
@ -402,42 +402,41 @@ resources:
|
|||||||
VipHosts:
|
VipHosts:
|
||||||
type: OS::Heat::Value
|
type: OS::Heat::Value
|
||||||
properties:
|
properties:
|
||||||
type: json
|
type: comma_delimited_list
|
||||||
value:
|
value:
|
||||||
entries:
|
- str_replace:
|
||||||
- str_replace:
|
template: IP HOST
|
||||||
template: IP HOST
|
params:
|
||||||
params:
|
IP: {get_attr: [VipMap, net_ip_map, ctlplane]}
|
||||||
IP: {get_attr: [VipMap, net_ip_map, ctlplane]}
|
HOST: {get_param: CloudNameCtlplane}
|
||||||
HOST: {get_param: CloudNameCtlplane}
|
|
||||||
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
|
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
|
||||||
{%- if network.name == 'External' %}
|
{%- if network.name == 'External' %}
|
||||||
# Special case the External hostname param, which is CloudName
|
# Special case the External hostname param, which is CloudName
|
||||||
- str_replace:
|
- str_replace:
|
||||||
template: IP HOST
|
template: IP HOST
|
||||||
params:
|
params:
|
||||||
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
||||||
HOST: {get_param: CloudName}
|
HOST: {get_param: CloudName}
|
||||||
{%- elif network.name == 'InternalApi' %}
|
{%- elif network.name == 'InternalApi' %}
|
||||||
# Special case the Internal API hostname param, which is CloudNameInternal
|
# Special case the Internal API hostname param, which is CloudNameInternal
|
||||||
- str_replace:
|
- str_replace:
|
||||||
template: IP HOST
|
template: IP HOST
|
||||||
params:
|
params:
|
||||||
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
||||||
HOST: {get_param: CloudNameInternal}
|
HOST: {get_param: CloudNameInternal}
|
||||||
{%- elif network.name == 'StorageMgmt' %}
|
{%- elif network.name == 'StorageMgmt' %}
|
||||||
# Special case StorageMgmt hostname param, which is CloudNameStorageManagement
|
# Special case StorageMgmt hostname param, which is CloudNameStorageManagement
|
||||||
- str_replace:
|
- str_replace:
|
||||||
template: IP HOST
|
template: IP HOST
|
||||||
params:
|
params:
|
||||||
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
||||||
HOST: {get_param: CloudNameStorageManagement}
|
HOST: {get_param: CloudNameStorageManagement}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
- str_replace:
|
- str_replace:
|
||||||
template: IP HOST
|
template: IP HOST
|
||||||
params:
|
params:
|
||||||
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
|
||||||
HOST: {get_param: CloudName{{network.name}}}
|
HOST: {get_param: CloudName{{network.name}}}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
@ -807,31 +806,22 @@ resources:
|
|||||||
for_each:
|
for_each:
|
||||||
hostname: {get_param: DeploymentServerBlacklist}
|
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:
|
|
||||||
type: OS::Heat::Value
|
|
||||||
properties:
|
|
||||||
type: json
|
|
||||||
value:
|
|
||||||
entries:
|
|
||||||
- - {get_param: UndercloudHostsEntries}
|
|
||||||
- - if:
|
|
||||||
- add_vips_to_etc_hosts
|
|
||||||
- {get_attr: [VipHosts, value, entries]}
|
|
||||||
- []
|
|
||||||
{%- for role in roles %}
|
|
||||||
- {get_attr: [{{role.name}}, hosts_entry, entries]}
|
|
||||||
{%- endfor %}
|
|
||||||
- - {get_param: ExtraHostFileEntries}
|
|
||||||
|
|
||||||
HostsEntryValue:
|
HostsEntryValue:
|
||||||
type: OS::Heat::Value
|
type: OS::Heat::Value
|
||||||
properties:
|
properties:
|
||||||
|
type: comma_delimited_list
|
||||||
value:
|
value:
|
||||||
yaql:
|
list_concat_unique:
|
||||||
expression: coalesce($.data, []).where($ != null).where($ != []).flatten().distinct()
|
list_concat:
|
||||||
data: {get_attr: [HostsValue, value, entries]}
|
- - {get_param: UndercloudHostsEntries}
|
||||||
|
- - if:
|
||||||
|
- add_vips_to_etc_hosts
|
||||||
|
- {get_attr: [VipHosts, value]}
|
||||||
|
- []
|
||||||
|
{%- for role in roles %}
|
||||||
|
- {get_attr: [{{role.name}}, hosts_entry]}
|
||||||
|
{%- endfor %}
|
||||||
|
- - {get_param: ExtraHostFileEntries}
|
||||||
|
|
||||||
CloudNames:
|
CloudNames:
|
||||||
type: OS::Heat::Value
|
type: OS::Heat::Value
|
||||||
@ -1147,7 +1137,7 @@ resources:
|
|||||||
VipHostsEntries:
|
VipHostsEntries:
|
||||||
if:
|
if:
|
||||||
- add_vips_to_etc_hosts
|
- add_vips_to_etc_hosts
|
||||||
- {get_attr: [VipHosts, value, entries]}
|
- {get_attr: [VipHosts, value]}
|
||||||
- []
|
- []
|
||||||
KeystoneResourcesConfigs:
|
KeystoneResourcesConfigs:
|
||||||
map_merge:
|
map_merge:
|
||||||
@ -1184,7 +1174,7 @@ outputs:
|
|||||||
value:
|
value:
|
||||||
list_concat_unique:
|
list_concat_unique:
|
||||||
- {get_attr: [HostsEntryValue, value]}
|
- {get_attr: [HostsEntryValue, value]}
|
||||||
- {get_attr: [VipHosts, value, entries]}
|
- {get_attr: [VipHosts, value]}
|
||||||
EnabledServices:
|
EnabledServices:
|
||||||
description: The services enabled on each role
|
description: The services enabled on each role
|
||||||
value:
|
value:
|
||||||
|
@ -633,33 +633,32 @@ outputs:
|
|||||||
HOSTNAME: {get_attr:[{{server_resource_name}}, name]}
|
HOSTNAME: {get_attr:[{{server_resource_name}}, name]}
|
||||||
hosts_entry:
|
hosts_entry:
|
||||||
value:
|
value:
|
||||||
entries:
|
- str_replace:
|
||||||
- str_replace:
|
template: PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
|
||||||
template: PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
|
params:
|
||||||
params:
|
PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
|
||||||
PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
|
DOMAIN: {get_param: CloudDomain}
|
||||||
DOMAIN: {get_param: CloudDomain}
|
PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
|
||||||
PRIMARYHOST: {get_attr: [{{server_resource_name}}, name]}
|
|
||||||
{%- for network in networks %}
|
{%- for network in networks %}
|
||||||
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
|
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
|
||||||
- str_replace:
|
- str_replace:
|
||||||
template: {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
|
template: {{network.name}}IP {{network.name}}HOST.DOMAIN {{network.name}}HOST
|
||||||
params:
|
params:
|
||||||
DOMAIN: {get_param: CloudDomain}
|
DOMAIN: {get_param: CloudDomain}
|
||||||
{%- for network in networks %}
|
{%- for network in networks %}
|
||||||
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
|
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
|
||||||
{{network.name}}IP: {get_attr: [{{network.name}}Port, ip_address]}
|
{{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}}HOST: {get_attr: [NetHostMap, value, {{network.name_lower|default(network.name.lower())}}, short]}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
- str_replace:
|
- str_replace:
|
||||||
template: CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
|
template: CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
|
||||||
params:
|
params:
|
||||||
DOMAIN: {get_param: CloudDomain}
|
DOMAIN: {get_param: CloudDomain}
|
||||||
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
|
CTLPLANEIP: {get_attr: [{{server_resource_name}}, networks, ctlplane, 0]}
|
||||||
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
|
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
|
||||||
nova_server_resource:
|
nova_server_resource:
|
||||||
description: Heat resource handle for {{role.name}} server
|
description: Heat resource handle for {{role.name}} server
|
||||||
value:
|
value:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user