X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=network%2Fports%2Fnet_ip_list_map.yaml;h=5782bbe9b627415529424cc0f57f70e7bfb6d9e6;hb=51a43d81acd17d36bff47b01c353f580fc2ffc03;hp=07e2de4c7cc99e98ee3ea0c78a549b1831132683;hpb=5124693c0e2ce39ac5cadb79f42c7dd36d7041f8;p=apex-tripleo-heat-templates.git diff --git a/network/ports/net_ip_list_map.yaml b/network/ports/net_ip_list_map.yaml index 07e2de4c..5782bbe9 100644 --- a/network/ports/net_ip_list_map.yaml +++ b/network/ports/net_ip_list_map.yaml @@ -1,4 +1,4 @@ -heat_template_version: 2016-10-14 +heat_template_version: ocata parameters: ControlPlaneIpList: @@ -31,6 +31,32 @@ parameters: ServiceHostnameList: default: [] type: comma_delimited_list + NetworkHostnameMap: + default: [] + type: json + +resources: + # This adds the extra "services" on for keystone + # so that keystone_admin_api_network and + # keystone_public_api_network point to the correct + # network on the nodes running the "keystone" service + EnabledServicesValue: + type: OS::Heat::Value + properties: + type: comma_delimited_list + value: + yaql: + expression: let(root => $) -> $.data.extra_services.items().where($[0] in $root.data.enabled_services).select($[1]).flatten() + $root.data.enabled_services + data: + enabled_services: {get_param: EnabledServices} + extra_services: + # If anything other than keystone needs this + # then we should add an extra_networks interface + # to the service templates role_data but for + # now we hard-code the keystone special case + keystone: + - keystone_admin_api + - keystone_public_api outputs: net_ip_map: @@ -64,7 +90,7 @@ outputs: template: SERVICE_node_ips: SERVICE_network for_each: - SERVICE: {get_param: EnabledServices} + SERVICE: {get_attr: [EnabledServicesValue, value]} - values: {get_param: ServiceNetMap} - values: ctlplane: {get_param: ControlPlaneIpList} @@ -77,6 +103,45 @@ outputs: service_hostnames: description: > Map of enabled services to a list of hostnames where they're running + value: + map_replace: + - 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 $[1].endsWith("_network"))) + data: + map: + map_replace: + - map_merge: + repeat: + template: + SERVICE_node_names: SERVICE_network + for_each: + SERVICE: {get_attr: [EnabledServicesValue, value]} + - values: {get_param: ServiceNetMap} + - values: {get_param: NetworkHostnameMap} + short_service_hostnames: + description: > + Map of enabled services to a list of hostnames where they're running regardless of the network + value: + yaql: + # If ServiceHostnameList is empty the role is deployed with zero nodes + # therefore we don't want to add any *_node_names to the map + expression: dict($.data.map.items().where(len($[1]) > 0)) + data: + map: + map_merge: + repeat: + template: + SERVICE_short_node_names: {get_param: ServiceHostnameList} + for_each: + SERVICE: {get_attr: [EnabledServicesValue, value]} + short_service_bootstrap_hostnames: + description: > + Map of enabled services to a list of hostnames where they're running regardless of the network + Used for bootstrap purposes value: yaql: # If ServiceHostnameList is empty the role is deployed with zero nodes @@ -87,6 +152,6 @@ outputs: map_merge: repeat: template: - SERVICE_node_names: {get_param: ServiceHostnameList} + SERVICE_short_bootstrap_node_name: {get_param: ServiceHostnameList} for_each: - SERVICE: {get_param: EnabledServices} + SERVICE: {get_attr: [EnabledServicesValue, value]}