Skip to content

Commit 7bbb346

Browse files
committed
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).
1 parent b071443 commit 7bbb346

File tree

1 file changed

+14
-2
lines changed
  • test/integration/scheduler_perf

1 file changed

+14
-2
lines changed

test/integration/scheduler_perf/dra.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ import (
2323
"sync"
2424

2525
resourceapi "k8s.io/api/resource/v1alpha3"
26+
"k8s.io/apimachinery/pkg/api/resource"
2627
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2728
"k8s.io/client-go/util/workqueue"
2829
"k8s.io/klog/v2"
2930
draapp "k8s.io/kubernetes/test/e2e/dra/test-driver/app"
3031
"k8s.io/kubernetes/test/utils/ktesting"
32+
"k8s.io/utils/ptr"
3133
)
3234

3335
// createResourceClaimsOp defines an op where resource claims are created.
@@ -247,8 +249,18 @@ func resourceSlice(driverName, nodeName string, capacity int) *resourceapi.Resou
247249
for i := 0; i < capacity; i++ {
248250
slice.Spec.Devices = append(slice.Spec.Devices,
249251
resourceapi.Device{
250-
Name: fmt.Sprintf("instance-%d", i),
251-
Basic: &resourceapi.BasicDevice{},
252+
Name: fmt.Sprintf("instance-%d", i),
253+
Basic: &resourceapi.BasicDevice{
254+
Attributes: map[resourceapi.QualifiedName]resourceapi.DeviceAttribute{
255+
"model": {StringValue: ptr.To("A100")},
256+
"family": {StringValue: ptr.To("GPU")},
257+
"driverVersion": {VersionValue: ptr.To("1.2.3")},
258+
"dra.example.com/numa": {IntValue: ptr.To(int64(i))},
259+
},
260+
Capacity: map[resourceapi.QualifiedName]resource.Quantity{
261+
"memory": resource.MustParse("1Gi"),
262+
},
263+
},
252264
},
253265
)
254266
}

0 commit comments

Comments
 (0)