aboutsummaryrefslogtreecommitdiffstats
path: root/puppet/vip-config.yaml
blob: 010a941ea56ecfa25259708b5da175407bc2d4ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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}