Skip to content

Commit 0c8a8fa

Browse files
committed
topology-updater: Track new resources not present during startup
Signed-off-by: Oleg Zhurakivskyy <[email protected]>
1 parent 0beafc6 commit 0c8a8fa

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

pkg/resourcemonitor/noderesourcesaggregator.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,30 @@ func getContainerDevicesFromAllocatableResources(availRes *podresourcesapi.Alloc
239239
// updateAvailable computes the actually available resources.
240240
// This function assumes the available resources are initialized to be equal to the allocatable.
241241
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+
242265
for _, resID := range ri.Data {
243-
resName := string(ri.Name)
244266
resMap, ok := noderesourceData.resourceID2NUMAID[resName]
245267
if !ok {
246268
klog.InfoS("unknown resource", "resourceName", ri.Name)

0 commit comments

Comments
 (0)