-
Notifications
You must be signed in to change notification settings - Fork 76
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
Support update state by victims in binder for InterPodAffinity and PodTopologySpread plugins #66
base: dev/pod-affinity
Are you sure you want to change the base?
Support update state by victims in binder for InterPodAffinity and PodTopologySpread plugins #66
Conversation
…and PodTopologySpread plugins
BinderCommonStateKey = "BinderCommonState" | ||
) | ||
|
||
type CommonState struct { |
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.
It seems that we don't need this struct, writing victimsGroupsByNode
directly is okay. And it's better to put these codes in pkg/framework/api/common_state.go
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.
We cannot write victimsGroupsByNode
directly in cycleState
because cycleState
requires the data structure to implement the Clone
function. But victimsGroupsByNode
is just a map
and does not implement the Clone
function.
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.
You can define a struct that directly corresponds to victimsGroupsByNode
instead of encapsulating it in CommonState
.
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.
I have moved these cycleState
related functions to framework/api/common_state.go
so that it is more in line with the specifications of previous codes.
continue | ||
} | ||
|
||
splitPlods, err := binderutils.SplitPods(victimsMap) |
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.
typo: splitPlods -> launcherToPods.
And an advice: SplitPods() -> GroupPodsByLauncher()
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.
Thanks! I have changed the names of both.
@@ -83,3 +93,29 @@ func New(_ runtime.Object, handle handle.BinderFrameworkHandle) (framework.Plugi | |||
frameworkHandle: handle, | |||
}, nil | |||
} | |||
|
|||
func (pl *InterPodAffinity) updateStateByVictims(state *utils.PreFilterState, handle handle.BinderFrameworkHandle, victimsGroupByNode map[string]map[types.UID]*v1.Pod, targetPod *v1.Pod) error { |
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.
It doesn't need to be a function of pl. Or remove the parameter handle
.
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.
I have removed the parameter handle
. Because similar functions AddPod
and RemovePod
in shceduler are also functions of plugin itself.
00448b1
to
b989389
Compare
lgtm, cc @binacs . Testing doc: https://xeh61jru4u.feishu.cn/docx/NwrMdx3Hjoi47fxXJf4cXNNOnof. The testing cases related to preemption are at the end. |
No description provided.