@@ -239,8 +239,30 @@ func getContainerDevicesFromAllocatableResources(availRes *podresourcesapi.Alloc
239
239
// updateAvailable computes the actually available resources.
240
240
// This function assumes the available resources are initialized to be equal to the allocatable.
241
241
func (noderesourceData * nodeResources ) updateAvailable (numaData map [int ]map [corev1.ResourceName ]* resourceData , ri ResourceInfo ) {
242
+ resName := string (ri .Name )
243
+ resMap , ok := noderesourceData .resourceID2NUMAID [resName ]
244
+ if ! ok {
245
+ resMap = make (map [string ]int )
246
+ for _ , numaNodeID := range ri .NumaNodeIds {
247
+ if _ , ok := numaData [numaNodeID ]; ! ok {
248
+ klog .InfoS ("failed to find NUMA node ID under the node topology" , "numaID" , numaNodeID )
249
+ continue
250
+ }
251
+
252
+ if _ , ok := numaData [numaNodeID ][ri.Name ]; ! ok {
253
+ klog .InfoS ("failed to find resource under the node topology" , "resourceName" , ri .Name )
254
+ continue
255
+ }
256
+
257
+ for _ , resID := range ri .Data {
258
+ resMap [resID ] = numaNodeID
259
+ }
260
+ }
261
+
262
+ noderesourceData .resourceID2NUMAID [resName ] = resMap
263
+ }
264
+
242
265
for _ , resID := range ri .Data {
243
- resName := string (ri .Name )
244
266
resMap , ok := noderesourceData .resourceID2NUMAID [resName ]
245
267
if ! ok {
246
268
klog .InfoS ("unknown resource" , "resourceName" , ri .Name )
0 commit comments