pcs commands on host: redis bundle

This implements the creation of the redis bundle on the host.
The testing protocol used is documented in the depends-on.

The full rationale is contained in the LP bug.

The reason for adding a post_update task is that during a minor update
the deployment tasks are not run during the node update procedure but
only during the final converge. So we ran the role again there to make
sure that any config change will trigger a restart during the minor
update, so the disruption is only local to the single node being
updated. If we did not do this a final converge could potentially
trigger a global restart of HA bundles which would be quite disruptive.

Related-Bug: #1863442

Depends-On: Iaa7e89f0d25221c2a6ef0b81eb88a6f496f01696

Change-Id: I5ce8367363d535b71b01395b0bef4cf17c8935b5
This commit is contained in:
Michele Baldessari 2020-08-11 15:04:36 +02:00
parent caf1c3d323
commit 83d1cb5852

View File

@ -79,7 +79,6 @@ parameter_groups:
- RedisIPv6
conditions:
puppet_debug_enabled: {get_param: ConfigDebug}
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
docker_enabled: {equals: [{get_param: ContainerCli}, 'docker']}
common_tag_enabled: {equals: [{get_param: ClusterCommonTag}, true]}
@ -234,73 +233,6 @@ outputs:
perm: '0600'
optional: true
container_config_scripts: {get_attr: [ContainersCommon, container_config_scripts]}
docker_config:
step_2:
map_merge:
- redis_init_bundle:
start_order: 1
detach: false
net: host
ipc: host
user: root
config_volume: 'redis_init_bundle'
command: # '/container_puppet_apply.sh "STEP" "TAGS" "CONFIG" "DEBUG"'
list_concat:
- - '/container_puppet_apply.sh'
- '2'
- 'file,file_line,concat,augeas,pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation'
- 'include tripleo::profile::base::pacemaker;include tripleo::profile::pacemaker::database::redis_bundle'
- if:
- puppet_debug_enabled
- - '--debug'
- - ''
image: *redis_config_image
volumes:
list_concat:
- {get_attr: [ContainersCommon, container_puppet_apply_volumes]}
- if:
- docker_enabled
- - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
- null
environment:
# NOTE: this should force this container to re-run on each
# update (scale-out, etc.)
TRIPLEO_DEPLOY_IDENTIFIER: {get_param: DeployIdentifier}
- redis_restart_bundle:
start_order: 2
config_volume: redis
detach: false
net: host
ipc: host
user: root
environment:
TRIPLEO_MINOR_UPDATE: ''
command: /var/lib/container-config-scripts/pacemaker_restart_bundle.sh redis redis redis-bundle Slave Master
image: {get_param: ContainerRedisConfigImage}
volumes:
list_concat:
- {get_attr: [ContainersCommon, pacemaker_restart_volumes]}
- - /var/lib/config-data/puppet-generated/redis:/var/lib/kolla/config_files/src:ro
- if:
- internal_tls_enabled
- redis_tls_proxy:
start_order: 3
image: {get_param: ContainerRedisImage}
net: host
user: root
restart: always
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/redis_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/redis:/var/lib/kolla/config_files/src:ro
- /etc/pki/tls/certs/redis.crt:/var/lib/kolla/config_files/src-tls/etc/pki/tls/certs/redis.crt:ro
- /etc/pki/tls/private/redis.key:/var/lib/kolla/config_files/src-tls/etc/pki/tls/private/redis.key:ro
- /var/lib/container-config-scripts/wait-port-and-run.sh:/wait-port-and-run.sh:ro
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
- {}
metadata_settings:
get_attr: [RedisBase, role_data, metadata_settings]
host_prep_tasks:
@ -327,6 +259,21 @@ outputs:
vars:
container_image: {get_param: ContainerRedisImage}
container_image_latest: *redis_image_pcmklatest
- name: Redis HA Wrappers Step
when: step|int == 2
block: &redis_puppet_bundle
- name: Redis puppet bundle
import_role:
name: tripleo_ha_wrapper
vars:
tripleo_ha_wrapper_service_name: redis
tripleo_ha_wrapper_resource_name: redis
tripleo_ha_wrapper_bundle_name: redis-bundle
tripleo_ha_wrapper_resource_state: Slave Master
tripleo_ha_wrapper_puppet_config_volume: redis
tripleo_ha_wrapper_puppet_execute: 'include ::tripleo::profile::base::pacemaker; include ::tripleo::profile::pacemaker::database::redis_bundle'
tripleo_ha_wrapper_puppet_tags: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::resource::ocf,pacemaker::constraint::order,pacemaker::constraint::colocation'
tripleo_ha_wrapper_puppet_debug: {get_param: ConfigDebug}
update_tasks:
- name: Tear-down non-HA redis container
when:
@ -364,6 +311,13 @@ outputs:
when:
- old_redis_image_id.stdout != new_redis_image_id.stdout
post_update_tasks:
- name: Redis bundle post update
when: step|int == 1
block: *redis_puppet_bundle
vars:
tripleo_ha_wrapper_minor_update: true
upgrade_tasks:
- name: Tear-down non-HA redis container
when: