Bug 2081671 - SSH service created outside the UI is not discoverable
Summary: SSH service created outside the UI is not discoverable
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: User Experience
Version: 4.11.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.0
Assignee: Ugo Palatucci
QA Contact: Guohua Ouyang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-04 10:48 UTC by Yaacov Zamir
Modified: 2023-11-13 08:18 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-09-14 19:31:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
for problem #1, #2 (3.73 MB, application/octet-stream)
2022-06-02 00:31 UTC, Guohua Ouyang
no flags Details
for #3 (4.99 MB, application/octet-stream)
2022-06-02 00:34 UTC, Guohua Ouyang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt-ui kubevirt-plugin pull 390 0 None Merged Bug 2081671: Find SSH VMI Service by port 2022-05-15 10:12:28 UTC
Red Hat Issue Tracker CNV-17978 0 None None None 2023-11-13 08:18:12 UTC
Red Hat Product Errata RHSA-2022:6526 0 None None None 2022-09-14 19:32:00 UTC

Description Yaacov Zamir 2022-05-04 10:48:50 UTC
Description of problem:
SSH service created outside the UI is not discoverable

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


How reproducible:


Steps to Reproduce:
1. Create a VM and start it
2. Manually create a Service exposing SSH server via port 22 for this VM
3.

Actual results:
copy ssh command is not available on vm details page
available service is not identified as ssh service.

Expected results:
copy ssh command is available on vm details page
available service is identified as ssh service using the port.

Additional info:
We identify the ssh service by it's name, instead we should look for a service that expose the standard SSH port (port 22)

Comment 1 Yaacov Zamir 2022-05-04 11:09:53 UTC
Jens, Tal hi,

We currently identify the service by it's name
so a workaround is adjuasting the service name :-)

we will need to fix in 4.10 too
( we will need to open a new bug on OCP -> kubevirt plugin for 4.10 )

Comment 2 Yaacov Zamir 2022-05-09 09:21:57 UTC
example of a manually created service for port 22 for vm name-of-vm
```
apiVersion: v1
kind: Service
metadata:
  name: some-ssh-service
  namespace: auto-test-ns
spec:
  ports:
  - port: 22000
    protocol: TCP
    targetPort: 22
  selector:
    vm.kubevirt.io/name: name-of-vm
  type: NodePort
```

Comment 4 Yaacov Zamir 2022-05-12 08:26:20 UTC
Jens hi

in https://bugzilla.redhat.com/show_bug.cgi?id=2081671#c1 we proposed back porting the fix to 4.10 (we have the fix in 4.11)

I prefer not to backport to 4.10 if we have a good workaround.
Is it OK by you not to backport, and only fix for 4.11 ?

Comment 5 Yaacov Zamir 2022-05-15 10:13:30 UTC
https://github.com/kubevirt-ui/kubevirt-plugin/pull/390 - merged upstream

Comment 6 Jens Feind 2022-05-15 21:04:13 UTC
Oh yes, absolutely fine for me, thanks!

Comment 7 Guohua Ouyang 2022-05-27 10:55:43 UTC
There are still problems with the fix:
1. if the SSH is not enabled ever, SSH service created outside the UI is not visible
2. after the SSH service created outside the UI, then enable ssh access on UI, the ssh service is visible, but it still generate the default ssh service, then two ssh services available
3. if the ssh is enabled once, and then disable it. 

Kobi, do you prefer to address the problems in this bug or open new bugs?

Comment 8 Yaacov Zamir 2022-05-29 15:19:17 UTC
(In reply to Guohua Ouyang from comment #7)
> There are still problems with the fix:
> 1. if the SSH is not enabled ever, SSH service created outside the UI is not
> visible

after fix the service should be discoverable when vm is running, it should not depend on "enabled" yes or not

> 2. after the SSH service created outside the UI, then enable ssh access on
> UI, the ssh service is visible, but it still generate the default ssh
> service, then two ssh services available
> 3. if the ssh is enabled once, and then disable it. 
> 
> Kobi, do you prefer to address the problems in this bug or open new bugs?

From problem 1 it sound this bug is not fixed

Comment 9 Ugo Palatucci 2022-05-30 08:58:55 UTC
Can't reproduce 1, 2 and 3. 
Is the created ssh service visible in the 'services' section? 
Can you please share the yaml used to generate the service?

Comment 10 Guohua Ouyang 2022-06-02 00:31:33 UTC
Created attachment 1885901 [details]
for problem #1, #2

In this video, the vm is freshed created and ssh is not enabled, create the ssh service via yaml, there is no ssh service available in vm details page.

And then enable the ssh service, there are two ssh services visible.

Comment 11 Guohua Ouyang 2022-06-02 00:34:59 UTC
Created attachment 1885902 [details]
for #3

#3 is actually good, Seems I didn't write it down completely.
After the ssh is enabled once for the VM, delete all ssh services and then create the ssh service via yaml, it works perfectly, only the ssh service created via yaml is visible.

Comment 12 Ugo Palatucci 2022-06-03 08:15:28 UTC
Yesterday my pr about the ssh service gets merged to cover another bug (https://bugzilla.redhat.com/show_bug.cgi?id=2091940)
The selector to use is slightly different.
We'll use kubevirt.io/domain instead of vm.kubevirt.io/name as a selector if the VM has this label.
If the VM does not have this label, we'll create it using the VM name. kubevirt.io/domain: ${VM_NAME}.
So, in my env I used this yaml and it worked. Probably other prs solved the issue.

apiVersion: v1
kind: Service
metadata:
  name: some-ssh-service
  namespace: default
spec:
  ports:
  - port: 22000
    protocol: TCP
    targetPort: 22
  selector:
    kubevirt.io/domain: rhel8-v4koffgl51qwyha7
  type: NodePort

Comment 13 Ugo Palatucci 2022-06-03 08:17:47 UTC
Sorry, can't edit the original message. The VMI should have the label kubevirt.io/domain in /metadata/labels and the VM should have the same label in /spec/template/metadata/labels

Comment 14 Guohua Ouyang 2022-06-16 03:20:52 UTC
verified on v4.11.0-55

Comment 17 errata-xmlrpc 2022-09-14 19:31:44 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.11.0 Images security and bug fix 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-2022:6526

Comment 18 Red Hat Bugzilla 2023-09-15 01:54:26 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 365 days


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