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