Merge "Adds network/cidr mapping into a new service property"
[apex-tripleo-heat-templates.git] / docker / services / glance-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Glance service configured with Puppet
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerGlanceApiImage:
12     description: image
13     default: 'centos-binary-glance-api:latest'
14     type: string
15   DockerGlanceApiConfigImage:
16     description: The container image to use for the glance_api config_volume
17     default: 'centos-binary-glance-api:latest'
18     type: string
19   EndpointMap:
20     default: {}
21     description: Mapping of service endpoint -> protocol. Typically set
22                  via parameter_defaults in the resource registry.
23     type: json
24   ServiceData:
25     default: {}
26     description: Dictionary packing service data
27     type: json
28   ServiceNetMap:
29     default: {}
30     description: Mapping of service_name -> network name. Typically set
31                  via parameter_defaults in the resource registry.  This
32                  mapping overrides those in ServiceNetMapDefaults.
33     type: json
34   DefaultPasswords:
35     default: {}
36     type: json
37   RoleName:
38     default: ''
39     description: Role name on which the service is applied
40     type: string
41   RoleParameters:
42     default: {}
43     description: Parameters specific to the role
44     type: json
45   EnableInternalTLS:
46     type: boolean
47     default: false
48
49 conditions:
50
51   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
52
53
54 resources:
55
56   ContainersCommon:
57     type: ./containers-common.yaml
58
59   GlanceApiPuppetBase:
60     type: ../../puppet/services/glance-api.yaml
61     properties:
62       EndpointMap: {get_param: EndpointMap}
63       ServiceData: {get_param: ServiceData}
64       ServiceNetMap: {get_param: ServiceNetMap}
65       DefaultPasswords: {get_param: DefaultPasswords}
66       RoleName: {get_param: RoleName}
67       RoleParameters: {get_param: RoleParameters}
68
69 outputs:
70   role_data:
71     description: Role data for the Glance API role.
72     value:
73       service_name: {get_attr: [GlanceApiPuppetBase, role_data, service_name]}
74       config_settings:
75         map_merge:
76           - get_attr: [GlanceApiPuppetBase, role_data, config_settings]
77           - glance::api::sync_db: false
78       step_config: &step_config
79         get_attr: [GlanceApiPuppetBase, role_data, step_config]
80       service_config_settings: {get_attr: [GlanceApiPuppetBase, role_data, service_config_settings]}
81       # BEGIN DOCKER SETTINGS #
82       puppet_config:
83         config_volume: glance_api
84         puppet_tags: glance_api_config,glance_api_paste_ini,glance_swift_config,glance_cache_config
85         step_config: *step_config
86         config_image:
87           list_join:
88             - '/'
89             - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiConfigImage} ]
90       kolla_config:
91         /var/lib/kolla/config_files/glance_api.json:
92           command: /usr/bin/glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf
93           config_files:
94             - source: "/var/lib/kolla/config_files/src/*"
95               dest: "/"
96               merge: true
97               preserve_properties: true
98         /var/lib/kolla/config_files/glance_api_tls_proxy.json:
99           command: /usr/sbin/httpd -DFOREGROUND
100           config_files:
101             - source: "/var/lib/kolla/config_files/src/*"
102               dest: "/"
103               merge: true
104               preserve_properties: true
105       docker_config:
106         # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
107         step_2:
108           glance_init_logs:
109             image: &glance_api_image
110               list_join:
111                 - '/'
112                 - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiImage} ]
113             privileged: false
114             user: root
115             volumes:
116               - /var/log/containers/glance:/var/log/glance
117             command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
118         step_3:
119           glance_api_db_sync:
120             image: *glance_api_image
121             net: host
122             privileged: false
123             detach: false
124             user: root
125             volumes: &glance_volumes
126               list_concat:
127                 - {get_attr: [ContainersCommon, volumes]}
128                 -
129                   - /var/lib/kolla/config_files/glance_api.json:/var/lib/kolla/config_files/config.json
130                   - /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro
131                   - /var/log/containers/glance:/var/log/glance
132             environment:
133               - KOLLA_BOOTSTRAP=True
134               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
135             command: "/usr/bin/bootstrap_host_exec glance_api su glance -s /bin/bash -c '/usr/local/bin/kolla_start'"
136         step_4:
137           map_merge:
138             - glance_api:
139                 start_order: 2
140                 image: *glance_api_image
141                 net: host
142                 privileged: false
143                 restart: always
144                 volumes: *glance_volumes
145                 environment:
146                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
147             - if:
148                 - internal_tls_enabled
149                 - glance_api_tls_proxy:
150                     start_order: 2
151                     image: *glance_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/glance_api_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
160                           - /var/lib/config-data/puppet-generated/glance_api/:/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/glance
170             state: directory
171       upgrade_tasks:
172         - name: Stop and disable glance_api service
173           tags: step2
174           service: name=openstack-glance-api state=stopped enabled=no
175       metadata_settings:
176         get_attr: [GlanceApiPuppetBase, role_data, metadata_settings]