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