Bug 2060499 - [RFE] Cannot add additional service (or other objects) to VM template
Summary: [RFE] Cannot add additional service (or other objects) to VM template
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: User Experience
Version: 4.9.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 4.12.0
Assignee: Ugo Palatucci
QA Contact: Guohua Ouyang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-03 15:52 UTC by Tom Bonds
Modified: 2023-09-18 04:33 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-01-24 13:36:09 UTC
Target Upstream Version:
Embargoed:
rsdeor: needinfo+
upalatuc: needinfo-


Attachments (Terms of Use)
Indicating that some additional resources are added when creating a VM from a template (99.02 KB, image/png)
2022-08-01 16:17 UTC, Yifat Menchik
no flags Details
Additional resources is added to the template info (96.61 KB, image/png)
2022-08-03 09:32 UTC, Yifat Menchik
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt-ui kubevirt-plugin pull 794 0 None Merged Bug 2060499: Quick create - template with multiple objects 2022-08-24 18:23:18 UTC
Github kubevirt-ui kubevirt-plugin pull 795 0 None Merged Bug 2060499: getTemplateVirtualMachineObject instead of objects[0] 2022-08-24 18:23:19 UTC
Github kubevirt-ui kubevirt-plugin pull 797 0 None Merged Bug 2060499: Replace vm object correctly into template 2022-08-24 18:23:17 UTC
Github kubevirt-ui kubevirt-plugin pull 810 0 None Merged Bug 2060499: Template additional resources 2022-08-24 18:23:16 UTC
Red Hat Issue Tracker CNV-16729 0 None None None 2022-11-29 09:54:12 UTC
Red Hat Product Errata RHSA-2023:0408 0 None None None 2023-01-24 13:37:30 UTC

Description Tom Bonds 2022-03-03 15:52:33 UTC
Description of problem:

Cannot add additional service to virtual machine template.

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

4.9.3

How reproducible:

Always

Steps to Reproduce:
1. Add Service to objects[] section of template
2. Create VM from template
3.

Actual results:

VM created but no additional service

Expected results:

Expect additional service to be created

Additional info:

example service definition

objects:
[...]
- kind: Service
  apiVersion: v1
  metadata:
    name: '${NAME}-www-service'
  spec:
    externalTrafficPolicy: Cluster
    ipFamilies:
      - IPv4
    ports:
      - protocol: TCP
        port: 20443
        targetPort: 443
    type: NodePort
    selector:
      kubevirt.io/domain: '${NAME}'

Comment 1 sgott 2022-03-09 13:09:32 UTC
Tom, are you trying to directly edit the managed templates that OpenShift Virtualization provides? If that's the workflow you're using, this shouldn't be supported in the sense that the default templates shouldn't be edited. KubeVirt will automatically revert any changes made. This is by design.

What would work is to copy an existing template and create your own.

Comment 3 Tom Bonds 2022-03-09 13:52:35 UTC
Template was cloned from rhel8-desktop-large. Attached the full template; maybe I'm not creating it correctly?

Comment 4 sgott 2022-03-23 12:11:30 UTC
@zpeng can you attempt to reproduce this?

Comment 5 Kedar Bidarkar 2022-03-23 12:11:50 UTC
Zhe Peng: Can you try to reproduce this bug?

Comment 6 zhe peng 2022-03-24 10:43:47 UTC
I can reproduce this, but not sure if its a bug.
test with build cnv4.9.3

step:
1. create a template with bug descriptions
2. create a vm from the template and start
$ oc get vm
NAME            AGE   STATUS    READY
vm-http-rhel8   49m   Running   True

check service 
$ oc get svc
NAME                        TYPE           CLUSTER-IP       EXTERNAL-IP                            PORT(S)           AGE
vm-http-rhel8-ssh-service   NodePort       172.30.23.9      <none>                                 22000:32659/TCP   49m

only have default ssh service 

when I run expose cmd, 
$ virtctl export virtualmachineinstance vm-http-rhel8 --name nodeport --type NodePort --port 20443 --target-port 443
$ oc get svc
NAME                        TYPE           CLUSTER-IP       EXTERNAL-IP                            PORT(S)           AGE
nodeport                    NodePort       172.30.165.190   <none>                                 20443:31358/TCP   21m
vm-http-rhel8-ssh-service   NodePort       172.30.23.9      <none>                                 22000:32659/TCP   49m

Hi @Stu, if template have Service section, the vm created from template will expose service automatically?

Comment 11 Kedar Bidarkar 2022-03-31 13:48:42 UTC
]$oc -n default process kbid-rhel8-custom-service -p NAME=kbid-custom-svc-vm -p CLOUD_USER_PASSWORD=redhat -o yaml > kbid-custom-svc-template.yaml
[kbidarka@localhost ocs]$ oc apply -f kbid-custom-svc-template.yaml
virtualmachine.kubevirt.io/kbid-custom-svc-vm created
service/kbid-custom-svc-vm-only-truth created


Used the above steps to create the VM and SVC using Template.

Comment 12 Kedar Bidarkar 2022-03-31 13:50:22 UTC
Considering the above comments  7-11, this appears to be a RFE for the webUI Team, as creating both VM and Service via a Template from CLI does work fine.

Comment 13 Kedar Bidarkar 2022-03-31 13:53:15 UTC
NOTE: 
1) I used ssh service to test this out ( to avoid further http and certs part) , even though the initial bug description was about https service. 
2) As AFAIK, the service in particular does not matter here, to identity the issue.

Comment 14 sgott 2022-03-31 15:18:32 UTC
Moving this to the UX component based on previous comments. Please let me know if this seems like an error.

Comment 15 Guohua Ouyang 2022-04-06 02:08:23 UTC
Templates on UI have no services at all, creating a template from wizard and enable ssh access, there is no services section on details tab.

Comment 16 Yaacov Zamir 2022-04-18 09:04:36 UTC
Note:

The UI bug is not supporting objects in a VM Templates, currently the UI only tested for templates that have one vm object.

Commont templates have only one vm object, but templates can have more then one object,
in this example it's two objects, vm and service.

Ronen and Tal hi, supporting more then one object will require going over our code and test/add support for more then one object (mainly in the wizard).
IMHO we can move this feature to a JIRA ticket so PM can set the priority, WDYT ?

Comment 17 Ronen 2022-05-04 10:12:34 UTC
Let's add it as an RFE

Comment 20 Yaacov Zamir 2022-07-31 04:27:05 UTC
Ugo hi,
Note that you also need to inform users that the template they are using will create: vm, service, route .... and not just a vm
and after creation inform them that the flowing objects where created.

see attached image of how the user is informed when creating a regular application using the console.

Comment 21 Yaacov Zamir 2022-07-31 04:27:54 UTC
Created attachment 1900331 [details]
inform users what objects are included in the template

Comment 22 Ugo Palatucci 2022-08-01 06:10:28 UTC
Okay, thanks @yzamir

I'm going to bring this to Yifat and we'll explore some options on how to inform the user in the quick create and after the creation. 

Maybe also on the template details page?

Comment 23 Yaacov Zamir 2022-08-01 08:38:45 UTC
(In reply to Ugo Palatucci from comment #22)
> Okay, thanks @yzamir
> 
> I'm going to bring this to Yifat and we'll explore some options on how to
> inform the user in the quick create and after the creation. 
> 
> Maybe also on the template details page?

makes sense to me too :+1:

Comment 24 Yifat Menchik 2022-08-01 16:17:51 UTC
Created attachment 1900646 [details]
Indicating that some additional resources are added when creating a VM from a template

This mockup describes how we can inform users that there are some additional resources that are added when creating a VM from a template

Comment 25 Yifat Menchik 2022-08-02 04:13:13 UTC
apinnick please review the additional section added to the template info drawer indicating that some additional resources are added when creating a VM from a template. Thanks.

Comment 26 Yifat Menchik 2022-08-02 08:20:19 UTC
@upalatuc I just noted there is a typo in the word "resources" in the mockup. Sorry about that.

Comment 27 Ugo Palatucci 2022-08-02 09:10:34 UTC
Dont' worry. I get it

Comment 28 Yifat Menchik 2022-08-03 09:32:14 UTC
Created attachment 1903214 [details]
Additional resources is added to the template info

Comment 29 Yifat Menchik 2022-08-03 09:35:34 UTC
Hi @upalatuc Since this info is related to the template info and not to the VM info I think it should be placed in the left column and not the right one in the template info drawer. WDYT? Please see the attachment. Thanks.

Comment 30 Ugo Palatucci 2022-08-04 07:25:12 UTC
Yes, in the drawer the info is in the left column. 
Only on the template details page, it's on the right. Because there is no space on the left. 

Here the pr : https://github.com/kubevirt-ui/kubevirt-plugin/pull/810

Comment 31 Guohua Ouyang 2022-09-23 02:46:32 UTC
verified on v4.12.0-125, the service can be added to custom template

Comment 36 errata-xmlrpc 2023-01-24 13:36:09 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 (Important: OpenShift Virtualization 4.12.0 Images security update), 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/RHSA-2023:0408

Comment 37 Red Hat Bugzilla 2023-09-18 04:33:00 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


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