Merge "Add docker templates for octavia services"
[apex-tripleo-heat-templates.git] / network / ports / net_ip_list_map.yaml
1 heat_template_version: pike
2
3 parameters:
4   ControlPlaneIpList:
5     default: []
6     type: comma_delimited_list
7   ExternalIpList:
8     default: []
9     type: comma_delimited_list
10   InternalApiIpList:
11     default: []
12     type: comma_delimited_list
13   StorageIpList:
14     default: []
15     type: comma_delimited_list
16   StorageMgmtIpList:
17     default: []
18     type: comma_delimited_list
19   TenantIpList:
20     default: []
21     type: comma_delimited_list
22   ManagementIpList:
23     default: []
24     type: comma_delimited_list
25   EnabledServices:
26     default: []
27     type: comma_delimited_list
28   ServiceNetMap:
29     default: {}
30     type: json
31   ServiceHostnameList:
32     default: []
33     type: comma_delimited_list
34   NetworkHostnameMap:
35     default: []
36     type: json
37
38   InternalApiNetName:
39     default: internal_api
40     description: The name of the internal API network.
41     type: string
42   ExternalNetName:
43     default: external
44     description: The name of the external network.
45     type: string
46   ManagementNetName:
47     default: management
48     description: The name of the management network.
49     type: string
50   StorageNetName:
51     default: storage
52     description: The name of the storage network.
53     type: string
54   StorageMgmtNetName:
55     default: storage_mgmt
56     description: The name of the Storage management network.
57     type: string
58   TenantNetName:
59     default: tenant
60     description: The name of the tenant network.
61     type: string
62
63
64 resources:
65    # This adds the extra "services" on for keystone
66    # so that keystone_admin_api_network and
67    # keystone_public_api_network point to the correct
68    # network on the nodes running the "keystone" service
69   EnabledServicesValue:
70     type: OS::Heat::Value
71     properties:
72       type: comma_delimited_list
73       value:
74         yaql:
75           expression: let(root => $) -> $.data.extra_services.items().where($[0] in $root.data.enabled_services).select($[1]).flatten() + $root.data.enabled_services
76           data:
77             enabled_services: {get_param: EnabledServices}
78             extra_services:
79               # If anything other than keystone needs this
80               # then we should add an extra_networks interface
81               # to the service templates role_data but for
82               # now we hard-code the keystone special case
83               keystone:
84                 - keystone_admin_api
85                 - keystone_public_api
86
87   NetIpMapValue:
88     type: OS::Heat::Value
89     properties:
90       type: json
91       value:
92         map_replace:
93           - ctlplane: {get_param: ControlPlaneIpList}
94             external: {get_param: ExternalIpList}
95             internal_api: {get_param: InternalApiIpList}
96             storage: {get_param: StorageIpList}
97             storage_mgmt: {get_param: StorageMgmtIpList}
98             tenant: {get_param: TenantIpList}
99             management: {get_param: ManagementIpList}
100           - keys:
101               external: {get_param: ExternalNetName}
102               internal_api: {get_param: InternalApiNetName}
103               storage: {get_param: StorageNetName}
104               storage_mgmt: {get_param: StorageMgmtNetName}
105               tenant: {get_param: TenantNetName}
106               management: {get_param: ManagementNetName}
107
108 outputs:
109   net_ip_map:
110     description: >
111       A Hash containing a mapping of network names to assigned lists
112       of IP addresses.
113     value: {get_attr: [NetIpMapValue, value]}
114   service_ips:
115     description: >
116       Map of enabled services to a list of their IP addresses
117     value:
118       yaql:
119         # This filters any entries where the value hasn't been substituted for
120         # a list, e.g it's still $service_network.  This happens when there is
121         # no network defined for the service in the ServiceNetMap, which is OK
122         # as not all services have to be bound to a network, so we filter them
123         expression: dict($.data.map.items().where(not isString($[1])))
124         data:
125           map:
126             map_replace:
127               - map_replace:
128                   - map_merge:
129                       repeat:
130                         template:
131                           SERVICE_node_ips: SERVICE_network
132                         for_each:
133                           SERVICE: {get_attr: [EnabledServicesValue, value]}
134                   - values: {get_param: ServiceNetMap}
135               - values: {get_attr: [NetIpMapValue, value]}
136   ctlplane_service_ips:
137     description: >
138       Map of enabled services to a list of their ctlplane IP addresses
139     value:
140       yaql:
141         expression: dict($.data.map.items().where(len($[1]) > 0))
142         data:
143           map:
144             map_merge:
145               repeat:
146                 template:
147                   SERVICE_ctlplane_node_ips: {get_param: ControlPlaneIpList}
148                 for_each:
149                   SERVICE: {get_attr: [EnabledServicesValue, value]}
150   service_hostnames:
151     description: >
152       Map of enabled services to a list of hostnames where they're running
153     value:
154       map_replace:
155         - yaql:
156             # This filters any entries where the value hasn't been substituted for
157             # a list, e.g it's still $service_network.  This happens when there is
158             # no network defined for the service in the ServiceNetMap, which is OK
159             # as not all services have to be bound to a network, so we filter them
160             expression: dict($.data.map.items().where(not $[1].endsWith("_network")))
161             data:
162               map:
163                 map_replace:
164                   - map_merge:
165                       repeat:
166                         template:
167                           SERVICE_node_names: SERVICE_network
168                         for_each:
169                           SERVICE: {get_attr: [EnabledServicesValue, value]}
170                   - values: {get_param: ServiceNetMap}
171         - values: {get_param: NetworkHostnameMap}
172   short_service_hostnames:
173     description: >
174       Map of enabled services to a list of hostnames where they're running regardless of the network
175     value:
176       yaql:
177         # If ServiceHostnameList is empty the role is deployed with zero nodes
178         # therefore we don't want to add any *_node_names to the map
179         expression: dict($.data.map.items().where(len($[1]) > 0))
180         data:
181           map:
182             map_merge:
183               repeat:
184                 template:
185                   SERVICE_short_node_names: {get_param: ServiceHostnameList}
186                 for_each:
187                     SERVICE: {get_attr: [EnabledServicesValue, value]}
188   short_service_bootstrap_hostnames:
189     description: >
190       Map of enabled services to a list of hostnames where they're running regardless of the network
191       Used for bootstrap purposes
192     value:
193       yaql:
194         # If ServiceHostnameList is empty the role is deployed with zero nodes
195         # therefore we don't want to add any *_node_names to the map
196         expression: dict($.data.map.items().where(len($[1]) > 0))
197         data:
198           map:
199             map_merge:
200               repeat:
201                 template:
202                   SERVICE_short_bootstrap_node_name: {get_param: ServiceHostnameList}
203                 for_each:
204                     SERVICE: {get_attr: [EnabledServicesValue, value]}