User populated images not present after SX upgrade
After a SX upgrade any custom images pushed to registry.local are lost. Pods using those images will remain in ImagePullBackOff until the images are pushed manually. This change will restore those images during the SX upgrade. Change-Id: I3f902f8c0095cb6da014895f6aee55a3a057e616 Partial-Bug: 1886152 Signed-off-by: David Sullivan <david.sullivan@windriver.com>
This commit is contained in:
parent
b8e84bb5d0
commit
5d802971b9
@ -35,3 +35,9 @@ override_files_dir: "{{ lookup('env', 'HOME') }}"
|
||||
# If this option is not specified this playbook will attempt to find the file on the host under
|
||||
# /opt/platform-backup/
|
||||
upgrade_data_file:
|
||||
|
||||
# The full path and filename of the upgrade_images_data file.
|
||||
# eg /opt/platform-backup/upgrade_images_data_2020-07-16T215224_a75eec9a-c27b-4878-8df9-9e76ac9f1bc3.tgz
|
||||
# If this option is not specified this playbook will attempt to find the file on the host under
|
||||
# /opt/platform-backup/
|
||||
upgrade_images_data_file:
|
||||
|
@ -603,13 +603,3 @@
|
||||
file:
|
||||
path: "{{ ansible_remote_tmp }}"
|
||||
state: absent
|
||||
|
||||
# Unlock controller-0 for subcloud upgrades
|
||||
# # Retry for 5 mins as the first unlock can require a call to update_sriov_config
|
||||
- name: Unlock host
|
||||
shell: source /etc/platform/openrc; system host-unlock controller-0
|
||||
retries: 10
|
||||
delay: 30
|
||||
register: result
|
||||
until: result.rc == 0
|
||||
when: migrate_platform_data is defined and migrate_platform_data and distributed_cloud_role == 'subcloud'
|
||||
|
@ -32,7 +32,7 @@
|
||||
"{{ image_list_query.stdout_lines | join(',') }}"
|
||||
when: image_list_query.stdout_lines|length > 0
|
||||
|
||||
when: file_result.stat.exists
|
||||
when: file_result.stat.exists and file_result.stat.size > 0
|
||||
|
||||
when: docker_images_backup is defined
|
||||
|
||||
|
@ -89,6 +89,49 @@
|
||||
|
||||
when: upgrade_data_file is defined and upgrade_data_file is not none
|
||||
|
||||
- block:
|
||||
# The upgrade image data file will be placed under the default_upgrade_data_dir during upgrade-start
|
||||
# The name is formatted upgrade_images_data_<date_time>_<software_upgrade_uuid>.tgz
|
||||
# The file extension will be .tgz.zero if no images were present during the backup
|
||||
- name: Find upgrade_images_data tar file
|
||||
find:
|
||||
paths: "{{ upgrade_data_dir }}"
|
||||
patterns:
|
||||
- 'upgrade_images_data*.tgz'
|
||||
- 'upgrade_images_data*.tgz.zero'
|
||||
register: upgrade_images_find_output
|
||||
|
||||
- name: Check presence of upgrade_images_data
|
||||
fail:
|
||||
msg: >
|
||||
"Could not find upgrade_images_data file in {{ upgrade_data_dir }}."
|
||||
when: upgrade_images_find_output.matched == 0
|
||||
|
||||
- name: Set upgrade_images_data value
|
||||
set_fact:
|
||||
docker_images_backup: "{{ latest_upgrade_images_data.path }}"
|
||||
vars:
|
||||
latest_upgrade_images_data: "{{ upgrade_images_find_output.files | sort(attribute='ctime', reverse=True) | first }}"
|
||||
|
||||
when: upgrade_images_data_file is not defined or upgrade_images_data_file is none
|
||||
|
||||
- block:
|
||||
- name: Check for upgrade_images_data on host
|
||||
stat:
|
||||
path: "{{ upgrade_images_data_file }}"
|
||||
register: host_upgrade_images_data_file
|
||||
|
||||
- name: Fail if the upgrade_images_data file is not found
|
||||
fail:
|
||||
msg: "Upgrade data file '{{ upgrade_images_data_file }}' not found."
|
||||
when: not host_upgrade_images_data_file.stat.exists
|
||||
|
||||
- name: Set upgrade_images_data value
|
||||
set_fact:
|
||||
docker_images_backup: "{{ upgrade_images_data_file }}"
|
||||
|
||||
when: upgrade_images_data_file is defined and upgrade_images_data_file is not none
|
||||
|
||||
- name: Ensure temporary data path is present
|
||||
file:
|
||||
path: "{{ temp_upgrade_platform_path }}"
|
||||
|
@ -0,0 +1,18 @@
|
||||
---
|
||||
#
|
||||
# Copyright (c) 2020 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# ROLE DESCRIPTION:
|
||||
# This role will unlock the host when required
|
||||
#
|
||||
# Unlock controller-0 for subcloud upgrades
|
||||
# Retry for 5 mins as the first unlock can require a call to update_sriov_config
|
||||
- name: Unlock host
|
||||
shell: source /etc/platform/openrc; system host-unlock controller-0
|
||||
retries: 10
|
||||
delay: 30
|
||||
register: result
|
||||
until: result.rc == 0
|
||||
when: distributed_cloud_role == 'subcloud'
|
@ -25,3 +25,5 @@
|
||||
|
||||
roles:
|
||||
- { role: restore-platform/restore-more-data, become: yes }
|
||||
- { role: restore-user-images/restore-local-registry-images, become: yes }
|
||||
- upgrade-platform/unlock-host
|
||||
|
Loading…
Reference in New Issue
Block a user