@@ -48,9 +48,8 @@ func (p *GpuCustomResourcesProcessor) FilterOutNodesWithUnreadyResources(autosca
4848 }
4949
5050 _ , hasGpuLabel := node .Labels [autoscalingCtx .CloudProvider .GPULabel ()]
51- gpuAllocatable , hasGpuAllocatable := node .Status .Allocatable [gpu .ResourceNvidiaGPU ]
52- directXAllocatable , hasDirectXAllocatable := node .Status .Allocatable [gpu .ResourceDirectX ]
53- if hasGpuLabel && ((! hasGpuAllocatable || gpuAllocatable .IsZero ()) && (! hasDirectXAllocatable || directXAllocatable .IsZero ())) {
51+ _ , hasAnyGpuAllocatable := gpu .NodeHasGpuAllocatable (node )
52+ if hasGpuLabel && ! hasAnyGpuAllocatable {
5453 klog .V (3 ).Infof ("Overriding status of node %v, which seems to have unready GPU" ,
5554 node .Name )
5655 nodesWithUnreadyGpu [node .Name ] = kubernetes .GetUnreadyNodeCopy (node , kubernetes .ResourceUnready )
@@ -88,9 +87,8 @@ func (p *GpuCustomResourcesProcessor) GetNodeGpuTarget(autoscalingCtx *ca_contex
8887 return CustomResourceTarget {}, nil
8988 }
9089
91- gpuAllocatable , found := node .Status .Allocatable [gpu .ResourceNvidiaGPU ]
92- if found && gpuAllocatable .Value () > 0 {
93- return CustomResourceTarget {gpuLabel , gpuAllocatable .Value ()}, nil
90+ if gpuAllocatableValue , hasGpuAllocatable := gpu .NodeHasGpuAllocatable (node ); hasGpuAllocatable {
91+ return CustomResourceTarget {gpuLabel , gpuAllocatableValue }, nil
9492 }
9593
9694 // A node is supposed to have GPUs (based on label), but they're not available yet
@@ -115,8 +113,10 @@ func (p *GpuCustomResourcesProcessor) GetNodeGpuTarget(autoscalingCtx *ca_contex
115113 klog .Errorf ("Failed to build template for getting GPU estimation for node %v: %v" , node .Name , err )
116114 return CustomResourceTarget {}, errors .ToAutoscalerError (errors .CloudProviderError , err )
117115 }
118- if gpuCapacity , found := template .Node ().Status .Capacity [gpu .ResourceNvidiaGPU ]; found {
119- return CustomResourceTarget {gpuLabel , gpuCapacity .Value ()}, nil
116+ for _ , gpuVendorResourceName := range gpu .GPUVendorResourceNames {
117+ if gpuCapacity , found := template .Node ().Status .Capacity [gpuVendorResourceName ]; found {
118+ return CustomResourceTarget {gpuLabel , gpuCapacity .Value ()}, nil
119+ }
120120 }
121121
122122 // if template does not define gpus we assume node will not have any even if ith has gpu label
0 commit comments