Add SERVICE_bootstrap_node_ip values to allNodesConfig

This can be used to replace the per-role bootstrap_nodeid_ip,
and the redis-base template is updated to use the new hiera
key.

The old bootstrap_nodeid_ip appears to only be used for redis,
so the old key is removed, with an upgrade release note added
should any out-of-tree services reference this value.

Partial-Bug: #1792613
Change-Id: I830d5b9bae3e9d65c2c393e3dcdf70bffdb1ac7b
This commit is contained in:
Steven Hardy 2018-09-26 16:34:33 +01:00
parent b8206cc0f5
commit a77d045663
5 changed files with 42 additions and 6 deletions

View File

@ -164,3 +164,26 @@ outputs:
SERVICE_short_bootstrap_node_name: {get_param: ServiceHostnameList}
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
service_bootstrap_ips:
description: >
Map of enabled services to a list of their IP addresses
Used for bootstrap purposes
value:
yaql:
# This filters any entries where the value hasn't been substituted for
# a list, e.g it's still $service_network. This happens when there is
# no network defined for the service in the ServiceNetMap, which is OK
# as not all services have to be bound to a network, so we filter them
expression: dict($.data.map.items().where(not isString($[1])))
data:
map:
map_replace:
- map_replace:
- map_merge:
repeat:
template:
SERVICE_bootstrap_node_ip: SERVICE_network
for_each:
SERVICE: {get_attr: [EnabledServicesValue, value]}
- values: {get_param: ServiceNetMap}
- values: {get_attr: [NetIpMapValue, value]}

View File

@ -513,10 +513,6 @@ resources:
yaql:
expression: coalesce($.data, []).first(null)
data: {get_attr: [{{role.name}}, hostname]}
bootstrap_nodeid_ip:
yaql:
expression: coalesce($.data, []).first(null)
data: {get_attr: [{{role.name}}, ip_address]}
{{role.name}}AllNodesValidationDeployment:
type: OS::Heat::StructuredDeployments
@ -735,6 +731,14 @@ resources:
l:
{% for role in roles %}
- {get_attr: [{{role.name}}IpListMap, short_service_bootstrap_hostnames]}
{% endfor %}
service_bootstrap_node_ip:
yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten().first()]))
data:
l:
{% for role in roles %}
- {get_attr: [{{role.name}}IpListMap, service_bootstrap_ips]}
{% endfor %}
NetVipMap: {get_attr: [VipMap, net_ip_map]}
RedisVirtualIP: {get_attr: [RedisVirtualIP, ip_address]}

View File

@ -20,6 +20,8 @@ parameters:
type: json
short_service_bootstrap_node:
type: json
service_bootstrap_node_ip:
type: json
controller_names:
type: comma_delimited_list
cellv2_discovery_hosts:
@ -131,6 +133,7 @@ resources:
- {get_param: service_node_names}
- {get_param: short_service_node_names}
- {get_param: short_service_bootstrap_node}
- {get_param: service_bootstrap_node_ip}
- controller_node_ips:
list_join:
- ','
@ -156,7 +159,6 @@ resources:
datafiles:
bootstrap_node:
bootstrap_nodeid: {get_input: bootstrap_nodeid}
bootstrap_nodeid_ip: {get_input: bootstrap_nodeid_ip}
all_nodes: {get_attr: [allNodesConfigValue, value]}
vip_data:
map_merge:

View File

@ -81,7 +81,7 @@ outputs:
$NETWORK: {get_param: [ServiceNetMap, RedisNetwork]}
redis::port: 6379
redis::sentinel::master_name: "%{hiera('redis_short_bootstrap_node_name')}"
redis::sentinel::redis_host: "%{hiera('bootstrap_nodeid_ip')}"
redis::sentinel::redis_host: "%{hiera('redis_bootstrap_node_ip')}"
redis::sentinel::notification_script: '/usr/local/bin/redis-notifications.sh'
redis::sentinel::sentinel_bind:
if:

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
The hiera bootstrap_nodeid_ip key has been replaced with per-service
SERVICE_bootstrap_node_ip where SERVICE is the service_name from the
composable service templates. If any out-of-tree services use this
key they will need to adjust to the new interface on upgrade.