From a77d045663d01aaeaf1f49d2ada2a342ad6289c3 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Wed, 26 Sep 2018 16:34:33 +0100 Subject: [PATCH] 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 --- network/ports/net_ip_list_map.j2.yaml | 23 +++++++++++++++++++ overcloud.j2.yaml | 12 ++++++---- puppet/all-nodes-config.j2.yaml | 4 +++- puppet/services/database/redis-base.yaml | 2 +- ..._bootstrap_nodeid_ip-d97ec1da4f73599c.yaml | 7 ++++++ 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/remove_bootstrap_nodeid_ip-d97ec1da4f73599c.yaml diff --git a/network/ports/net_ip_list_map.j2.yaml b/network/ports/net_ip_list_map.j2.yaml index d4b1b4f2c8..5efb129bb4 100644 --- a/network/ports/net_ip_list_map.j2.yaml +++ b/network/ports/net_ip_list_map.j2.yaml @@ -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]} diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml index 5aa135feef..6270e03ab6 100644 --- a/overcloud.j2.yaml +++ b/overcloud.j2.yaml @@ -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]} diff --git a/puppet/all-nodes-config.j2.yaml b/puppet/all-nodes-config.j2.yaml index adb4e78fd4..601ff1f2cd 100644 --- a/puppet/all-nodes-config.j2.yaml +++ b/puppet/all-nodes-config.j2.yaml @@ -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: diff --git a/puppet/services/database/redis-base.yaml b/puppet/services/database/redis-base.yaml index ffc1c0ad82..442aba4ca7 100644 --- a/puppet/services/database/redis-base.yaml +++ b/puppet/services/database/redis-base.yaml @@ -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: diff --git a/releasenotes/notes/remove_bootstrap_nodeid_ip-d97ec1da4f73599c.yaml b/releasenotes/notes/remove_bootstrap_nodeid_ip-d97ec1da4f73599c.yaml new file mode 100644 index 0000000000..fc9b22e6b5 --- /dev/null +++ b/releasenotes/notes/remove_bootstrap_nodeid_ip-d97ec1da4f73599c.yaml @@ -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.