From 7bbb3465e5b21ef35a07c4243f3ba20fc009df28 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 10 Sep 2024 11:02:46 +0200 Subject: [PATCH] scheduler_perf: more realistic structured parameters tests Real devices are likely to have a handful of attributes and (for GPUs) the memory as capacity. Most keys will be driver specific, a few may eventually have a domain (none standardized right now). --- test/integration/scheduler_perf/dra.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/integration/scheduler_perf/dra.go b/test/integration/scheduler_perf/dra.go index d76cfd6b2ac..66039a67423 100644 --- a/test/integration/scheduler_perf/dra.go +++ b/test/integration/scheduler_perf/dra.go @@ -23,11 +23,13 @@ import ( "sync" resourceapi "k8s.io/api/resource/v1alpha3" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/util/workqueue" "k8s.io/klog/v2" draapp "k8s.io/kubernetes/test/e2e/dra/test-driver/app" "k8s.io/kubernetes/test/utils/ktesting" + "k8s.io/utils/ptr" ) // createResourceClaimsOp defines an op where resource claims are created. @@ -247,8 +249,18 @@ func resourceSlice(driverName, nodeName string, capacity int) *resourceapi.Resou for i := 0; i < capacity; i++ { slice.Spec.Devices = append(slice.Spec.Devices, resourceapi.Device{ - Name: fmt.Sprintf("instance-%d", i), - Basic: &resourceapi.BasicDevice{}, + Name: fmt.Sprintf("instance-%d", i), + Basic: &resourceapi.BasicDevice{ + Attributes: map[resourceapi.QualifiedName]resourceapi.DeviceAttribute{ + "model": {StringValue: ptr.To("A100")}, + "family": {StringValue: ptr.To("GPU")}, + "driverVersion": {VersionValue: ptr.To("1.2.3")}, + "dra.example.com/numa": {IntValue: ptr.To(int64(i))}, + }, + Capacity: map[resourceapi.QualifiedName]resource.Quantity{ + "memory": resource.MustParse("1Gi"), + }, + }, }, ) }