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 <ayyappa.mantri@windriver.com>
This commit is contained in:
amantri 2023-11-07 13:14:10 -05:00 committed by ayyappa
parent 6d22561256
commit a641b9fe9f
1 changed files with 8 additions and 0 deletions

View File

@ -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"