kubevirt: Can't add spec.nodeSelector in vmi object.
What happened:
I want to select the target when migration vmi. Just like https://github.com/kubevirt/kubevirt/issues/7105 said, I try to edit or add spec.nodeSelector in VMI object, but update is restricted.
What you expected to happen:
add or update spec.nodeSelector in VMI object succeed
or someone can tell me how to select a target when migration vmi.
How to reproduce it (as minimally and precisely as possible): create a vm zal-cirros-vm
yaml
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
creationTimestamp: null
labels:
kubevirt.io/vm: vm-cirros-datavolume
name: zal-cirros-vm
spec:
running: false
template:
metadata:
labels:
kubevirt.io/vm: vm-datavolume
spec:
domain:
devices:
interfaces:
- name: default
masquerade: {}
disks:
- disk:
bus: virtio
name: datavolumevolume
machine:
type: ""
resources:
requests:
memory: 64M
terminationGracePeriodSeconds: 0
volumes:
- dataVolume:
name: zal-upload-dv
name: datavolumevolume
networks:
- name: default
pod: {} # Stock pod network
virtctl start vm zal-cirros-vm
kubectl edit vmi zal-cirros-vm
just add spec.nodeSelector

but update is restricted
Additional context: I find some discussion may be related to my issue, https://github.com/kubevirt/kubevirt/pull/6550
Environment:
- KubeVirt version (use
virtctl version): N/A - Kubernetes version (use
kubectl version): N/A - VM or VMI specifications: N/A
- Cloud provider or hardware configuration: N/A
- OS (e.g. from /etc/os-release): N/A
- Kernel (e.g.
uname -a): N/A - Install tools: N/A
- Others: N/A
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 18 (18 by maintainers)
BTW, I think we can bring this issue up for discussion in a google group or weekly meeting
Probably filling the design proposal is a good point to start implementing this feature
Thank you for your tip, I think this method can only work to select the targe for the first time migration.
In my test, when I add nodeSelector on
VirtualMachineand migrate vmi, thespec.nodeSelectorwill add on vmi. When this migration finished, I try to change the nodeSelector onVirtualMachineand start another migration. The new virt-launcher pod for the vmi can’t be scheduled successfully. The spec in this pod is generated from the old vmi while the spec.nodeSelector is also old. So I think the method you illustrated above can only work once.Also this issue https://github.com/kubevirt/kubevirt/pull/6550 may describe a similar problem, and I think kubevirt don’t think select targe for migration is a good idea. Therefor I want to confirm, are there any methods to select targe for migration with vmi running without code change rather than edit the code.