1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

topology-updater: Track new resources not present during startup

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
Oleg Zhurakivskyy 2024-10-30 18:16:53 +02:00
parent 0beafc6aa7
commit 0c8a8fafe7

View file

@ -239,8 +239,30 @@ func getContainerDevicesFromAllocatableResources(availRes *podresourcesapi.Alloc
// updateAvailable computes the actually available resources.
// This function assumes the available resources are initialized to be equal to the allocatable.
func (noderesourceData *nodeResources) updateAvailable(numaData map[int]map[corev1.ResourceName]*resourceData, ri ResourceInfo) {
resName := string(ri.Name)
resMap, ok := noderesourceData.resourceID2NUMAID[resName]
if !ok {
resMap = make(map[string]int)
for _, numaNodeID := range ri.NumaNodeIds {
if _, ok := numaData[numaNodeID]; !ok {
klog.InfoS("failed to find NUMA node ID under the node topology", "numaID", numaNodeID)
continue
}
if _, ok := numaData[numaNodeID][ri.Name]; !ok {
klog.InfoS("failed to find resource under the node topology", "resourceName", ri.Name)
continue
}
for _, resID := range ri.Data {
resMap[resID] = numaNodeID
}
}
noderesourceData.resourceID2NUMAID[resName] = resMap
}
for _, resID := range ri.Data {
resName := string(ri.Name)
resMap, ok := noderesourceData.resourceID2NUMAID[resName]
if !ok {
klog.InfoS("unknown resource", "resourceName", ri.Name)