-
Notifications
You must be signed in to change notification settings - Fork 41.1k
[BugFix]Update ImageLocality plugin to account ImageVolume images #130231
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 |
---|---|---|
|
@@ -87,7 +87,8 @@ func calculatePriority(sumScores int64, numContainers int) int64 { | |
return framework.MaxNodeScore * (sumScores - minThreshold) / (maxThreshold - minThreshold) | ||
} | ||
|
||
// sumImageScores returns the sum of image scores of all the containers that are already on the node. | ||
// sumImageScores returns the total image score for all container images in the Pod spec, | ||
// including regular containers, init containers, and image volumes, that already exist on the node. | ||
// Each image receives a raw score of its size, scaled by scaledImageScore. The raw scores are later used to calculate | ||
// the final score. | ||
func sumImageScores(nodeInfo fwk.NodeInfo, pod *v1.Pod, totalNumNodes int) int64 { | ||
|
@@ -102,6 +103,14 @@ func sumImageScores(nodeInfo fwk.NodeInfo, pod *v1.Pod, totalNumNodes int) int64 | |
sum += scaledImageScore(state, totalNumNodes) | ||
} | ||
} | ||
for _, volume := range pod.Spec.Volumes { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if should check the "ImageVolume" feature gate at here, and only account volume when it enabled. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, it's done. Is there anything else missing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None from me. Let's wait for other reviewers There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, actually I'm not sure about this. |
||
if volume.Image == nil { | ||
continue | ||
} | ||
if state, ok := nodeInfo.GetImageStates()[normalizedImageName(volume.Image.Reference)]; ok { | ||
sum += scaledImageScore(state, totalNumNodes) | ||
} | ||
} | ||
return sum | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.