From: Steven Hardy Date: Sun, 28 Aug 2016 12:47:56 +0000 (+0100) Subject: Create NetIpListMap for all roles X-Git-Tag: opnfv-6.0.0~1656 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=71b21675954a1c82924646c8034425eb53092daf;p=apex-tripleo-heat-templates.git Create NetIpListMap for all roles This allows us to create $service_node_ips and $service_node_names hiera entries for services not deployed on the Controller role. Co-Authored-By: Thomas Herve Change-Id: I688618dda05ff908293c32b9d8518697d57e9eb0 Partially-Implements: blueprint custom-roles --- diff --git a/network/ports/net_ip_list_map.yaml b/network/ports/net_ip_list_map.yaml index 430158ac..07e2de4c 100644 --- a/network/ports/net_ip_list_map.yaml +++ b/network/ports/net_ip_list_map.yaml @@ -78,9 +78,15 @@ outputs: description: > Map of enabled services to a list of hostnames where they're running value: - map_merge: - repeat: - template: - SERVICE_node_names: {get_param: ServiceHostnameList} - for_each: - SERVICE: {get_param: EnabledServices} + 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_node_names: {get_param: ServiceHostnameList} + for_each: + SERVICE: {get_param: EnabledServices} diff --git a/overcloud.yaml b/overcloud.yaml index d286e7dd..6b62fd07 100644 --- a/overcloud.yaml +++ b/overcloud.yaml @@ -1,4 +1,4 @@ -heat_template_version: 2016-04-08 +heat_template_version: 2016-10-14 description: > Deploy an OpenStack environment, consisting of several node types (roles), @@ -598,6 +598,62 @@ resources: ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]} ServiceHostnameList: {get_attr: [Controller, hostname]} + ComputeIpListMap: + type: OS::TripleO::Network::Ports::NetIpListMap + properties: + ControlPlaneIpList: {get_attr: [Compute, ip_address]} + ExternalIpList: {get_attr: [Compute, external_ip_address]} + InternalApiIpList: {get_attr: [Compute, internal_api_ip_address]} + StorageIpList: {get_attr: [Compute, storage_ip_address]} + StorageMgmtIpList: {get_attr: [Compute, storage_mgmt_ip_address]} + TenantIpList: {get_attr: [Compute, tenant_ip_address]} + ManagementIpList: {get_attr: [Compute, management_ip_address]} + EnabledServices: {get_attr: [ComputeServiceChain, role_data, service_names]} + ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]} + ServiceHostnameList: {get_attr: [Compute, hostname]} + + BlockStorageIpListMap: + type: OS::TripleO::Network::Ports::NetIpListMap + properties: + ControlPlaneIpList: {get_attr: [BlockStorage, ip_address]} + ExternalIpList: {get_attr: [BlockStorage, external_ip_address]} + InternalApiIpList: {get_attr: [BlockStorage, internal_api_ip_address]} + StorageIpList: {get_attr: [BlockStorage, storage_ip_address]} + StorageMgmtIpList: {get_attr: [BlockStorage, storage_mgmt_ip_address]} + TenantIpList: {get_attr: [BlockStorage, tenant_ip_address]} + ManagementIpList: {get_attr: [BlockStorage, management_ip_address]} + EnabledServices: {get_attr: [BlockStorageServiceChain, role_data, service_names]} + ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]} + ServiceHostnameList: {get_attr: [BlockStorage, hostname]} + + ObjectStorageIpListMap: + type: OS::TripleO::Network::Ports::NetIpListMap + properties: + ControlPlaneIpList: {get_attr: [ObjectStorage, ip_address]} + ExternalIpList: {get_attr: [ObjectStorage, external_ip_address]} + InternalApiIpList: {get_attr: [ObjectStorage, internal_api_ip_address]} + StorageIpList: {get_attr: [ObjectStorage, storage_ip_address]} + StorageMgmtIpList: {get_attr: [ObjectStorage, storage_mgmt_ip_address]} + TenantIpList: {get_attr: [ObjectStorage, tenant_ip_address]} + ManagementIpList: {get_attr: [ObjectStorage, management_ip_address]} + EnabledServices: {get_attr: [ObjectStorageServiceChain, role_data, service_names]} + ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]} + ServiceHostnameList: {get_attr: [ObjectStorage, hostname]} + + CephStorageIpListMap: + type: OS::TripleO::Network::Ports::NetIpListMap + properties: + ControlPlaneIpList: {get_attr: [CephStorage, ip_address]} + ExternalIpList: {get_attr: [CephStorage, external_ip_address]} + InternalApiIpList: {get_attr: [CephStorage, internal_api_ip_address]} + StorageIpList: {get_attr: [CephStorage, storage_ip_address]} + StorageMgmtIpList: {get_attr: [CephStorage, storage_mgmt_ip_address]} + TenantIpList: {get_attr: [CephStorage, tenant_ip_address]} + ManagementIpList: {get_attr: [CephStorage, management_ip_address]} + EnabledServices: {get_attr: [CephStorageServiceChain, role_data, service_names]} + ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]} + ServiceHostnameList: {get_attr: [CephStorage, hostname]} + allNodesConfig: type: OS::TripleO::AllNodes::SoftwareConfig properties: @@ -627,8 +683,30 @@ resources: - {get_attr: [CephStorageServiceChain, role_data, service_names]} controller_ips: {get_attr: [Controller, ip_address]} controller_names: {get_attr: [Controller, hostname]} - service_ips: {get_attr: [ControllerIpListMap, service_ips]} - service_node_names: {get_attr: [ControllerIpListMap, service_hostnames]} + service_ips: + # Note (shardy) this somewhat complex yaql may be replaced + # with a map_deep_merge function in ocata. It merges the + # list of maps, but appends to colliding lists when a service + # is deployed on more than one role + yaql: + expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1], [$[0], $[1].flatten()])) + data: + l: + - {get_attr: [ControllerIpListMap, service_ips]} + - {get_attr: [ComputeIpListMap, service_ips]} + - {get_attr: [BlockStorageIpListMap, service_ips]} + - {get_attr: [ObjectStorageIpListMap, service_ips]} + - {get_attr: [CephStorageIpListMap, service_ips]} + service_node_names: + yaql: + expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1], [$[0], $[1].flatten()])) + data: + l: + - {get_attr: [ControllerIpListMap, service_hostnames]} + - {get_attr: [ComputeIpListMap, service_hostnames]} + - {get_attr: [BlockStorageIpListMap, service_hostnames]} + - {get_attr: [ObjectStorageIpListMap, service_hostnames]} + - {get_attr: [CephStorageIpListMap, service_hostnames]} # FIXME(shardy): These require further work to move into service_ips memcache_node_ips: {get_attr: [ControllerIpListMap, net_ip_map, {get_attr: [ServiceNetMap, service_net_map, MemcachedNetwork]}]} keystone_public_api_node_ips: {get_attr: [ControllerIpListMap, net_ip_map, {get_attr: [ServiceNetMap, service_net_map, KeystonePublicApiNetwork]}]}