c24e1071ff1b380b3b63915ea5476e9c85b817e7
[apex-tripleo-heat-templates.git] / docker / services / haproxy.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized HAproxy service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerHAProxyImage:
12     description: image
13     default: 'centos-binary-haproxy:latest'
14     type: string
15   DockerHAProxyConfigImage:
16     description: The container image to use for the haproxy config_volume
17     default: 'centos-binary-haproxy:latest'
18     type: string
19   ServiceNetMap:
20     default: {}
21     description: Mapping of service_name -> network name. Typically set
22                  via parameter_defaults in the resource registry.  This
23                  mapping overrides those in ServiceNetMapDefaults.
24     type: json
25   DefaultPasswords:
26     default: {}
27     type: json
28   EndpointMap:
29     default: {}
30     description: Mapping of service endpoint -> protocol. Typically set
31                  via parameter_defaults in the resource registry.
32     type: json
33   HAProxyStatsPassword:
34     description: Password for HAProxy stats endpoint
35     hidden: true
36     type: string
37   HAProxyStatsUser:
38     description: User for HAProxy stats endpoint
39     default: admin
40     type: string
41   HAProxySyslogAddress:
42     default: /dev/log
43     description: Syslog address where HAproxy will send its log
44     type: string
45   DeployedSSLCertificatePath:
46     default: '/etc/pki/tls/private/overcloud_endpoint.pem'
47     description: >
48         The filepath of the certificate as it will be stored in the controller.
49     type: string
50   RedisPassword:
51     description: The password for Redis
52     type: string
53     hidden: true
54   MonitoringSubscriptionHaproxy:
55     default: 'overcloud-haproxy'
56     type: string
57   RoleName:
58     default: ''
59     description: Role name on which the service is applied
60     type: string
61   RoleParameters:
62     default: {}
63     description: Parameters specific to the role
64     type: json
65
66 resources:
67
68   ContainersCommon:
69     type: ./containers-common.yaml
70
71   HAProxyBase:
72     type: ../../puppet/services/haproxy.yaml
73     properties:
74       EndpointMap: {get_param: EndpointMap}
75       ServiceNetMap: {get_param: ServiceNetMap}
76       DefaultPasswords: {get_param: DefaultPasswords}
77       RoleName: {get_param: RoleName}
78       RoleParameters: {get_param: RoleParameters}
79
80 outputs:
81   role_data:
82     description: Role data for the HAproxy role.
83     value:
84       service_name: {get_attr: [HAProxyBase, role_data, service_name]}
85       config_settings:
86         map_merge:
87           - get_attr: [HAProxyBase, role_data, config_settings]
88           - tripleo::haproxy::haproxy_daemon: false
89       step_config: &step_config
90         get_attr: [HAProxyBase, role_data, step_config]
91       service_config_settings: {get_attr: [HAProxyBase, role_data, service_config_settings]}
92       # BEGIN DOCKER SETTINGS
93       puppet_config:
94         config_volume: haproxy
95         puppet_tags: haproxy_config
96         step_config: *step_config
97         config_image:
98           list_join:
99             - '/'
100             - [ {get_param: DockerNamespace}, {get_param: DockerHAProxyConfigImage} ]
101         volumes: &deployed_cert_mount
102           - list_join:
103             - ':'
104             - - {get_param: DeployedSSLCertificatePath}
105               - {get_param: DeployedSSLCertificatePath}
106               - 'ro'
107       kolla_config:
108         /var/lib/kolla/config_files/haproxy.json:
109           command: haproxy -f /etc/haproxy/haproxy.cfg
110           config_files:
111             - source: "/var/lib/kolla/config_files/src/*"
112               dest: "/"
113               merge: true
114               preserve_properties: true
115       docker_config:
116         step_1:
117           haproxy:
118             image:
119               list_join:
120                 - '/'
121                 - [ {get_param: DockerNamespace}, {get_param: DockerHAProxyImage} ]
122             net: host
123             privileged: false
124             restart: always
125             volumes:
126               list_concat:
127                 - {get_attr: [ContainersCommon, volumes]}
128                 - *deployed_cert_mount
129                 -
130                   - /var/lib/kolla/config_files/haproxy.json:/var/lib/kolla/config_files/config.json:ro
131                   - /var/lib/config-data/puppet-generated/haproxy/:/var/lib/kolla/config_files/src:ro
132             environment:
133               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
134       metadata_settings:
135         get_attr: [HAProxyBase, role_data, metadata_settings]