Merge "Add containerized manila-share to CI"
[apex-tripleo-heat-templates.git] / docker / services / cinder-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Cinder API service
5
6 parameters:
7   DockerCinderApiImage:
8     description: image
9     type: string
10   DockerCinderConfigImage:
11     description: The container image to use for the cinder 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 resources:
48
49   ContainersCommon:
50     type: ./containers-common.yaml
51
52   CinderBase:
53     type: ../../puppet/services/cinder-api.yaml
54     properties:
55       EndpointMap: {get_param: EndpointMap}
56       ServiceData: {get_param: ServiceData}
57       ServiceNetMap: {get_param: ServiceNetMap}
58       DefaultPasswords: {get_param: DefaultPasswords}
59       RoleName: {get_param: RoleName}
60       RoleParameters: {get_param: RoleParameters}
61
62 outputs:
63   role_data:
64     description: Role data for the Cinder API role.
65     value:
66       service_name: {get_attr: [CinderBase, role_data, service_name]}
67       config_settings: {get_attr: [CinderBase, role_data, config_settings]}
68       step_config: &step_config
69         get_attr: [CinderBase, role_data, step_config]
70       service_config_settings: {get_attr: [CinderBase, role_data, service_config_settings]}
71       # BEGIN DOCKER SETTINGS
72       puppet_config:
73         config_volume: cinder
74         puppet_tags: cinder_config,file,concat,file_line
75         step_config: *step_config
76         config_image: {get_param: DockerCinderConfigImage}
77       kolla_config:
78         /var/lib/kolla/config_files/cinder_api.json:
79           command: /usr/sbin/httpd -DFOREGROUND
80           config_files:
81             - source: "/var/lib/kolla/config_files/src/*"
82               dest: "/"
83               merge: true
84               preserve_properties: true
85           permissions:
86             - path: /var/log/cinder
87               owner: cinder:cinder
88               recurse: true
89         /var/lib/kolla/config_files/cinder_api_cron.json:
90           command: /usr/sbin/crond -n
91           config_files:
92             - source: "/var/lib/kolla/config_files/src/*"
93               dest: "/"
94               merge: true
95               preserve_properties: true
96           permissions:
97             - path: /var/log/cinder
98               owner: cinder:cinder
99               recurse: true
100       docker_config:
101         step_2:
102           cinder_api_init_logs:
103             image: &cinder_api_image {get_param: DockerCinderApiImage}
104             privileged: false
105             user: root
106             volumes:
107               - /var/log/containers/cinder:/var/log/cinder
108             command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
109         step_3:
110           cinder_api_db_sync:
111             image: *cinder_api_image
112             net: host
113             privileged: false
114             detach: false
115             user: root
116             volumes:
117               list_concat:
118                 - {get_attr: [ContainersCommon, volumes]}
119                 -
120                   - /var/lib/config-data/cinder/etc/cinder/:/etc/cinder/:ro
121                   - /var/log/containers/cinder:/var/log/cinder
122             command:
123               - '/usr/bin/bootstrap_host_exec'
124               - 'cinder_api'
125               - "su cinder -s /bin/bash -c 'cinder-manage db sync'"
126         step_4:
127           cinder_api:
128             image: *cinder_api_image
129             net: host
130             privileged: false
131             restart: always
132             # NOTE(mandre) kolla image changes the user to 'cinder', we need it
133             # to be root to run httpd
134             user: root
135             volumes:
136               list_concat:
137                 - {get_attr: [ContainersCommon, volumes]}
138                 -
139                   - /var/lib/kolla/config_files/cinder_api.json:/var/lib/kolla/config_files/config.json:ro
140                   - /var/lib/config-data/puppet-generated/cinder/:/var/lib/kolla/config_files/src:ro
141                   - /var/log/containers/cinder:/var/log/cinder
142                   -
143                     if:
144                       - internal_tls_enabled
145                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
146                       - ''
147                   -
148                     if:
149                       - internal_tls_enabled
150                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
151                       - ''
152             environment:
153               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
154           cinder_api_cron:
155             image: *cinder_api_image
156             net: host
157             privileged: false
158             restart: always
159             volumes:
160               list_concat:
161                 - {get_attr: [ContainersCommon, volumes]}
162                 -
163                   - /var/lib/kolla/config_files/cinder_api_cron.json:/var/lib/kolla/config_files/config.json:ro
164                   - /var/lib/config-data/puppet-generated/cinder/:/var/lib/kolla/config_files/src:ro
165                   - /var/log/containers/cinder:/var/log/cinder
166             environment:
167               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
168
169       host_prep_tasks:
170         - name: create persistent logs directory
171           file:
172             path: /var/log/containers/cinder
173             state: directory
174       upgrade_tasks:
175         - name: Stop and disable cinder_api service
176           tags: step2
177           service: name=httpd state=stopped enabled=no