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

ClusterThrottles support PodGroup aka Gang #12

Merged
merged 10 commits into from
Sep 6, 2024
Merged

Conversation

utam0k
Copy link
Member

@utam0k utam0k commented Jul 17, 2024

Scheduling methods like PodGroup and Gang require not only a scheduling pod but also all the resources of a pod group. kube-throttler needs to take this into consideration in PreFilter in order to reduce wasted scheduling cycles and preemptions.

This pull request allows us to reject a scheduling pod that is part of a pod group if the remaining resources are insufficient to schedule the entire PodGroup.

@utam0k utam0k requested a review from shioshiota July 17, 2024 23:58
@utam0k utam0k force-pushed the group-pods-cluster branch 3 times, most recently from f3f5a5f to 03a069e Compare July 18, 2024 00:37
Signed-off-by: utam0k <[email protected]>
@utam0k utam0k requested review from ordovicia and removed request for shioshiota July 18, 2024 00:59
@utam0k utam0k requested a review from ordovicia July 18, 2024 07:20
pkg/controllers/clusterthrottle_controller.go Outdated Show resolved Hide resolved
pkg/controllers/clusterthrottle_controller.go Outdated Show resolved Hide resolved
Comment on lines +435 to +438
ns, err := c.namespaceInformer.Lister().Get(groupPod.Namespace)
if err != nil {
return nil, nil, nil, nil, nil, err
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All pods in a group have the same namespace, so these lines can be moved out of the for-loop

Copy link
Member Author

@utam0k utam0k Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I don't assume the premise that all pods in a group are in the same namespace. This is because this assumption doesn't allow us to improve its implementation and performance that much better than the current implementation in this PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because this assumption doesn't allow us to improve its implementation and performance that much better than the current implementation in this PR.

Understood.
But, the current implementation assumes all pods in a group are in the same namespace, IIUC.

candidatePods, err := c.podInformer.Lister().Pods(pod.Namespace).List(labels.Everything())

We can modify the implementation to fetch the namespace for each pod in a group in the future when we remove this assumption?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I had missed it. Doing so would have meant exploring all the namespace pods, which would have had a huge impact on performance. I still think you are right, let's assume they are in the same namespace.

pkg/controllers/clusterthrottle_controller.go Outdated Show resolved Hide resolved
test/integration/clusterthrottle_test.go Outdated Show resolved Hide resolved
Co-authored-by: Hidehito Yabuuchi <[email protected]>
Signed-off-by: utam0k <[email protected]>
@utam0k utam0k requested a review from ordovicia July 19, 2024 00:05
Copy link

@ordovicia ordovicia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for a small comment.
Thank you for the nice work!

Comment on lines +219 to +221
for _, pod := range podPassedGroup {
Eventually(PodIsScheduled(ctx, DefaultNs, pod.Name)).Should(Succeed())
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicate with L236-240.
Either can be deleted.

@utam0k utam0k merged commit 00aba44 into master Sep 6, 2024
4 checks passed
@utam0k utam0k deleted the group-pods-cluster branch September 6, 2024 02:03
@github-actions github-actions bot mentioned this pull request Sep 6, 2024
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