
This patch guards db syncs and initialization code from executing on multiple nodes at the same time by using the new bootstrap_host_exec script. This helper script checks to make sure the container is executing on the "bootstrap host" for the specified service (arg 0) and then if it matches runs the specified command. Depends-On: If25f217bbb592edab4e1dde53ca99ed93c0e146c Depends-On: Ic1585bae27c318bd6bafc287e905f2ed250cce0f Change-Id: I0c864ca093ea476248b619d8c88477ef0b64e2eb Closes-Bug: 1688380
136 lines
4.4 KiB
YAML
136 lines
4.4 KiB
YAML
heat_template_version: pike
|
|
|
|
description: >
|
|
OpenStack containerized Ironic API service
|
|
|
|
parameters:
|
|
DockerNamespace:
|
|
description: namespace
|
|
default: 'tripleoupstream'
|
|
type: string
|
|
DockerIronicApiImage:
|
|
description: image
|
|
default: 'centos-binary-ironic-api:latest'
|
|
type: string
|
|
DockerIronicConfigImage:
|
|
description: image
|
|
default: 'centos-binary-ironic-pxe:latest'
|
|
type: string
|
|
EndpointMap:
|
|
default: {}
|
|
description: Mapping of service endpoint -> protocol. Typically set
|
|
via parameter_defaults in the resource registry.
|
|
type: json
|
|
ServiceNetMap:
|
|
default: {}
|
|
description: Mapping of service_name -> network name. Typically set
|
|
via parameter_defaults in the resource registry. This
|
|
mapping overrides those in ServiceNetMapDefaults.
|
|
type: json
|
|
DefaultPasswords:
|
|
default: {}
|
|
type: json
|
|
RoleName:
|
|
default: ''
|
|
description: Role name on which the service is applied
|
|
type: string
|
|
RoleParameters:
|
|
default: {}
|
|
description: Parameters specific to the role
|
|
type: json
|
|
|
|
resources:
|
|
|
|
ContainersCommon:
|
|
type: ./containers-common.yaml
|
|
|
|
IronicApiBase:
|
|
type: ../../puppet/services/ironic-api.yaml
|
|
properties:
|
|
EndpointMap: {get_param: EndpointMap}
|
|
ServiceNetMap: {get_param: ServiceNetMap}
|
|
DefaultPasswords: {get_param: DefaultPasswords}
|
|
RoleName: {get_param: RoleName}
|
|
RoleParameters: {get_param: RoleParameters}
|
|
|
|
outputs:
|
|
role_data:
|
|
description: Role data for the Ironic API role.
|
|
value:
|
|
service_name: {get_attr: [IronicApiBase, role_data, service_name]}
|
|
config_settings:
|
|
map_merge:
|
|
- get_attr: [IronicApiBase, role_data, config_settings]
|
|
step_config: &step_config
|
|
get_attr: [IronicApiBase, role_data, step_config]
|
|
service_config_settings: {get_attr: [IronicApiBase, role_data, service_config_settings]}
|
|
# BEGIN DOCKER SETTINGS
|
|
puppet_config:
|
|
config_volume: ironic
|
|
puppet_tags: ironic_config
|
|
step_config: *step_config
|
|
config_image:
|
|
list_join:
|
|
- '/'
|
|
- [ {get_param: DockerNamespace}, {get_param: DockerIronicConfigImage} ]
|
|
kolla_config:
|
|
/var/lib/kolla/config_files/ironic_api.json:
|
|
command: /usr/bin/ironic-api
|
|
permissions:
|
|
- path: /var/log/ironic
|
|
owner: ironic:ironic
|
|
recurse: true
|
|
docker_config:
|
|
# db sync runs before permissions set by kolla_config
|
|
step_3:
|
|
ironic_init_logs:
|
|
start_order: 0
|
|
image: &ironic_image
|
|
list_join:
|
|
- '/'
|
|
- [ {get_param: DockerNamespace}, {get_param: DockerIronicApiImage} ]
|
|
privileged: false
|
|
user: root
|
|
volumes:
|
|
- /var/log/containers/ironic:/var/log/ironic
|
|
command: ['/bin/bash', '-c', 'chown -R ironic:ironic /var/log/ironic']
|
|
ironic_db_sync:
|
|
start_order: 1
|
|
image: *ironic_image
|
|
net: host
|
|
privileged: false
|
|
detach: false
|
|
user: root
|
|
volumes:
|
|
list_concat:
|
|
- {get_attr: [ContainersCommon, volumes]}
|
|
-
|
|
- /var/lib/config-data/ironic/etc/:/etc/:ro
|
|
- /var/log/containers/ironic:/var/log/ironic
|
|
command: "/usr/bin/bootstrap_host_exec ironic_api su ironic -s /bin/bash -c 'ironic-dbsync --config-file /etc/ironic/ironic.conf'"
|
|
step_4:
|
|
ironic_api:
|
|
start_order: 10
|
|
image: *ironic_image
|
|
net: host
|
|
privileged: false
|
|
restart: always
|
|
volumes:
|
|
list_concat:
|
|
- {get_attr: [ContainersCommon, volumes]}
|
|
-
|
|
- /var/lib/kolla/config_files/ironic_api.json:/var/lib/kolla/config_files/config.json:ro
|
|
- /var/lib/config-data/ironic/etc/:/etc/:ro
|
|
- /var/log/containers/ironic:/var/log/ironic
|
|
environment:
|
|
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
|
|
host_prep_tasks:
|
|
- name: create persistent logs directory
|
|
file:
|
|
path: /var/log/containers/ironic
|
|
state: directory
|
|
upgrade_tasks:
|
|
- name: Stop and disable ironic_api service
|
|
tags: step2
|
|
service: name=openstack-ironic-api state=stopped enabled=no
|