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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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
Comment on lines +181 to +186
for i := 0; i < 2; i++ {
podPassedGroup = append(podPassedGroup, MustCreatePod(ctx, MakePod(DefaultNs, fmt.Sprintf("passed-pod%d", i), "100m").Annotation(groupNameAnnotation, "passed").Label(throttleKey, throttleName).Obj()))
}
for i := 0; i < 3; i++ {
podThrottledGroup = append(podThrottledGroup, MustCreatePod(ctx, MakePod(DefaultNs, fmt.Sprintf("throttled-pod%d", i), "100m").Annotation(groupNameAnnotation, "throttled").Label(throttleKey, throttleName).Obj()))
}

Choose a reason for hiding this comment

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

I guess we need to wait for all pods in podPassedGroup to be scheduled before creating pods in podThrottledGroup.
Otherwise, pods in podThrottledGroup can be scheduled before podPassedGroup.

),
func(g types.Gomega) {
for _, pod := range podPassedGroup {
PodIsScheduled(ctx, DefaultNs, pod.Name)

Choose a reason for hiding this comment

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

Does this line work?
Returned value from the PodIsScheduled seems not to be used 🤔

Same for MustPodFailedScheduling, PodIsScheduled below.

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