-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
KEP-3990: PodTopologySpread DoNotSchedule-to-ScheduleAnyway fallback mode #4150
base: master
Are you sure you want to change the base?
Conversation
sanposhiho
commented
Aug 12, 2023
- One-line PR description: PodTopologySpread DoNotSchedule-to-ScheduleAnyway fallback mode
- Issue link: PodTopologySpread DoNotSchedule-to-ScheduleAnyway fallback mode #3990
- Other comments:
3cb93d9
to
5318bd5
Compare
/assign @alculquicondor @MaciekPytel |
information to express the idea and why it was not acceptable. | ||
--> | ||
|
||
### introduce `DoNotScheduleUntilScaleUpFailed` and `DoNotScheduleUntilPreemptionFailed` |
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's a design similar to what we discussed in the issue. But, I switched this to fallbackCriteria
for the reason described here. Open for discussion about which design we should choose.
Even if the Pod is rejected by plugins other than Pod Topology Spread, | ||
when one of specified criteria is satisfied, the scheduler fallbacks from DoNotSchedule to ScheduleAnyway. | ||
|
||
One possible mitigation is to add `UnschedulablePlugins`, which equals to [QueuedPodInfo.UnschedulablePlugins](https://github.com/kubernetes/kubernetes/blob/8a7df727820bafed8cef27e094a0212d758fcd40/pkg/scheduler/framework/types.go#L180), to somewhere in Pod status |
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.
@alculquicondor What do you think?
@@ -0,0 +1,3 @@ | |||
kep-number: 3990 | |||
beta: | |||
approver: "@wojtek-t" |
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.
@wojtek-t I assigned it to you as other sig-scheduling KEPs do.
But, please reassign it to other people if needed. 🙏
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.
Just quickly skimmed through it - I will reviewer deeper when you will have buy-in from the SIG.
@@ -0,0 +1,3 @@ | |||
kep-number: 3990 | |||
beta: | |||
approver: "@wojtek-t" |
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.
Just quickly skimmed through it - I will reviewer deeper when you will have buy-in from the SIG.
#### the fallback could be done when it's actually not needed. | ||
|
||
Even if the Pod is rejected by plugins other than Pod Topology Spread, | ||
when one of specified criteria is satisfied, the scheduler fallbacks from DoNotSchedule to ScheduleAnyway. |
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 don't understand it - can you clarify?
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.
For example, let's say PodA has a required Pod Topology Spread with fallbackCriteria: ScaleUpFailed
. When PodA's first scheduling, all Nodes went through Pod Topology Spread filter plugin, but they were rejected by other plugins (e.g., the resource fit filter plugin because of insufficient resources.), and PodA got unschedulable state as a result. Then, the cluster autoscaler tried to create a new Node for PodA but it couldn't make it because of stockout.
In this case, Pod Topology Spread doesn't need to fallback actually because it said OK to all Nodes in the previous scheduling cycle -- meaning Pod Topology Spread isn't the cause of unschedulable in the past scheduling cycle and the fallback won't make PodA schedulable.
But, the problem is that Pod Topology Spread cannot see why this Pod was rejected in the previous scheduling cycle. It only understands that PodA was rejected by someone in the previous scheduling, and the cluster autoscaler couldn't create a new Node.
@@ -0,0 +1,35 @@ | |||
title: Pod Topology Spread DoNotSchedule to SchedulingAnyway fallback mode |
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.
nit:
title: Pod Topology Spread DoNotSchedule to SchedulingAnyway fallback mode | |
title: Pod Topology Spread DoNotSchedule to ScheduleAnyway fallback mode |
/cc @mwielgus |
|
||
A new field `fallbackCriteria` is introduced to `PodSpec.TopologySpreadConstraint[*]` | ||
to represent when to fallback from DoNotSchedule to ScheduleAnyway. | ||
It can contain two values: `ScaleUpFailed` to fallback when the cluster autoscaler fails to create new Node for Pods, |
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.
Could it not simply default to FailedScheduling
. As far as I know, ScaleUpFailed
is a cluster-autoscaler specific event so for those who use something else (e.g. karpenter), then this will not work.
One challenge with FailedScheduling
is that's what cluster-autoscaler reacts on so there could be a race condition in cluster-autoscaler scaling up vs. switching to fallback mode.
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.
This part only means that ScaleUpFailed
is a new value that will be added to fallbackCriteria
. Yes, I took this name from the cluster autoscaler's event name, but it should work with any cluster autoscaler if they update TriggeredScaleUp
Pod condition, which is also proposed in this KEP.
We had too much to bite in this cycle. This will have to wait for the next release :( Try to get some input from SIG Autoscaling in one of their meetings. |
Yes..
Sure. |
should be approved by the remaining approvers and/or the owning SIG (or | ||
SIG Architecture for cross-cutting KEPs). | ||
--> | ||
# KEP-3990: Pod Topology Spread DoNotSchedule to SchedulingAnyway fallback mode |
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.
Curious if there's an analogous use case for:
- Preferential node affinity
- Preferential pod affinity/antiaffinity
Is there any world where a user may want to have more control over how preferences are handled with autoscalers?
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.
if there's an analogous use case for:
Yes, might be. We would wait for the actual usecases from users before implementing the similar stuff in them though, we should make this design to be easy to follow in other scheduling constants
On the other hand, `FallBackCriteria` allows us to unify APIs in all scheduling constraints. | ||
We will just introduce `FallBackCriteria` field in them and there we 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.
This makes me think that we might want to model fallback criteria at the pod level.
preferentialFallback:
- PodAffinity
- AntiAffinity
- TopologySpreadConstraints
It may be difficult to get the granularity right, though. At another extreme (as you propose), you'd add a preference policy for each preferred term across the pod spec.
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.
That's an interesting idea.
Because when people want to use fallback, they may want to do the same in all required scheduling constraints the Pod has. Also, we may want to give preferentialFallback
the way to "fallback in all".
So, maybe it'd be like this:
preferentialFallback:
schedulingConstraints:
- "*" # do fallback in all scheduling constraints.
# You can also specify individual scheduling constraints name, which supports fallback.
# (But, note that this KEP's scope is only TopologySpread.)
fallBackCriteria:
- ScaleUpFailed
Let me include this idea in the alternative section for now. Like the idea of introducing enums, we can gather feedback from more people about the design choice among them.
Instead of `FallBackCriteria`, introduce `DoNotScheduleUntilScaleUpFailed` and `DoNotScheduleUntilPreemptionFailed` in `WhenUnsatisfiable`. | ||
`DoNotScheduleUntilScaleUpFailed` corresponds to `ScaleUpFailed`, | ||
and `DoNotScheduleUntilPreemptionFailed` corresponds to `PreemptionFailed`. |
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.
There are some benefits to reusing this an existing field with new enum values. I'm a touch concerned with how complicated topologyspreadconstraints are getting, with two new honor
fields (with different defaults).
I interact with a bunch of customers who are learning kubernetes scheduling for the first time when onboarding to Karpenter, and communicating the complexity and gotchas of topology is always a huge hurdle to get over.
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.
Obviously, I agree that we need to make it easy to understand as much as possible. But, also introducing a new field doesn't always result in confusion.
For this particular KEP, I think FallBackCriteria
is not much more complicated than introducing new enum values in WhenUnsatisfiable. Then, currently I'm leaning towards FallBackCriteria
for the ease to introduce it into other scheduling constraints, as described.
But, maybe I'm biased since I know the scheduler/CA, I know everything that this KEP wants to do, etc. 😅
So, I'd like to keep this discussion open to gather more feedback from reviewers.
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 agree that topologyspreadconstraints are difficult to explain to clients (been there), but I think this added field is optional complexity. It is also the other way around, right? It is a complex solution to a complex setup, but the complex setup came first. Clients that need to hear this are already dealing with specific cases that call for all of this, and in theory are easier to talk to. Also agree that I don't see it as easier to explain when considering existing field with new enum values, so I guess that if it is hard to explain, it would be hard either way.
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.
apparently i wrote this a while ago...
keps/sig-scheduling/3990-pod-topology-spread-fallback-mode/README.md
Outdated
Show resolved
Hide resolved
keps/sig-scheduling/3990-pod-topology-spread-fallback-mode/README.md
Outdated
Show resolved
Hide resolved
keps/sig-scheduling/3990-pod-topology-spread-fallback-mode/README.md
Outdated
Show resolved
Hide resolved
keps/sig-scheduling/3990-pod-topology-spread-fallback-mode/README.md
Outdated
Show resolved
Hide resolved
keps/sig-scheduling/3990-pod-topology-spread-fallback-mode/README.md
Outdated
Show resolved
Hide resolved
keps/sig-scheduling/3990-pod-topology-spread-fallback-mode/README.md
Outdated
Show resolved
Hide resolved
Describing the current situation here: I brought this KEP into SIG/Autoscaling weekly meeting a couple of months ago, and concluded that we had to consider how CA set
Not sure if we'll make it in this release though, I'll spend some time on this KEP in this release cycle as well - I'll go around CA's implementation to understand scenarios there myself, and elaborate the KEP around there. Thanks for several feedback so far, I'll bring the fixes towards all at the same time. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sanposhiho The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
77ba939
to
a545da3
Compare
a545da3
to
ea3fc17
Compare
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
ea3fc17
to
2d8f39b
Compare
2d8f39b
to
9db7b55
Compare
@MaciekPytel can you (or assign someone to) review this KEP from the autoscaling (CA) PoV? |
@sanposhiho I can take a look from SIG autoscaling PoV, but late next week at the earliest (busy with some last-minute 1.32 changes in CA right now). |
Thanks @towca for picking it up! |