Move VIP-related data to AllNodesConfig

This makes it easier to access the VIP data for other node types and
de-ties this from the controller role.

Change-Id: I71125576ec93889fed134b92fb59f7e7dc9920c4
This commit is contained in:
Juan Antonio Osorio Robles 2016-09-05 11:56:57 +03:00
parent b8f154be31
commit ddfbf35374
5 changed files with 54 additions and 105 deletions

View File

@ -57,7 +57,6 @@ resource_registry:
# TripleO overcloud networks
OS::TripleO::Network: network/networks.yaml
OS::TripleO::VipConfig: puppet/vip-config.yaml
OS::TripleO::Network::External: OS::Heat::None
OS::TripleO::Network::InternalApi: OS::Heat::None

View File

@ -711,6 +711,8 @@ resources:
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]}]}
keystone_admin_api_node_ips: {get_attr: [ControllerIpListMap, net_ip_map, {get_attr: [ServiceNetMap, service_net_map, KeystoneAdminApiNetwork]}]}
NetVipMap: {get_attr: [VipMap, net_ip_map]}
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]}
DeployIdentifier: {get_param: DeployIdentifier}
UpdateIdentifier: {get_param: UpdateIdentifier}
@ -806,36 +808,6 @@ resources:
StorageMgmtIpUri: {get_attr: [StorageMgmtVirtualIP, ip_address_uri]}
# No tenant or management VIP required
VipConfig:
type: OS::TripleO::VipConfig
properties:
NetIpMap: {get_attr: [VipMap, net_ip_map]}
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]}
EnabledServices:
list_join:
- ','
- {get_attr: [ControllerServiceChain, role_data, service_names]}
- {get_attr: [ComputeServiceChain, role_data, service_names]}
- {get_attr: [BlockStorageServiceChain, role_data, service_names]}
- {get_attr: [ObjectStorageServiceChain, role_data, service_names]}
- {get_attr: [CephStorageServiceChain, role_data, service_names]}
VipDeployment:
type: OS::Heat::StructuredDeployments
properties:
name: VipDeployment
config: {get_resource: VipConfig}
servers: {get_attr: [Controller, attributes, nova_server_resource]}
input_values:
keystone_admin_api_vip: {get_attr: [VipMap, net_ip_map, {get_attr: [ServiceNetMap, service_net_map, KeystoneAdminApiNetwork]}]}
keystone_public_api_vip: {get_attr: [VipMap, net_ip_map, {get_attr: [ServiceNetMap, service_net_map, KeystonePublicApiNetwork]}]}
# direct configuration of Virtual IPs for each network
control_virtual_ip: {get_attr: [VipMap, net_ip_map, ctlplane]}
public_virtual_ip: {get_attr: [VipMap, net_ip_map, external]}
internal_api_virtual_ip: {get_attr: [VipMap, net_ip_map, internal_api]}
storage_virtual_ip: {get_attr: [VipMap, net_ip_map, storage]}
storage_mgmt_virtual_ip: {get_attr: [VipMap, net_ip_map, storage_mgmt]}
ControllerSwiftDeployment:
type: OS::Heat::StructuredDeployments
properties:

View File

@ -22,6 +22,10 @@ parameters:
type: comma_delimited_list
keystone_admin_api_node_ips:
type: comma_delimited_list
NetVipMap:
type: json
ServiceNetMap:
type: json
DeployIdentifier:
type: string
description: >
@ -111,6 +115,53 @@ resources:
deploy_identifier: {get_param: DeployIdentifier}
update_identifier: {get_param: UpdateIdentifier}
stack_action: {get_param: StackAction}
vip_data:
mapped_data:
map_merge:
# Dynamically generate per-service VIP data based on enabled_services
# This works as follows (outer->inner functions)
# yaql - filters services where no mapping exists in ServiceNetMap
# map_replace: substitute e.g internal_api with the IP from NetVipMap
# map_replace: substitute e.g heat_api_network with network name from ServiceNetMap
# map_merge/repeat: generate a per-service mapping
- 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(isString($[1]) and not $[1].endsWith("_network")))
data:
map:
map_replace:
- map_replace:
- map_merge:
repeat:
template:
SERVICE_vip: SERVICE_network
for_each:
SERVICE:
str_split: [',', {get_param: enabled_services}]
- values: {get_param: ServiceNetMap}
- values: {get_param: NetVipMap}
- keystone_admin_api_vip:
get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_admin_api_network]}]
keystone_public_api_vip:
get_param: [NetVipMap, {get_param: [ServiceNetMap, keystone_public_api_network]}]
public_virtual_ip: {get_param: [NetVipMap, external]}
controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
internal_api_virtual_ip: {get_param: [NetVipMap, internal_api]}
storage_virtual_ip: {get_param: [NetVipMap, storage]}
storage_mgmt_virtual_ip: {get_param: [NetVipMap, storage_mgmt]}
# public_virtual_ip and controller_virtual_ip are needed in
# both HAproxy & keepalived.
tripleo::haproxy::public_virtual_ip: {get_param: [NetVipMap, external]}
tripleo::haproxy::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
tripleo::keepalived::public_virtual_ip: {get_param: [NetVipMap, external]}
tripleo::keepalived::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
tripleo::keepalived::internal_api_virtual_ip: {get_param: [NetVipMap, internal_api]}
tripleo::keepalived::storage_virtual_ip: {get_param: [NetVipMap, storage]}
tripleo::keepalived::storage_mgmt_virtual_ip: {get_param: [NetVipMap, storage_mgmt]}
tripleo::redis_notification::haproxy_monitor_ip: {get_param: [NetVipMap, ctlplane]}
outputs:
config_id:

View File

@ -320,7 +320,7 @@ resources:
- swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
- bootstrap_node # provided by BootstrapNodeConfig
- all_nodes # provided by allNodesConfig
- vip_data # provided by vip-config
- vip_data # provided by allNodesConfig
- '"%{::osfamily}"'
- cinder_dellsc_data # Optionally provided by ControllerExtraConfigPre
- cinder_netapp_data # Optionally provided by ControllerExtraConfigPre

View File

@ -1,73 +0,0 @@
heat_template_version: 2016-10-14
description: >
Configure hieradata for service -> virtual IP mappings.
parameters:
NetIpMap:
type: json
# FIXME(shardy) this can be comma_delimited_list when
# https://bugs.launchpad.net/heat/+bug/1617019 is fixed
EnabledServices:
type: string
ServiceNetMap:
type: json
resources:
VipConfigImpl:
type: OS::Heat::StructuredConfig
properties:
group: os-apply-config
config:
hiera:
datafiles:
vip_data:
mapped_data:
map_merge:
# Dynamically generate per-service VIP data based on EnabledServices
# This works as follows (outer->inner functions)
# yaql - filters services where no mapping exists in ServiceNetMap
# map_replace: substitute e.g internal_api with the IP from NetIpMap
# map_replace: substitute e.g heat_api_network with network name from ServiceNetMap
# map_merge/repeat: generate a per-service mapping
- 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(isString($[1]) and not $[1].endsWith("_network")))
data:
map:
map_replace:
- map_replace:
- map_merge:
repeat:
template:
SERVICE_vip: SERVICE_network
for_each:
SERVICE:
str_split: [',', {get_param: EnabledServices}]
- values: {get_param: ServiceNetMap}
- values: {get_param: NetIpMap}
- keystone_admin_api_vip: {get_input: keystone_admin_api_vip}
keystone_public_api_vip: {get_input: keystone_public_api_vip}
public_virtual_ip: {get_input: public_virtual_ip}
controller_virtual_ip: {get_input: control_virtual_ip}
internal_api_virtual_ip: {get_input: internal_api_virtual_ip}
storage_virtual_ip: {get_input: storage_virtual_ip}
storage_mgmt_virtual_ip: {get_input: storage_mgmt_virtual_ip}
# public_virtual_ip and controller_virtual_ip are needed in
# both HAproxy & keepalived.
tripleo::haproxy::public_virtual_ip: {get_input: public_virtual_ip}
tripleo::haproxy::controller_virtual_ip: {get_input: control_virtual_ip}
tripleo::keepalived::public_virtual_ip: {get_input: public_virtual_ip}
tripleo::keepalived::controller_virtual_ip: {get_input: control_virtual_ip}
tripleo::keepalived::internal_api_virtual_ip: {get_input: internal_api_virtual_ip}
tripleo::keepalived::storage_virtual_ip: {get_input: storage_virtual_ip}
tripleo::keepalived::storage_mgmt_virtual_ip: {get_input: storage_mgmt_virtual_ip}
tripleo::redis_notification::haproxy_monitor_ip: {get_input: control_virtual_ip}
outputs:
OS::stack_id:
description: The VipConfigImpl resource.
value: {get_resource: VipConfigImpl}