tripleo-heat-templates/deployment/manila/manila-api-container-puppet.yaml
Takashi Kajinami 0223e9ab63 Stop non-pcmk services of manila and cinder during upgrade
This change implements missing external_upgrade_tasks for non-pcmk
services of manila and cinder, to ensure that we don't have mixed
versions of controller services running at the same time during
upgrade.

These tasks should have been implemented in the initial patch[1], but
missed at that time unfortunately.

 [1] 8529ce60da

Change-Id: I35ea4354a7448a23d6517f9777ed022caa79347a
(cherry picked from commit 60c22c38cc)
2021-02-18 14:58:22 +00:00

288 lines
11 KiB
YAML

heat_template_version: rocky
description: >
OpenStack containerized Manila API service
parameters:
ContainerManilaApiImage:
description: image
type: string
ContainerManilaConfigImage:
description: The container image to use for the manila config_volume
type: string
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
ServiceData:
default: {}
description: Dictionary packing service data
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
EnableInternalTLS:
type: boolean
default: false
ManilaWorkers:
type: string
description: Set the number of workers for manila::wsgi::apache
default: '%{::os_workers}'
ManilaPassword:
description: The password for the manila service account.
type: string
hidden: true
KeystoneRegion:
type: string
default: 'regionOne'
description: Keystone region for endpoint
MonitoringSubscriptionManilaApi:
default: 'overcloud-manila-api'
type: string
ManilaEnabledShareProtocols:
default: ''
description: List of protocols to be allowed for share creation in manila.
When not set, the list is inferred via the storage back end/s
enabled.
type: comma_delimited_list
conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
manila_workers_zero: {equals : [{get_param: ManilaWorkers}, 0]}
resources:
ContainersCommon:
type: ../containers-common.yaml
MySQLClient:
type: ../../deployment/database/mysql-client.yaml
ManilaBase:
type: ./manila-base.yaml
properties:
EndpointMap: {get_param: EndpointMap}
ServiceData: {get_param: ServiceData}
ServiceNetMap: {get_param: ServiceNetMap}
DefaultPasswords: {get_param: DefaultPasswords}
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
ApacheServiceBase:
type: ../../deployment/apache/apache-baremetal-puppet.yaml
properties:
ServiceData: {get_param: ServiceData}
ServiceNetMap: {get_param: ServiceNetMap}
DefaultPasswords: {get_param: DefaultPasswords}
EndpointMap: {get_param: EndpointMap}
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
EnableInternalTLS: {get_param: EnableInternalTLS}
outputs:
role_data:
description: Role data for the Manila API role.
value:
service_name: manila_api
firewall_rules:
'150 manila':
dport:
- 8786
- 13786
keystone_resources:
manila:
endpoints:
public: {get_param: [EndpointMap, ManilaV1Public, uri]}
internal: {get_param: [EndpointMap, ManilaV1Internal, uri]}
admin: {get_param: [EndpointMap, ManilaV1Admin, uri]}
users:
manila:
password: {get_param: ManilaPassword}
region: {get_param: KeystoneRegion}
service: 'share'
manilav2:
endpoints:
public: {get_param: [EndpointMap, ManilaPublic, uri]}
internal: {get_param: [EndpointMap, ManilaInternal, uri]}
admin: {get_param: [EndpointMap, ManilaAdmin, uri]}
users:
manilav2:
password: {get_param: ManilaPassword}
region: {get_param: KeystoneRegion}
service: 'sharev2'
monitoring_subscription: {get_param: MonitoringSubscriptionManilaApi}
config_settings:
map_merge:
- get_attr: [ManilaBase, role_data, config_settings]
- get_attr: [ApacheServiceBase, role_data, config_settings]
- manila::keystone::authtoken::password: {get_param: ManilaPassword}
manila::keystone::authtoken::www_authenticate_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
manila::keystone::authtoken::auth_url: { get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
manila::keystone::authtoken::project_name: 'service'
manila::keystone::authtoken::user_domain_name: 'Default'
manila::keystone::authtoken::project_domain_name: 'Default'
manila::keystone::authtoken::region_name: {get_param: KeystoneRegion}
manila::keystone::authtoken::interface: 'internal'
# NOTE: bind IP is found in hiera replacing the network name with the
# local node IP for the given network; replacement examples
# (eg. for internal_api):
# internal_api -> IP
# internal_api_uri -> [IP]
# internal_api_subnet - > IP/CIDR
manila::api::bind_host:
str_replace:
template:
"%{hiera('$NETWORK')}"
params:
$NETWORK: {get_param: [ServiceNetMap, ManilaApiNetwork]}
manila::wsgi::apache::bind_host:
str_replace:
template:
"%{hiera('$NETWORK')}"
params:
$NETWORK: {get_param: [ServiceNetMap, ManilaApiNetwork]}
manila::wsgi::apache::ssl: {get_param: EnableInternalTLS}
manila::api::service_name: 'httpd'
manila::api::enable_proxy_headers_parsing: true
manila::api::default_share_type: 'default'
manila_enabled_share_protocols: {get_param: ManilaEnabledShareProtocols}
- manila::wsgi::apache::servername:
str_replace:
template:
"%{hiera('fqdn_$NETWORK')}"
params:
$NETWORK: {get_param: [ServiceNetMap, ManilaApiNetwork]}
- if:
- manila_workers_zero
- {}
- manila::wsgi::apache::workers: {get_param: ManilaWorkers}
service_config_settings: {get_attr: [ManilaBase, role_data, service_config_settings]}
# BEGIN DOCKER SETTINGS #
puppet_config:
config_volume: manila
puppet_tags: manila_config,manila_api_paste_ini
step_config:
list_join:
- "\n"
- - "include tripleo::profile::base::manila::api"
- {get_attr: [MySQLClient, role_data, step_config]}
config_image: {get_param: ContainerManilaConfigImage}
kolla_config:
/var/lib/kolla/config_files/manila_api.json:
command: /usr/sbin/httpd -DFOREGROUND
config_files:
- source: "/var/lib/kolla/config_files/src/etc/httpd/conf.d"
dest: "/etc/httpd/conf.d"
merge: false
preserve_properties: true
- source: "/var/lib/kolla/config_files/src/etc/httpd/conf.modules.d"
dest: "/etc/httpd/conf.modules.d"
# TODO(emilien) remove optional flag once we get a promotion
# https://launchpad.net/bugs/1884115
optional: true
merge: false
preserve_properties: true
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
permissions:
- path: /var/log/manila
owner: manila:manila
recurse: true
docker_config:
step_2:
manila_init_logs:
image: &manila_api_image {get_param: ContainerManilaApiImage}
net: none
user: root
volumes:
- /var/log/containers/manila:/var/log/manila:z
- /var/log/containers/httpd/manila-api:/var/log/httpd:z
command: ['/bin/bash', '-c', 'chown -R manila:manila /var/log/manila']
step_3:
manila_api_db_sync:
user: root
image: *manila_api_image
net: host
detach: false
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/config-data/manila/etc/my.cnf.d/tripleo.cnf:/etc/my.cnf.d/tripleo.cnf:ro
- /var/lib/config-data/manila/etc/manila/:/etc/manila/:ro
- /var/log/containers/manila:/var/log/manila:z
- /var/log/containers/httpd/manila-api:/var/log/httpd:z
command: "/usr/bin/bootstrap_host_exec manila_api su manila -s /bin/bash -c '/usr/bin/manila-manage db sync'"
step_4:
manila_api:
image: *manila_api_image
net: host
restart: always
# NOTE(gouthamr) kolla image changes the user to 'manila', we
# need it to be root to run httpd
user: root
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/manila_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/manila:/var/lib/kolla/config_files/src:ro
- /var/log/containers/manila:/var/log/manila:z
- /var/log/containers/httpd/manila-api:/var/log/httpd:z
- if:
- internal_tls_enabled
- - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
- []
- if:
- internal_tls_enabled
- - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
- []
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
metadata_settings:
get_attr: [ApacheServiceBase, role_data, metadata_settings]
host_prep_tasks:
- name: Create persistent directories
file:
path: "{{ item.path }}"
state: directory
setype: "{{ item.setype }}"
mode: "{{ item.mode|default(omit) }}"
with_items:
- { 'path': /var/log/containers/manila, 'setype': container_file_t, 'mode': '0750' }
- { 'path': /var/log/containers/httpd/manila-api, 'setype': container_file_t, 'mode': '0750' }
upgrade_tasks: []
external_upgrade_tasks:
- when:
- step|int == 1
tags:
- never
- system_upgrade_transfer_data
- system_upgrade_stop_services
block:
- name: Stop manila api container
import_role:
name: tripleo_container_stop
vars:
tripleo_containers_to_stop:
- manila_api
tripleo_delegate_to: "{{ groups['manila_api'] | default([]) }}"