@@ -26,7 +26,6 @@ import (
2626 resourceapi "k8s.io/api/resource/v1"
2727 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2828 "k8s.io/apimachinery/pkg/runtime"
29- metav1apply "k8s.io/client-go/applyconfigurations/meta/v1"
3029 resourceapply "k8s.io/client-go/applyconfigurations/resource/v1"
3130 "k8s.io/klog/v2"
3231 drapbv1 "k8s.io/kubelet/pkg/apis/dra/v1beta1"
@@ -215,7 +214,7 @@ func (s *DeviceState) prepareDevices(ctx context.Context, claim *resourceapi.Res
215214 return nil , fmt .Errorf ("requested GPU is not allocatable: %v" , result .Device )
216215 }
217216
218- deviceStatus := s .buildDeviceStatus (& result )
217+ deviceStatus := s .buildDeviceStatus (result )
219218 devicesStatus = append (devicesStatus , deviceStatus )
220219
221220 for _ , c := range slices .Backward (configs ) {
@@ -401,23 +400,19 @@ func GetOpaqueDeviceConfigs(
401400 return resultConfigs , nil
402401}
403402
404- func (s * DeviceState ) buildDeviceStatus (res * resourceapi.DeviceRequestAllocationResult ) * resourceapply.AllocatedDeviceStatusApplyConfiguration {
403+ func (s * DeviceState ) buildDeviceStatus (res resourceapi.DeviceRequestAllocationResult ) * resourceapply.AllocatedDeviceStatusApplyConfiguration {
405404 dn := res .Device
406- deviceInfo := make (map [string ]interface {} )
405+ deviceInfo := make (map [string ]resourceapi. DeviceAttribute )
407406
408407 if d , ok := s .allocatable [dn ]; ok {
409- if d .Attributes != nil {
410- attributes := d .Attributes
411-
412- if uuid , ok := attributes ["uuid" ]; ok {
413- deviceInfo ["uuid" ] = uuid
414- }
415- if model , ok := attributes ["model" ]; ok {
416- deviceInfo ["model" ] = model
417- }
418- if driverVersion , ok := attributes ["driverVersion" ]; ok {
419- deviceInfo ["driverVersion" ] = driverVersion
420- }
408+ if uuid , ok := d .Attributes ["uuid" ]; ok {
409+ deviceInfo ["uuid" ] = uuid
410+ }
411+ if model , ok := d .Attributes ["model" ]; ok {
412+ deviceInfo ["model" ] = model
413+ }
414+ if driverVersion , ok := d .Attributes ["driverVersion" ]; ok {
415+ deviceInfo ["driverVersion" ] = driverVersion
421416 }
422417 }
423418
@@ -429,18 +424,18 @@ func (s *DeviceState) buildDeviceStatus(res *resourceapi.DeviceRequestAllocation
429424 data := runtime.RawExtension {
430425 Raw : jsonBytes ,
431426 }
432- cond := metav1apply .Condition ().
433- WithType ("Ready" ).
434- WithStatus (metav1 .ConditionTrue ).
435- WithReason ("GPUDeviceReady" ).
436- WithMessage ("GPUDeviceAllocated" ).
437- WithLastTransitionTime (metav1 .Now ())
438427
439428 return resourceapply .AllocatedDeviceStatus ().
440429 WithDevice (dn ).
441430 WithDriver (res .Driver ).
442431 WithPool (res .Pool ).
443- WithConditions (cond ).
432+ // WithData records per-allocation metadata used for monitoring and debugging:
433+ // - Pod→GPU mapping: makes it easier to see which GPU a given pod is using,
434+ // which is not readily available elsewhere.
435+ // - Device attributes (e.g. UUID, model, driverVersion): remain available
436+ // even if the device is later removed from a ResourceSlice (for example,
437+ // because it becomes unhealthy), so past allocations can still be
438+ // correlated with later health or scheduling issues.
444439 WithData (data )
445440}
446441
0 commit comments