Skip to content

Commit

Permalink
virtual cluster e2e tests changes
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed Jun 20, 2023
1 parent 109c2c2 commit 34e20d4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
33 changes: 33 additions & 0 deletions doc/testing-virtual-machine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## E2E conformance test

It's possible to use QEMU to test the SR-IOV operator on a virtual kubernetes/openshift cluster.
Using the IGB model network driver allow to create virtual functions on the virtual system

## How to test

First you will need to enable the `DEV_MOD` via the operator environment variable.
Second step is to add the intel virtual nic to the supported nics configmap.

```
Intel_ixgbe_82576: 8086 10c9 10ca
```

Another requirement is to load the vfio kernel module with no_iommu configuration. Example systemd:

```
[Unit]
Description=vfio no-iommu
Before=kubelet.service crio.service node-valid-hostname.service
[Service]
# Need oneshot to delay kubelet
Type=oneshot
ExecStart=/usr/bin/bash -c "modprobe vfio enable_unsafe_noiommu_mode=1"
StandardOutput=journal+console
StandardError=journal+console
[Install]
WantedBy=network-online.target
```

# TBD
21 changes: 17 additions & 4 deletions test/conformance/tests/test_sriov_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,11 @@ var _ = Describe("[sriov] operator", func() {

// 25961
It("Should configure the the link state variable", func() {
if cluster.VirtualCluster() {
// https://bugzilla.redhat.com/show_bug.cgi?id=2214976
Skip("Bug in IGB driver")
}

sriovNetwork := &sriovv1.SriovNetwork{
ObjectMeta: metav1.ObjectMeta{Name: "test-statenetwork", Namespace: operatorNamespace},
Spec: sriovv1.SriovNetworkSpec{
Expand Down Expand Up @@ -1161,6 +1166,11 @@ var _ = Describe("[sriov] operator", func() {
Context("PF shutdown", func() {
// 29398
It("Should be able to create pods successfully if PF is down.Pods are able to communicate with each other on the same node", func() {
if cluster.VirtualCluster() {
// https://bugzilla.redhat.com/show_bug.cgi?id=2214976
Skip("Bug in IGB driver")
}

resourceName := testResourceName
var testNode string
var unusedSriovDevice *sriovv1.InterfaceExt
Expand Down Expand Up @@ -1210,6 +1220,11 @@ var _ = Describe("[sriov] operator", func() {

Context("MTU", func() {
BeforeEach(func() {
if cluster.VirtualCluster() {
// https://bugzilla.redhat.com/show_bug.cgi?id=2214977
Skip("Bug in IGB driver")
}

var node string
resourceName := "mturesource"
var numVfs int
Expand Down Expand Up @@ -1305,7 +1320,6 @@ var _ = Describe("[sriov] operator", func() {
ResourceName: resourceName,
IPAM: `{"type":"host-local","subnet":"10.10.10.0/24","rangeStart":"10.10.10.171","rangeEnd":"10.10.10.181","routes":[{"dst":"0.0.0.0/0"}],"gateway":"10.10.10.1"}`,
NetworkNamespace: namespaces.Test,
LinkState: "enable",
}}

// We need this to be able to run the connectivity checks on Mellanox cards
Expand Down Expand Up @@ -1626,7 +1640,6 @@ var _ = Describe("[sriov] operator", func() {
ResourceName: resourceName,
IPAM: `{"type":"host-local","subnet":"10.10.10.0/24","rangeStart":"10.10.10.171","rangeEnd":"10.10.10.181","routes":[{"dst":"0.0.0.0/0"}],"gateway":"10.10.10.1"}`,
NetworkNamespace: namespaces.Test,
LinkState: "enable",
}}

// We need this to be able to run the connectivity checks on Mellanox cards
Expand Down Expand Up @@ -1981,9 +1994,9 @@ func createCustomTestPod(node string, networks []string, hostNetwork bool, podCa
Expect(err).ToNot(HaveOccurred())
return runningPod.Status.Phase
}, 5*time.Minute, 1*time.Second).Should(Equal(corev1.PodRunning))
pod, err := clients.Pods(namespaces.Test).Get(context.Background(), createdPod.Name, metav1.GetOptions{})
podObj, err := clients.Pods(namespaces.Test).Get(context.Background(), createdPod.Name, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
return pod
return podObj
}

func pingPod(ip string, nodeSelector string, sriovNetworkAttachment string) {
Expand Down
12 changes: 10 additions & 2 deletions test/util/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"os"
"strings"
"time"

Expand All @@ -28,8 +29,8 @@ type EnabledNodes struct {
}

var (
supportedPFDrivers = []string{"mlx5_core", "i40e", "ixgbe", "ice"}
supportedVFDrivers = []string{"iavf", "vfio-pci", "mlx5_core"}
supportedPFDrivers = []string{"mlx5_core", "i40e", "ixgbe", "ice", "igb"}
supportedVFDrivers = []string{"iavf", "vfio-pci", "mlx5_core", "igbvf"}
mlxVendorID = "15b3"
intelVendorID = "8086"
)
Expand Down Expand Up @@ -331,3 +332,10 @@ func GetNodeSecureBootState(clients *testclient.ClientSet, nodeName, namespace s

return strings.Contains(stdout, "[integrity]") || strings.Contains(stdout, "[confidentiality]"), nil
}

func VirtualCluster() bool {
if v, exist := os.LookupEnv("VIRTUAL_ENV"); exist && v != "" {
return true
}
return false
}
5 changes: 5 additions & 0 deletions test/util/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

sriovv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
testclient "github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/client"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/cluster"
)

// Needed for parsing of podinfo
Expand All @@ -37,6 +38,10 @@ func CreateSriovNetwork(clientSet *testclient.ClientSet, intf *sriovv1.Interface
LinkState: "enable",
}}

if cluster.VirtualCluster() {
sriovNetwork.Spec.LinkState = ""
}

for _, o := range options {
o(sriovNetwork)
}
Expand Down

0 comments on commit 34e20d4

Please sign in to comment.