From a641b9fe9fce96da2ea79592deef8be429da25a5 Mon Sep 17 00:00:00 2001 From: amantri Date: Tue, 7 Nov 2023 13:14:10 -0500 Subject: [PATCH] Remove 'resourceVersion' from cert-manager-backup.yml file During upgrade, in 64-upgrade-cert-manager.sh script we backup the existing cert-manager resources to cert-manager-backup.yaml file which contains the resourceVersion and convert the apiVersion and copy to new file cert-manager-v1.yaml and once the cert-manager app is upgraded, we apply the cert-manager-v1.yaml so in the last-configuration-applied which contains the resourceVersion is causing issue during legacy restore operation. This Fix addresses this issue by removing the "resourceVersion" from all the cm resources in the cert-manager-backup.yaml file. Test Cases: PASS: Perform upgrade on the system, after upgrade verify that cert-manager resources like issuer,clusterissuer, certificates,certificaterequests doesn't contain the resourceVersion in the last-applied-configuration under annotations PASS: On an upgraded system, try to update the clusterissuer with the clusterissuer definition file and verify it is successfully updated PASS: On an upgraded system, perform backup and restore and verify it is successful Closes-bug: 2042971 Change-Id: I31c77b75182d953d5a7050f9ea08b3f66bef1e47 Signed-off-by: amantri --- .../upgrade-scripts/64-upgrade-cert-manager.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/controllerconfig/controllerconfig/upgrade-scripts/64-upgrade-cert-manager.sh b/controllerconfig/controllerconfig/upgrade-scripts/64-upgrade-cert-manager.sh index ed23eeb9cc..cd92fe0fe4 100644 --- a/controllerconfig/controllerconfig/upgrade-scripts/64-upgrade-cert-manager.sh +++ b/controllerconfig/controllerconfig/upgrade-scripts/64-upgrade-cert-manager.sh @@ -109,6 +109,14 @@ if [ "x${UPGRADE_APP_VERSION}" != "x${EXISTING_APP_VERSION}" ]; then log "$NAME: Failed to dump existing cert manager resources. Exiting for manual intervention..." exit 1 fi + + # remove the 'resourceVersion' of all cm resources in backup file + # to avoid version related errors while updating the resource + sed -i '/resourceVersion:/d' $CONFIG_PERMDIR/cert-manager-backup.yaml + if [ $? != 0 ]; then + log "$NAME: Failed to delete resourceVersion in cert-manager-backup.yaml. Exiting for manual intervention..." + exit 1 + fi fi touch "$CONFIG_PERMDIR/.cm_upgrade_dump"