github.com/k8snetworkplumbingwg/sriov-network-operator@v1.2.1-0.20240408194816-2d2e5a45d453/doc/testing-virtual-machine.md (about) 1 ## E2E conformance test 2 3 It's possible to use QEMU to test the SR-IOV operator on a virtual kubernetes/openshift cluster. 4 Using the IGB model network driver allow to create virtual functions on the virtual system 5 6 ## How to test 7 8 First you will need to enable the `DEV_MODE` via the operator environment variable. 9 Second step is to add the intel virtual nic to the supported nics configmap. 10 11 Another requirement is to load the vfio kernel module with no_iommu configuration. Example systemd: 12 13 ``` 14 [Unit] 15 Description=vfio no-iommu 16 Before=kubelet.service crio.service node-valid-hostname.service 17 18 [Service] 19 # Need oneshot to delay kubelet 20 Type=oneshot 21 ExecStart=/usr/bin/bash -c "modprobe vfio enable_unsafe_noiommu_mode=1" 22 StandardOutput=journal+console 23 StandardError=journal+console 24 25 [Install] 26 WantedBy=network-online.target 27 ``` 28 29 ### Prerequisites 30 * kcli - deployment tool (https://github.com/karmab/kcli) 31 * virsh 32 * qemu > 8.1 33 * libvirt > 9 34 * podman 35 * make 36 * go 37 38 *Note:* For openshift you will also need a pull secret that you can download from the [Redhat Console](https://console.redhat.com/) 39 40 ## Deploy the cluster 41 42 use the deployment [script](../hack/run-e2e-conformance-virtual-cluster.sh), this will deploy a k8s cluster 43 compile the operator images and run the e2e tests. 44 45 example: 46 ``` 47 SKIP_DELETE=TRUE make test-e2e-conformance-virtual-k8s-cluster 48 ``` 49 50 It's also possible to skip the tests and only deploy the cluster running 51 52 ``` 53 SKIP_TEST=TRUE SKIP_DELETE=TRUE make test-e2e-conformance-virtual-k8s-cluster 54 ``` 55 56 To use the cluster after the deployment you need to export the kubeconfig 57 58 ``` 59 export KUBECONFIG=$HOME/.kcli/clusters/virtual/auth/kubeconfig 60 ``` 61 62 It's possible to also configure the number of workers using `NUM_OF_WORKERS`. 63 64 *NOTE:* For OCP then min number is 3 and for k8s is 2. 65 66 To work on the operator you can change the code and rebuild the operator using 67 `make redeploy-operator-virtual-cluster`. 68 You need to tell the cluster type for ocp `CLUSTER_TYPE=openshift` and for k8s `CLUSTER_TYPE=kubernetes`