Skip to content
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

Open
wants to merge 5 commits into
base: dev/pod-affinity
Choose a base branch
from

Conversation

slipegg
Copy link

@slipegg slipegg commented Oct 31, 2024

No description provided.

@slipegg slipegg requested a review from NickrenREN as a code owner October 31, 2024 12:01
BinderCommonStateKey = "BinderCommonState"
)

type CommonState struct {
Copy link
Contributor

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

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Author

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)
Copy link
Contributor

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()

Copy link
Author

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 {
Copy link
Contributor

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.

Copy link
Author

@slipegg slipegg Nov 6, 2024

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.

@slipegg slipegg force-pushed the dev/pod-affinity-victim branch from 00448b1 to b989389 Compare November 6, 2024 14:58
@rookie0080
Copy link
Contributor

rookie0080 commented Nov 28, 2024

lgtm, cc @binacs . Testing doc: https://xeh61jru4u.feishu.cn/docx/NwrMdx3Hjoi47fxXJf4cXNNOnof. The testing cases related to preemption are at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants