Skip to content

Commit 994ecad

Browse files
committed
Add extra attributes / capacity to each advertised GPU
Signed-off-by: Kevin Klues <[email protected]>
1 parent 43c0c92 commit 994ecad

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cmd/dra-example-kubeletplugin/discovery.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"os"
2222

2323
resourceapi "k8s.io/api/resource/v1alpha3"
24+
"k8s.io/apimachinery/pkg/api/resource"
2425
"k8s.io/utils/ptr"
2526

2627
"github.com/google/uuid"
@@ -32,14 +33,26 @@ func enumerateAllPossibleDevices() (AllocatableDevices, error) {
3233
uuids := generateUUIDs(seed, numGPUs)
3334

3435
alldevices := make(AllocatableDevices)
35-
for _, uuid := range uuids {
36+
for i, uuid := range uuids {
3637
device := resourceapi.Device{
3738
Name: uuid,
3839
Basic: &resourceapi.BasicDevice{
3940
Attributes: map[resourceapi.QualifiedName]resourceapi.DeviceAttribute{
41+
"index": {
42+
IntValue: ptr.To(int64(i)),
43+
},
44+
"uuid": {
45+
StringValue: ptr.To(uuid),
46+
},
4047
"model": {
4148
StringValue: ptr.To("LATEST-GPU-MODEL"),
4249
},
50+
"driverVersion": {
51+
VersionValue: ptr.To("1.0.0"),
52+
},
53+
},
54+
Capacity: map[resourceapi.QualifiedName]resource.Quantity{
55+
"memory": resource.MustParse("80Gi"),
4356
},
4457
},
4558
}

0 commit comments

Comments
 (0)