Bug 1929165 - [RFE] A cluster may have old and new templates (e.g after upgrade); older templates should be protected from deletion
Summary: [RFE] A cluster may have old and new templates (e.g after upgrade); older tem...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: SSP
Version: 2.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 4.9.1
Assignee: Andrej Krejcir
QA Contact: Sarah Bennert
URL:
Whiteboard:
Depends On:
Blocks: 1962475
TreeView+ depends on / blocked
 
Reported: 2021-02-16 10:40 UTC by Ruth Netser
Modified: 2022-01-10 08:20 UTC (History)
5 users (show)

Fixed In Version: kubevirt-ssp-operator-container-v4.9.0-20
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-12-13 19:59:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt ssp-operator pull 208 0 None None None 2021-08-02 14:56:26 UTC
Red Hat Bugzilla 1753554 1 low CLOSED [SSP] [RFE] Common templates - template namespace label is missing from the templates 2021-10-15 08:54:08 UTC
Red Hat Bugzilla 1785118 1 high CLOSED Missing attributes when creating a VM from template using CLI 2021-10-15 08:54:11 UTC
Red Hat Product Errata RHBA-2021:5091 0 None None None 2021-12-13 19:59:17 UTC

Description Ruth Netser 2021-02-16 10:40:22 UTC
Description of problem:
A cluster may have old and new templates (e.g after upgrade).
Currently a user can delete older templates and they will not be reconsiled by the operator; older templates should be protected from deletion as VMs may be referencing them.

Version-Release number of selected component (if applicable):
CNV 2.6.0 (after upgrade)

How reproducible:


Steps to Reproduce:
1. Install CNV 2.5.z
2. Create a VM from template
3. Upgrade the cluster
4. Delete the template which was used to create the VM
5. Try to restart the VMI

Actual results:
The restart will fail as the template is not found.
w/a - update the VM to use a new template

Expected results:
Older templates should be reconsiled / protected from deletion

Additional info:

Comment 1 Andrej Krejcir 2021-04-13 12:49:41 UTC
I think that, instead of blocking the deletion of old templates, the SSP operator could add the 'vm.kubevirt.io/validations' annotation to old VMs.
Then the template-validator would use the validation rules from the annotation and not form a non-existing template.

Old VMs could be updated when the SSP resource is updated to a new version. It would be more efficient than updating on each reconciliation iteration.

Comment 7 Sarah Bennert 2021-10-12 14:01:42 UTC
Template in use by a VM was allowed to be deleted on 4.9 CNV that had been upgraded from 2.5

$ oc delete template -n openshift rhel6-desktop-tiny-v0.11.3
template.template.openshift.io "rhel6-desktop-tiny-v0.11.3" deleted

Comment 14 Sarah Bennert 2021-11-18 19:15:53 UTC
Verified.

Cluster upgraded
From: OpenShift 4.6.48 / OpenShift Virtualization 2.5.8
To:   OpenShift 4.9.7 / OpenShift Virtualization 4.9.1-23

VMs were created using templates from the UI in 2.5.8 and then the cluster upgraded.

After upgrade to 4.9.1, verified delete command was rejected regardless if the VMs were running or not.

$ oc delete -n openshift template rhel8-server-tiny-v0.11.3
Error from server (Forbidden): admission webhook "template-admission.ssp.kubevirt.io" denied the request: Template cannot be deleted, because the following VMs are referencing it for validation: {LIST_OF_ALL_VMS_CREATED_FOR_TEST}

Comment 20 errata-xmlrpc 2021-12-13 19:59:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Virtualization 4.9.1 Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:5091


Note You need to log in before you can comment on or make changes to this bug.