kubevirt: Support nocloud user-data#2134
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for nocloud user-data in Kubevirt, falling back to the existing config-drive method. The changes are well-structured, particularly the parameterization of the device and path fetching logic. I've identified a potential logic issue in the new fallback mechanism: if the nocloud source provides no user data, the fallback to config-drive is not triggered. I have included a specific comment with a suggested fix for this behavior.
jlebon
left a comment
There was a problem hiding this comment.
Seems sane to me. Needs release note.
@jlebon thanks on it! |
b8eca86 to
0139704
Compare
0139704 to
f3608ca
Compare
|
Humm something is not ready yet it's failing to find cidata with this VM I am building it with https://github.com/qinqon/coreos-initrd-builder And I can confirm that the ignition inside the VM is the custom one. |
fefeed2 to
f3608ca
Compare
|
@jlebon @prestist managed to test it and it's working fine, kubevirt fecos with ConfigDrive and NoCloud is working as expected. Tested it with images builded with https://github.com/qinqon/coreos-initrd-builder With NoCloud apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
namespace: clusters-test1
name: fedora-coreos-vm
spec:
runStrategy: Always
template:
metadata:
labels:
app: fedora-coreos-vm
spec:
domain:
devices:
disks:
- name: rootdisk
disk:
bus: virtio
- name: cloudinitdisk
disk:
bus: virtio
interfaces:
- name: default
bridge: {}
resources:
requests:
memory: 2Gi
cpu: "1"
limits:
memory: 4Gi
cpu: "2"
networks:
- name: default
multus:
networkName: localnet-clusters-test1
volumes:
- name: rootdisk
containerDisk:
image: quay.io/ellorent/fcos-kubevirt@sha256:a773c47ecff9f580a80510d0e4c652c5648b1cb102ec16832b68ba925a810114
- name: cloudinitdisk
cloudInitNoCloud:
userData: '{"ignition":{"version":"3.5.0"},"passwd":{"users":[{"name":"core","passwordHash":"$y$j9T$b7RFf2LW7MUOiF4RyLHKA0$T.Ap/uzmg8zrTcUNXyXvBvT26UgkC6zZUVg3UKXeEp5"}]}}'And with ConfigDrive apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
namespace: clusters-test1
name: fedora-coreos-vm
spec:
runStrategy: Always
template:
metadata:
labels:
app: fedora-coreos-vm
spec:
domain:
devices:
disks:
- name: rootdisk
disk:
bus: virtio
- name: cloudinitdisk
disk:
bus: virtio
interfaces:
- name: default
bridge: {}
resources:
requests:
memory: 2Gi
cpu: "1"
limits:
memory: 4Gi
cpu: "2"
networks:
- name: default
multus:
networkName: localnet-clusters-test1
volumes:
- name: rootdisk
containerDisk:
image: quay.io/ellorent/fcos-kubevirt@sha256:a773c47ecff9f580a80510d0e4c652c5648b1cb102ec16832b68ba925a810114
- name: cloudinitdisk
cloudInitConfigDrive:
userData: '{"ignition":{"version":"3.5.0"},"passwd":{"users":[{"name":"core","passwordHash":"$y$j9T$b7RFf2LW7MUOiF4RyLHKA0$T.Ap/uzmg8zrTcUNXyXvBvT26UgkC6zZUVg3UKXeEp5"}]}}' |
prestist
left a comment
There was a problem hiding this comment.
Overall LGTM just that one nit.
f3608ca to
316b46c
Compare
At kubevirt one can configure the cloud init as config drive or nocloud, with config drive is the current approch, this change add the nocloud that spect a device mount with "cidata" label and tue user data file at /user-data there, also the main different if that on those cases the network data follows the netplan v1 or v2 that's is better format than the openstack meta data network service one. Signed-off-by: Enrique Llorente <ellorent@redhat.com>
316b46c to
04aefad
Compare
prestist
left a comment
There was a problem hiding this comment.
Thank you for working on this, and being so quick to respond to feedback LGTM!
At kubevirt one can configure the cloud init as config drive or nocloud, with config drive is the current approch, this change add the nocloud that spect a device mount with "cidata" label and tue user data file at /user-data there, also the main different if that on those cases the network data follows the netplan v1 or v2 that's is better format than the openstack meta data network service one.