tripleo-heat-templates/network/service_net_map.j2.yaml

93 lines
3.3 KiB
YAML

heat_template_version: wallaby
description: >
Mapping of service_name_network -> network name
parameters:
ServiceNetMap:
description: Mapping of service_name -> network name. Typically set
via parameter_defaults in the resource registry. Use
parameter_merge_strategies to merge it with the defaults.
Note that the key in this map must match the service_name
in the service template, e.g if the service_name is heat_api
the key must be either heat_api_network, or optionally
HeatApiNetwork (which will be internally converted to
transform captalization to underscores).
type: json
ControlPlaneSubnet:
description: The name of the undercloud Neutron control plane subnet
default: ctlplane-subnet
type: string
VipSubnetMap:
description: Map of (network_name or service_name) -> subnet_name that
defines which subnet to host the VIP. Use
parameter_merge_strategies to merge it with the defaults.
type: json
# We define mappings to work around names that break when doing the
# CamelCase to snake_case conversion to align with service_names
ServiceNetMapDeprecatedMapping:
default:
RabbitMqNetwork: RabbitmqNetwork
CephPublicNetwork: CephMonNetwork
SwiftMgmtNetwork: SwiftStorageNetwork
description: Mapping older deprecated service names, intended for
internal use only, this will be removed in future.
type: json
{%- for network in networks if network.enabled|default(true) %}
{{network.name}}NetName:
default: {{network.name_lower}}
description: The name of the {{network.name_lower}} network.
type: string
{%- endfor %}
parameter_groups:
- label: deprecated
description: Do not use deprecated params, they will be removed.
parameters:
- ServiceNetMapDeprecatedMapping
resources:
ServiceNetMapValue:
type: OS::Heat::Value
properties:
type: json
value:
map_merge:
- map_replace:
- {get_param: ServiceNetMap}
- values:
{%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}NetName}
{%- endfor %}
keys: {get_param: ServiceNetMapDeprecatedMapping}
# (mschuppert) this is to keep NovaVncProxyNetwork and NovaLibvirtNetwork
# in sync to not break VNC console
- NovaVncProxyNetwork: { get_param: [ServiceNetMap, NovaLibvirtNetwork] }
outputs:
service_net_map:
value: {get_attr: [ServiceNetMapValue, value]}
service_net_map_lower:
value:
# This does a conversion from CamelCase to snake_case,
# e.g HeatApiNetwork becomes heat_api_network so it
# matches the service names.
yaql:
expression: dict($.data.map.items().select([ regex(`([a-z0-9])([A-Z])`).replace($[0], '\\1_\\2').toLower(), $[1]]))
data:
map: {get_attr: [ServiceNetMapValue, value]}
vip_subnet_map:
value:
# (hjensas): We need to map_replace the ctlplane-subnet to support
# legacy parameter ControlPlaneSubnet.
map_replace:
- {get_param: VipSubnetMap}
- values:
ctlplane-subnet: {get_param: ControlPlaneSubnet}