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:
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
Based on bug 1753710 the template namespace is missing from the VM label.
Tracked in Jira as an RFE.