Merge "Make archive policy configurable" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / octavia-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Octavia service configured with Puppet
5
6 parameters:
7   DockerOctaviaApiImage:
8     description: image
9     type: string
10   DockerOctaviaConfigImage:
11     description: The container image to use for the octavia config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39   EnableInternalTLS:
40     type: boolean
41     default: false
42
43 conditions:
44
45   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
46
47
48 resources:
49
50   ContainersCommon:
51     type: ./containers-common.yaml
52
53   MySQLClient:
54     type: ../../puppet/services/database/mysql-client.yaml
55
56   OctaviaApiPuppetBase:
57     type: ../../puppet/services/octavia-api.yaml
58     properties:
59       EndpointMap: {get_param: EndpointMap}
60       ServiceData: {get_param: ServiceData}
61       ServiceNetMap: {get_param: ServiceNetMap}
62       DefaultPasswords: {get_param: DefaultPasswords}
63       RoleName: {get_param: RoleName}
64       RoleParameters: {get_param: RoleParameters}
65
66 outputs:
67   role_data:
68     description: Role data for the Octavia API role.
69     value:
70       service_name: {get_attr: [OctaviaApiPuppetBase, role_data, service_name]}
71       config_settings: {get_attr: [OctaviaApiPuppetBase, role_data, config_settings]}
72       step_config: &step_config
73         list_join:
74           - "\n"
75           - - {get_attr: [OctaviaApiPuppetBase, role_data, step_config]}
76             - {get_attr: [MySQLClient, role_data, step_config]}
77       service_config_settings: {get_attr: [OctaviaApiPuppetBase, role_data, service_config_settings]}
78       # BEGIN DOCKER SETTINGS #
79       puppet_config:
80         config_volume: octavia
81         puppet_tags: octavia_config
82         step_config: *step_config
83         config_image: {get_param: DockerOctaviaConfigImage}
84       kolla_config:
85         /var/lib/kolla/config_files/octavia_api.json:
86           command: /usr/bin/octavia-api --config-file /usr/share/octavia/octavia-dist.conf --config-file /etc/octavia/octavia.conf --log-file /var/log/octavia/api.log --config-dir /etc/octavia/conf.d/common --config-dir /etc/octavia/conf.d/octavia-api
87           config_files:
88             - source: "/var/lib/kolla/config_files/src/*"
89               dest: "/"
90               merge: true
91               preserve_properties: true
92         /var/lib/kolla/config_files/octavia_api_tls_proxy.json:
93           command: /usr/sbin/httpd -DFOREGROUND
94           config_files:
95             - source: "/var/lib/kolla/config_files/src/*"
96               dest: "/"
97               merge: true
98               preserve_properties: true
99       docker_config:
100         # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
101         step_2:
102           octavia_api_init_dirs:
103             start_order: 0
104             image: &octavia_api_image {get_param: DockerOctaviaApiImage}
105             user: root
106             volumes:
107               # NOTE(mandre) we need extra dir for the service in /etc/octavia/conf.d
108               # It is normally created as part of the RPM install, but it is
109               # missing here because we use the same config_volume for all
110               # octavia services, hence the same container image to generate
111               # configuration.
112               - /var/lib/config-data/puppet-generated/octavia/etc/octavia:/etc/octavia/
113               - /var/log/containers/octavia:/var/log/octavia
114             command: ['/bin/bash', '-c', 'mkdir -p /etc/octavia/conf.d/octavia-api; chown -R octavia:octavia /etc/octavia/conf.d/octavia-api; chown -R octavia:octavia /var/log/octavia']
115         step_3:
116           octavia_db_sync:
117             start_order: 0
118             image: *octavia_api_image
119             net: host
120             privileged: false
121             detach: false
122             user: root
123             volumes:
124               list_concat:
125                 - {get_attr: [ContainersCommon, volumes]}
126                 -
127                   - /var/lib/config-data/octavia/etc/octavia/:/etc/octavia/:ro
128                   - /var/log/containers/octavia:/var/log/octavia
129             command: "/usr/bin/bootstrap_host_exec octavia_api su octavia -s /bin/bash -c '/usr/bin/octavia-db-manage upgrade head'"
130         step_4:
131           map_merge:
132             - octavia_api:
133                 start_order: 2
134                 image: *octavia_api_image
135                 net: host
136                 privileged: false
137                 restart: always
138                 volumes:
139                   list_concat:
140                     - {get_attr: [ContainersCommon, volumes]}
141                     -
142                       - /var/lib/kolla/config_files/octavia_api.json:/var/lib/kolla/config_files/config.json:ro
143                       - /var/lib/config-data/puppet-generated/octavia/:/var/lib/kolla/config_files/src:ro
144                       - /var/log/containers/octavia:/var/log/octavia
145                 environment:
146                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
147             - if:
148                 - internal_tls_enabled
149                 - octavia_api_tls_proxy:
150                     start_order: 2
151                     image: *octavia_api_image
152                     net: host
153                     user: root
154                     restart: always
155                     volumes:
156                       list_concat:
157                         - {get_attr: [ContainersCommon, volumes]}
158                         -
159                           - /var/lib/kolla/config_files/octavia_api_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
160                           - /var/lib/config-data/puppet-generated/octavia/:/var/lib/kolla/config_files/src:ro
161                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
162                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
163                     environment:
164                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
165                 - {}
166       host_prep_tasks:
167         - name: create persistent logs directory
168           file:
169             path: /var/log/containers/octavia
170             state: directory
171       upgrade_tasks:
172         - name: Stop and disable octavia_api service
173           tags: step2
174           service: name=openstack-octavia-api state=stopped enabled=no