-
Notifications
You must be signed in to change notification settings - Fork 307
topology-updater: Track new resources not present during startup #1897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 { | ||||||||||||||
|
||||||||||||||
| for _, resID := range ri.Data { | |
| for _, resID := range ri.Data { | |
| // Only set the mapping if this resource ID has not been mapped yet. | |
| if _, exists := resMap[resID]; exists { | |
| continue | |
| } |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lookup is redundant since resMap was already retrieved (and potentially populated) at lines 243-263. The variable resMap is still in scope and can be reused directly, eliminating the need for this duplicate lookup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check verifies if the resource exists in numaData before adding it to the resourceID2NUMAID map, but the resource may legitimately not exist yet in numaData if this is a newly registered device plugin. The check at line 252 will cause the function to skip adding new resources to the map, which defeats the purpose of this PR. The perNuma/numaData structure is built from perNUMAAllocatable which is initialized only at startup from GetAllocatableResources, so new resources won't be present there until the aggregator is recreated. This condition should be reconsidered or removed.