Bug 1753554

Summary: [SSP] [RFE] Common templates - template namespace label is missing from the templates
Product: Container Native Virtualization (CNV) Reporter: Ruth Netser <rnetser>
Component: Guest SupportAssignee: Martin Sivák <msivak>
Status: CLOSED DEFERRED QA Contact: Ruth Netser <rnetser>
Severity: medium Docs Contact:
Priority: low    
Version: 2.1.0CC: cnv-qe-bugs, dholler, sgott
Target Milestone: ---   
Target Release: 2.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-13 13:17:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ruth Netser 2019-09-19 09:42:11 UTC
Description of problem:
vm.kubevirt.io/template-namespace annotation is missing from common templates.
If using a template from the UI, the UI is responsible for updating the template name and namespace.

When using the CLI, currently there is no automated mechanism to update either.
While the template name annotation does exist in the templates, the namespace is missing.
When a VM is created using a template, validations from the template will not take place, as the template will not be found.


Version-Release number of selected component (if applicable):


How reproducible:
100% using common templates

Steps to Reproduce:
1. Update a template, e.g. -rhel7-server-tiny-v0.6.2
   Set min memory validation to be lower than requested memory

2. Create DV
apiVersion: cdi.kubevirt.io/v1alpha1
kind: DataVolume
metadata:
  name: rhel7
spec:
  source:
      http:
         url: "http://cnv-qe-server.rhevdev.lab.eng.rdu2.redhat.com/files/rhel-images/rhel-76/rhel-76.qcow2"
  pvc:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: "25Gi"


3. Create the VM from template
oc process -n openshift  rhel7-server-tiny-v0.6.2 -p NAME="test8" -p PVCNAME="rhel7" | oc create -n default  -f


Actual results:
VM is instantiated, there are no errors.

Expected results:
VM creation should fail.

Additional info:

Comment 2 Martin Sivák 2019-09-19 09:51:20 UTC
I would like to clarify something about the annotations. The annotation is missing from a template as that template itself does not know the namespace it is in. That is not an issue.

What is more important is that API users (including oc process tool) do not know they should fill in the namespace when instantiating the VM object. And this can prevent the template validator from properly checking the compliance of the created VM.

On the other hand, the templates we release are well defined and oc process does not do any changes to the important parameters. So validator is not really needed here as it is meant to catch user mistakes when the template is used only as a baseline and metadata source for modifications like the UI does.

So I am not entirely convinced this is an issue for the flow that is described here. It is something we would like to improve by providing a server side template customization service that would abstract the oc process step away and allow much better modifications based on the features described here: https://github.com/kubevirt/common-templates/blob/master/templates/README.md

Comment 3 Ruth Netser 2019-09-20 08:08:42 UTC
Based on bug 1753710 the template namespace is missing from the VM label.

Comment 4 sgott 2019-11-13 13:17:01 UTC
Tracked in Jira as an RFE.