-
Bug
-
Resolution: Done-Errata
-
None
-
False
-
-
False
-
NoActiveCustomerTickets
-
CLOSED
-
---
-
---
-
-
-
Medium
-
No
Description of problem:
If the VM is migrated, the virctl expose command is also copying the `migrationTargetNodeName` from the VMI to the service definition:
~~~
- oc get vmi rhel8-kynp0ho84lqqk8bd -o yaml |yq -y '.metadata.labels'
kubevirt.io/domain: rhel8-kynp0ho84lqqk8bd
kubevirt.io/migrationTargetNodeName: master-2.ocp4.shiftvirt.com <<<
kubevirt.io/nodeName: master-2.ocp4.shiftvirt.com
kubevirt.io/size: small
- virtctl expose vm rhel8-kynp0ho84lqqk8bd --port=22 --name=rhel8-kynp0ho84lqqk8bd --type=NodePort
- oc get svc rhel8-kynp0ho84lqqk8bd -o yaml|yq -y '.spec.selector'
kubevirt.io/domain: rhel8-kynp0ho84lqqk8bd
kubevirt.io/migrationTargetNodeName: master-2.ocp4.shiftvirt.com <<<
kubevirt.io/size: small
~~~
The virt-launcher pod doesn't have this label and the service will not match any pods.
~~~
oc get pod virt-launcher-rhel8-kynp0ho84lqqk8bd-9zd85 -o yaml |yq -y '.metadata.labels'
kubevirt.io: virt-launcher
kubevirt.io/created-by: 4e182af4-94d2-4df8-8bbd-384128165af5
kubevirt.io/domain: rhel8-kynp0ho84lqqk8bd
kubevirt.io/migrationJobUID: 6056f4d7-e8de-4718-b5d1-c58e8ac34494
kubevirt.io/nodeName: worker-1.ocp4.shiftvirt.com
kubevirt.io/size: small
vm.kubevirt.io/name: rhel8-kynp0ho84lqqk8bd
oc get endpoints |grep rhel8-kynp0ho84lqqk8bd
rhel8-kynp0ho84lqqk8bd <none> 3m53s
~~~
So the service will not work.
Version-Release number of selected component (if applicable):
OpenShift Virtualization 4.12.2
How reproducible:
100%
Steps to Reproduce:
1. Migrate a VM.
2. Use virtctl expose vmi to expose the VM service.
3. Check the label of service. It will be having migrationTargetNodeName and will not be having endpoints.
Actual results:
Service created using virtctl expose vmi doesn't works if the VM is migrated.
Expected results:
Service created using virtctl expose vmi should work.
Additional info:
Looks to be already fixed upstream https://github.com/kubevirt/kubevirt/pull/9330. Opening BZ since we got a customer who had the same problem.