@@ -168,10 +168,8 @@ updates.
168
168
169
169
[documentation style guide]: https://github.com/kubernetes/community/blob/master/contributors/guide/style-guide.md
170
170
-->
171
- This KEP introduces a new field as an option for end-users to honor all taints or
172
- only system-generated unschedulable taints when computing pod topology spread skew.
173
- This helps improving the scheduling efficiency by filtering out nodes don't meet the
174
- toleration requirements.
171
+ This KEP introduces an option for end-users to specify whether to take taints/tolerations
172
+ into consideration when calculating pod topology spread skew.
175
173
176
174
## Motivation
177
175
@@ -183,31 +181,32 @@ demonstrate the interest in a KEP within the wider Kubernetes community.
183
181
184
182
[experience reports]: https://github.com/golang/go/wiki/ExperienceReports
185
183
-->
186
- Currently, when we compute pod topology spread skew, we will ignore the impact of
187
- node taints whatever pod tolerates or not, which may lead to some unexpected results.
188
- E.g. node with pod untolerated taints might be the candidate node after computing,
189
- then the pod would be stuck in Pending state. So toleration/taints should be taken into
190
- consideration when computing pod topology spread skew. For backwards compatibility,
191
- we'd like to define this as an option for end-users to honor all taints or
192
- only system-generated unschedulable taints.
184
+ Currently in calculating pod topology spread skew, we will ignore node taints
185
+ as node with pod untolerated taints will also be taken into calculation. This
186
+ behavior doesn't match user expectations and will lead pod to unexpected Pending
187
+ state(See [ issue] ( https://github.com/kubernetes/kubernetes/issues/106127 ) ).
188
+
189
+ Besides, given that we have already some node inclusion policies(nodeAffinity/nodeSelector)
190
+ plumbed into PodTopologySpread implicitly, we'd like to redefine all of them into
191
+ a new struct explicitly this time.
193
192
194
193
### Goals
195
194
196
195
<!--
197
196
List the specific goals of the KEP. What is it trying to achieve? How will we
198
197
know that this has succeeded?
199
198
-->
200
- - Filtering out pod untolerated nodes when computing pod topology spread skew
201
- - Provide an option for end-users to specify whether to honor all taints or
202
- only system-generated unschedulable taints
199
+
200
+ - Introduce a new struct to define all node inclusion policies explicitly
201
+ - Provide an option for end-users to specify whether to respect taints or not
203
202
204
203
### Non-Goals
205
204
206
205
<!--
207
206
What is out of scope for this KEP? Listing non-goals helps to focus discussion
208
207
and make progress.
209
208
-->
210
- - Refactor or introduce any breaking changes to PodTopologySpread plugin
209
+ - Support customized taints in array
211
210
212
211
## Proposal
213
212
@@ -219,8 +218,8 @@ implementation. What is the desired outcome and how do we measure success?.
219
218
The "Design Details" section below is for the real
220
219
nitty-gritty.
221
220
-->
222
- A new field ` TaintStrategy ` defined in ` TopologySpreadConstraint ` will be available for
223
- end-users to specify different strategies about how to treat taints in computing skew .
221
+ Introduce a new field to ` TopologySpreadConstraint ` to define all node inclusion
222
+ policies including nodeAffinity and nodeTaint .
224
223
225
224
### User Stories (Optional)
226
225
@@ -232,23 +231,8 @@ bogged down.
232
231
-->
233
232
234
233
#### Story 1
235
- When computing pod topology spread skew, I want to exclude nodes that don't tolerate
236
- all taints to prevent pods from falling into unexpected Pending state. I can simply
237
- configure this by specifying a taintStrategy:
238
-
239
- apiVersion: v1
240
- kind: Pod
241
- metadata:
242
- name: mypod
243
- spec:
244
- topologySpreadConstraints:
245
- - maxSkew: 1
246
- topologyKey: zone
247
- whenUnsatisfiable: DoNotSchedule
248
- labelSelector:
249
- matchLabels:
250
- foo: bar
251
- taintStrategy: "honorAllTaints"
234
+ When calculating pod topology spread skew, I want to exclude nodes that don't tolerate
235
+ all taints to prevent pods from falling into unexpected Pending state.
252
236
253
237
### Notes/Constraints/Caveats (Optional)
254
238
@@ -275,8 +259,6 @@ Consider including folks who also work outside the SIG or subproject.
275
259
276
260
- Looping all the toleration/taints to filter out unsatisfied nodes may
277
261
lead to performance problem.
278
- - Some usual schedulable nodes may become unschedulable, which might be
279
- confusing for end-users.
280
262
281
263
## Design Details
282
264
@@ -287,40 +269,38 @@ required) or even code snippets. If there's any ambiguity about HOW your
287
269
proposal will be implemented, this is the place to discuss them.
288
270
-->
289
271
290
- A new field named ` TaintStrategy ` will be introduced to ` TopologySpreadConstraint ` :
291
-
292
- type TopologySpreadConstraint struct {
293
- MaxSkew int32
294
- TopologyKey string
295
- WhenUnsatisfiable UnsatisfiableConstraintAction
296
- LabelSelector *metav1.LabelSelector
297
- TaintStrategy taintStrategy
298
- }
299
-
300
- Correspondingly, the internal version for v1.TopologySpreadConstraint named
301
- ` topologySpreadConstraint ` will also add a ` TaintStrategy ` field:
302
-
303
- type topologySpreadConstraint struct {
304
- MaxSkew int32
305
- TopologyKey string
306
- Selector labels.Selector
307
- TaintStrategy taintStrategy
308
- }
309
-
310
- ` taintStrategy ` is a potential type of ` String ` , and there are two available options
311
- for users.
312
-
313
- One is ` honorAllTaints ` which means when computing pod topology spread skew,
314
- all kinds of node taints should be taken into consideration, if any of these taints pod
315
- doesn't tolerate, the node is excluded.
272
+ A new field named ` NodeInclusionPolicies ` will be introduced to ` TopologySpreadConstraint ` :
273
+ ``` golang
274
+ type TopologySpreadConstraint struct {
275
+ // NodeInclusionPolicies includes several policies
276
+ // when calculating pod topology spread skew
277
+ NodeInclusionPolicies nodeInclusionPolicies
278
+ }
279
+ ```
316
280
317
- The other one is ` honorUnschedulableTaint ` , which means instead of considering all taints
318
- node carried, we only concern about taint ` node.kubernetes.io/unschedulable:NoSchedule ` .
281
+ There are two policies now regarding to nodeAffinity and nodeTaint:
282
+ ``` golang
283
+ type nodeInclusionPolicies struct {
284
+ // Respect nodeAffinity/nodeSelector or not in calculating.
285
+ // By default we will respect this policy.
286
+ nodeAffinityPolicy policyName
287
+ // Respect all nodeTaints or not in calculating.
288
+ // By default we will ignore this policy to maintain current behavior.
289
+ nodeTaintPolicy policyName
290
+ }
291
+ ```
319
292
320
- This behavior is controlled by feature gate ` TaintStrategy ` , if this feature gate is on
321
- and ` TaintStrategy ` doesn't set, ` honorAllTaints ` will take effect by default.
293
+ We will define two policyNames by default:
294
+ ``` golang
295
+ type policyName string
322
296
323
- We'd like to implement this part of logic before computing skew for code efficiency.
297
+ const (
298
+ // Ignore means ignore this policy in calculating.
299
+ ignore policyName = " ignore"
300
+ // Respect means use this policy in calculating.
301
+ respect policyName = " respect"
302
+ )
303
+ ```
324
304
325
305
### Test Plan
326
306
@@ -343,10 +323,11 @@ when drafting this test plan.
343
323
-->
344
324
- Unit and integration tests:
345
325
- Defaulting and validation tests
346
- - Feature gate enable/disable tests.
347
- - ` TaintStrategy ` works as expected
326
+ - Feature gate enable/disable tests
327
+ - ` nodeAffinityPolicy ` works as expected
328
+ - ` nodeTaintPolicy ` works as expected
348
329
- Benchmark tests:
349
- - Verify the performance of looping all toleration and taints in computing skew is acceptable
330
+ - Verify the performance of looping all toleration and taints in calculating skew is acceptable
350
331
351
332
### Graduation Criteria
352
333
@@ -411,12 +392,12 @@ in back-to-back releases.
411
392
-->
412
393
#### Alpha
413
394
- Feature implemented behind feature gate.
414
- - Test cases mentioned in Test Plan
395
+ - Unit and integration tests passed.
415
396
416
397
#### Beta
417
398
- Feature is enabled by default
399
+ - Benchmark tests passed, and there is no performance problem.
418
400
- Gather feedback from developers and surveys.
419
- - No performance problem.
420
401
421
402
#### GA
422
403
- No negative feedback.
@@ -436,15 +417,12 @@ enhancement:
436
417
-->
437
418
438
419
- Upgrade
439
- - While the feature gate is disabled, field ` TaintStrategy ` will be ignored.
440
- - While the feature gate is enabled, ` TaintStrategy ` provides two optional values
441
- for end-users to specify how to treat node taints.
442
- - While the feature gate is enabled, and we don't set this field, ` taintStrategy ` of
443
- ` honorAllTaints ` will take effect by default.
420
+ - While the feature gate is disabled, field ` NodeInclusionPolicies ` will be ignored.
421
+ - While the feature gate is enabled, ` NodeInclusionPolicies ` is allowed to use by end-users.
422
+ - While the feature gate is enabled, and we don't set this field, default values
423
+ will be configured, which will maintain previous behavior.
444
424
- Downgrade
445
- - Whatever we enable/disable feature gate, previously configured values will
446
- be ignored.
447
-
425
+ - Whatever we enable/disable feature gate, previously configured values will be ignored.
448
426
449
427
### Version Skew Strategy
450
428
N/A
@@ -499,30 +477,16 @@ Pick one of these and delete the rest.
499
477
-->
500
478
501
479
- [x] Feature gate (also fill in values in ` kep.yaml ` )
502
- - Feature gate name: TaintStrategy
480
+ - Feature gate name: PodTopologySpreadTaintPolicy
503
481
- Components depending on the feature gate: kube-scheduler, kube-apiserver
504
- - [x] Other
505
- - Describe the mechanism:
506
-
507
- Specify strategy about how to treat taints.
508
-
509
- - Will enabling / disabling the feature require downtime of the control
510
- plane?
511
-
512
- Yes.
513
-
514
- - Will enabling / disabling the feature require downtime or reprovisioning
515
- of a node? (Do not assume ` Dynamic Kubelet Config ` feature is enabled).
516
-
517
- No.
518
482
519
483
###### Does enabling the feature change any default behavior?
520
484
521
485
<!--
522
486
Any change of default behavior may be surprising to users or break existing
523
487
automations, so be extremely careful here.
524
488
-->
525
- Yes, some usual schedulable nodes might be unschedulable .
489
+ No .
526
490
527
491
###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)?
528
492
@@ -605,8 +569,8 @@ Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
605
569
checking if there are objects with field X set) may be a last resort. Avoid
606
570
logs or events for this purpose.
607
571
-->
608
- Operator can query ` pod.spec.topologySpreadConstraints[].taintStrategy ` field
609
- and identify if this is set.
572
+ Operator can query ` pod.spec.topologySpreadConstraints[].NodeInclusionPolicies ` field
573
+ and identify if this is set to non-default values
610
574
611
575
###### How can someone using this feature know that it is working for their instance?
612
576
@@ -626,7 +590,6 @@ Recall that end users cannot usually observe component logs or access metrics.
626
590
- Other field:
627
591
- [ ] Other (treat as last resort)
628
592
- Details: -->
629
-
630
593
N/A
631
594
632
595
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
@@ -832,7 +795,7 @@ Major milestones might include:
832
795
- when the KEP was retired or superseded
833
796
-->
834
797
835
- - 2021.01.05 : KEP proposed for review, including motivation, proposal, risks,
798
+ - 2021.01.12 : KEP proposed for review, including motivation, proposal, risks,
836
799
test plan and graduation criteria.
837
800
838
801
## Drawbacks
0 commit comments