Skip to content

Commit

Permalink
Merge pull request #223 from 0xFelix/cleanup-topology
Browse files Browse the repository at this point in the history
Cleanup spread cpu topology and fix failing tests
  • Loading branch information
kubevirt-bot authored Aug 5, 2024
2 parents 59e70de + 13f2e47 commit 2804d8a
Show file tree
Hide file tree
Showing 1,424 changed files with 131,768 additions and 58,836 deletions.
2 changes: 1 addition & 1 deletion preferences/centos/8_stream_dpdk/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resources:
components:
- ./metadata
- ./requirements
- ../../components/cpu-topology-sockets
- ../../components/cpu-topology-spread-4
- ../../components/interface-multiqueue

nameSuffix: ".dpdk"
2 changes: 1 addition & 1 deletion preferences/centos/9_stream_dpdk/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resources:
components:
- ./metadata
- ./requirements
- ../../components/cpu-topology-sockets
- ../../components/cpu-topology-spread-4
- ../../components/interface-multiqueue

nameSuffix: ".dpdk"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: instancetype.kubevirt.io/v1beta1
kind: VirtualMachinePreference
metadata:
name: cpu-topology-spread-4
spec:
cpu:
preferredCPUTopology: preferSpread
spreadOptions:
across: SocketsCoresThreads
ratio: 4
11 changes: 11 additions & 0 deletions preferences/components/cpu-topology-spread-4/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- path: ./cpu-topology-spread-4.yaml
target:
kind: VirtualMachinePreference
- path: ./cpu-topology-spread-4.yaml
target:
kind: VirtualMachineClusterPreference
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ spec:
preferredCPUTopology: preferSpread
spreadOptions:
across: SocketsCoresThreads
ratio: 4
2 changes: 1 addition & 1 deletion preferences/rhel/8_dpdk/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resources:
components:
- ./metadata
- ./requirements
- ../../components/cpu-topology-spread
- ../../components/cpu-topology-spread-4
- ../../components/interface-multiqueue

nameSuffix: ".dpdk"
2 changes: 1 addition & 1 deletion preferences/rhel/9_dpdk/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resources:
components:
- ./metadata
- ./requirements
- ../../components/cpu-topology-spread
- ../../components/cpu-topology-spread-4
- ../../components/interface-multiqueue

nameSuffix: ".dpdk"
31 changes: 22 additions & 9 deletions tests/functests/instancetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var _ = Describe("Common instance types func tests", func() {
// On failure dump the current state of the VirtualMachine into the test output
// Useful for debugging when the namespace has already been cleaned up
if CurrentSpecReport().Failed() && vm != nil {
vm, err = virtClient.VirtualMachine(testNamespace).Get(context.Background(), vm.Name, &metav1.GetOptions{})
vm, err = virtClient.VirtualMachine(testNamespace).Get(context.Background(), vm.Name, metav1.GetOptions{})
if err != nil && errors.IsNotFound(err) {
GinkgoWriter.Printf("VM %s defined but not created", vm.Name)
return
Expand All @@ -58,7 +58,7 @@ var _ = Describe("Common instance types func tests", func() {
return
}
err = virtClient.VirtualMachine(testNamespace).Delete(context.Background(), vm.Name,
&metav1.DeleteOptions{GracePeriodSeconds: ptr.To[int64](0)})
metav1.DeleteOptions{GracePeriodSeconds: ptr.To[int64](0)})
if err != nil && !errors.IsNotFound(err) {
Expect(err).ToNot(HaveOccurred())
}
Expand All @@ -67,7 +67,7 @@ var _ = Describe("Common instance types func tests", func() {
It("[test_id:10735] VirtualMachine using an instancetype can be created", func() {
for _, instancetype := range getClusterInstancetypes(virtClient) {
vm = randomVM(&v1.InstancetypeMatcher{Name: instancetype.Name}, nil, false)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm, metav1.CreateOptions{})
Expect(err).ToNot(HaveOccurred())
}
})
Expand All @@ -81,7 +81,7 @@ var _ = Describe("Common instance types func tests", func() {
}
for _, preference := range getClusterPreferences(virtClient) {
vm = randomVM(&instanceTypeMatcher, &v1.PreferenceMatcher{Name: preference.Name}, false)
_, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm)
_, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm, metav1.CreateOptions{})
Expect(err).To(MatchError(
fmt.Sprintf(
"admission webhook \"virtualmachine-validator.kubevirt.io\" denied the request: "+
Expand All @@ -93,9 +93,22 @@ var _ = Describe("Common instance types func tests", func() {
})

It("[test_id:10737] can be created when enough resources are provided", func() {
preferenceInstancetypeMap := map[string]string{
"centos.stream8.dpdk": "u1.2xlarge",
"centos.stream9.dpdk": "u1.2xlarge",
"rhel.8.dpdk": "u1.2xlarge",
"rhel.9.dpdk": "u1.2xlarge",
"rhel.9.realtime": "u1.xlarge",
"windows.11": "u1.2xmedium",
"windows.11.virtio": "u1.2xmedium",
}
for _, preference := range getClusterPreferences(virtClient) {
vm = randomVM(&v1.InstancetypeMatcher{Name: "u1.2xmedium"}, &v1.PreferenceMatcher{Name: preference.Name}, false)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm)
instancetype := "u1.medium"
if pInstancetype, ok := preferenceInstancetypeMap[preference.Name]; ok {
instancetype = pInstancetype
}
vm = randomVM(&v1.InstancetypeMatcher{Name: instancetype}, &v1.PreferenceMatcher{Name: preference.Name}, false)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm, metav1.CreateOptions{})
Expect(err).ToNot(HaveOccurred())
}
})
Expand Down Expand Up @@ -126,7 +139,7 @@ var _ = Describe("Common instance types func tests", func() {
vm = randomVM(&v1.InstancetypeMatcher{Name: "u1.small"}, &v1.PreferenceMatcher{Name: preference}, true)
addContainerDisk(vm, containerDisk)
addCloudInitWithAuthorizedKey(vm, privKey)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm, metav1.CreateOptions{})
Expect(err).ToNot(HaveOccurred())
expectVMToBeReady(virtClient, vm.Name)
for _, testFn := range testFns {
Expand Down Expand Up @@ -164,7 +177,7 @@ var _ = Describe("Common instance types func tests", func() {
DescribeTable("a Windows guest with", func(containerDisk, preference string, testFns []testFn) {
vm = randomVM(&v1.InstancetypeMatcher{Name: "u1.2xmedium"}, &v1.PreferenceMatcher{Name: preference}, true)
addContainerDisk(vm, containerDisk)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm)
vm, err = virtClient.VirtualMachine(testNamespace).Create(context.Background(), vm, metav1.CreateOptions{})
Expect(err).ToNot(HaveOccurred())
expectVMToBeReady(virtClient, vm.Name)
for _, testFn := range testFns {
Expand Down Expand Up @@ -295,7 +308,7 @@ func addCloudInitWithAuthorizedKey(vm *v1.VirtualMachine, privKey ed25519.Privat

func expectVMToBeReady(virtClient kubecli.KubevirtClient, vmName string) {
Eventually(func(g Gomega) {
vm, err := virtClient.VirtualMachine(testNamespace).Get(context.Background(), vmName, &metav1.GetOptions{})
vm, err := virtClient.VirtualMachine(testNamespace).Get(context.Background(), vmName, metav1.GetOptions{})
g.Expect(err).ToNot(HaveOccurred())
g.Expect(vm.Status.Ready).To(BeTrue())
}, vmReadyTimeout, 10*time.Second).Should(Succeed())
Expand Down
91 changes: 43 additions & 48 deletions tests/go.mod
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
module github.com/kubevirt/common-instancetypes/tests

go 1.20
go 1.22.4

require (
github.com/onsi/ginkgo/v2 v2.13.2
github.com/onsi/gomega v1.30.0
golang.org/x/crypto v0.14.0
k8s.io/api v0.27.1
k8s.io/apimachinery v0.27.1
k8s.io/client-go v12.0.0+incompatible
k8s.io/utils v0.0.0-20231127182322-b307cd553661
kubevirt.io/api v1.1.0
kubevirt.io/client-go v1.1.0
github.com/onsi/ginkgo/v2 v2.19.1
github.com/onsi/gomega v1.34.1
golang.org/x/crypto v0.25.0
k8s.io/api v0.30.3
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.30.3
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
kubevirt.io/api v1.3.0
kubevirt.io/client-go v1.3.0
kubevirt.io/qe-tools v0.1.8
)

require (
github.com/coreos/prometheus-operator v0.38.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k8snetworkplumbingwg/network-attachment-definition-client v0.0.0-20191119172530-79f836b90111 // indirect
Expand All @@ -48,35 +48,30 @@ require (
github.com/openshift/api v0.0.0-20230503133300-8bbcb7ca7183 // indirect
github.com/openshift/client-go v0.0.0-20210112165513-ebc401615f47 // indirect
github.com/openshift/custom-resource-status v1.1.2 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.68.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.4 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/apiextensions-apiserver v0.30.0 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.30.0 // indirect
kubevirt.io/containerized-data-importer-api v1.57.0-alpha1 // indirect
kubevirt.io/controller-lifecycle-operator-sdk/api v0.0.0-20220329064328-f3cc58c6ed90 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
// Replacements needed for kubevirt.io/client-go v1.1.0
k8s.io/api => k8s.io/api v0.26.11
k8s.io/apimachinery => k8s.io/apimachinery v0.26.11
k8s.io/client-go => k8s.io/client-go v0.26.11
// Replacement needed to avoid gnostic / gnostic-models import mismatch
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f
)
// This is needed by kubevirt.io/client-go
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f
Loading

0 comments on commit 2804d8a

Please sign in to comment.