Skip to content

Commit edf5578

Browse files
authored
Merge pull request #3261 from kerthcet/feature/update-nodeInclusionPolicy
KEP-3094: update NodeInclusionPolicyInPodTopologySpread details
2 parents 919032d + 2a68916 commit edf5578

File tree

2 files changed

+42
-38
lines changed

2 files changed

+42
-38
lines changed

keps/sig-scheduling/3094-pod-topology-spread-considering-taints/README.md

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ List the specific goals of the KEP. What is it trying to achieve? How will we
198198
know that this has succeeded?
199199
-->
200200

201-
- Introduce a new struct to define all node inclusion policies explicitly
201+
- Introduce two new fields to define all node inclusion policies explicitly
202202
- Provide an option for end-users to specify whether to respect taints or not
203203

204204
### Non-Goals
@@ -219,7 +219,7 @@ implementation. What is the desired outcome and how do we measure success?.
219219
The "Design Details" section below is for the real
220220
nitty-gritty.
221221
-->
222-
Introduce a new field to `TopologySpreadConstraint` to define all node inclusion
222+
Introduce two new fields to `TopologySpreadConstraint` to define all node inclusion
223223
policies including nodeAffinity and nodeTaint.
224224

225225
### User Stories (Optional)
@@ -271,40 +271,42 @@ required) or even code snippets. If there's any ambiguity about HOW your
271271
proposal will be implemented, this is the place to discuss them.
272272
-->
273273

274-
A new field named `NodeInclusionPolicies` will be introduced to `TopologySpreadConstraint`:
274+
Two new fields named `NodeAffinityPolicy` and `NodeTaintsPolicy` will be
275+
introduced to `TopologySpreadConstraint`:
275276
```golang
276277
type TopologySpreadConstraint struct {
277-
// NodeInclusionPolicies includes several policies
278-
// when calculating pod topology spread skew
279-
NodeInclusionPolicies NodeInclusionPolicies
278+
// NodeAffinityPolicy indicates how we will treat Pod's nodeAffinity/nodeSelector
279+
// when calculating pod topology spread skew. Options are:
280+
// - Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations.
281+
// - Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations.
282+
//
283+
// If this value is nil, the behavior is equivalent to the Honor policy.
284+
// This is a alpha-level feature enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
285+
// +optional
286+
NodeAffinityPolicy *NodeInclusionPolicy
287+
// NodeTaintsPolicy indicates how we will treat node taints when calculating
288+
// pod topology spread skew. Options are:
289+
// - Honor: nodes without taints, along with tainted nodes for which the incoming pod
290+
// has a toleration, are included.
291+
// - Ignore: node taints are ignored. All nodes are included.
292+
//
293+
// If this value is nil, the behavior is equivalent to the Ignore policy.
294+
// This is a alpha-level feature enabled by the NodeInclusionPolicyInPodTopologySpread feature flag.
295+
// +optional
296+
NodeTaintsPolicy *NodeInclusionPolicy
280297
}
281298
```
282299

283-
There are two policies now regarding to nodeAffinity and nodeTaint:
300+
We will define two NodeInclusionPolicy:
284301
```golang
285-
type NodeInclusionPolicies struct {
286-
// NodeAffinity policy indicates how we will treat nodeAffinity/nodeSelector
287-
// when calculating pod topology spread skew. The semantics vary by PolicyName:
288-
// - Respect (default): nodes matching nodeAffinity/nodeSelector will be included.
289-
// - Ignore: all nodes will be included.
290-
NodeAffinity PolicyName
291-
// NodeTaint policy indicates how we will treat node taints
292-
// when calculating pod topology spread skew. The semantics vary by PolicyName:
293-
// - Respect: tainted nodes that tolerate the incoming pod, along with regular nodes, will be included.
294-
// - Ignore (default): all nodes will be included.
295-
NodeTaint PolicyName
296-
}
297-
```
298-
299-
We will define two policyNames by default:
300-
```golang
301-
type PolicyName string
302+
// NodeInclusionPolicy defines the type of node inclusion policy
303+
type NodeInclusionPolicy string
302304

303305
const (
304-
// Ignore means ignore this policy in calculating.
305-
Ignore PolicyName = "Ignore"
306-
// Respect means use this policy in calculating.
307-
Respect PolicyName = "Respect"
306+
// NodeInclusionPolicyIgnore means ignore this scheduling policy when calculating pod topology spread skew.
307+
NodeInclusionPolicyIgnore NodeInclusionPolicy = "Ignore"
308+
// NodeInclusionPolicyHonor means use this scheduling policy when calculating pod topology spread skew.
309+
NodeInclusionPolicyHonor NodeInclusionPolicy = "Honor"
308310
)
309311
```
310312

@@ -334,7 +336,7 @@ when drafting this test plan.
334336
- Unit and integration tests:
335337
- Defaulting and validation tests
336338
- Feature gate enable/disable tests
337-
- `NodeInclusionPolicies` works as expected
339+
- `NodeAffinityPolicy` and `NodeTaintsPolicy` work as expected
338340
- Benchmark tests:
339341
- Verify the performance of looping all toleration and taints in calculating skew is acceptable
340342

@@ -426,8 +428,9 @@ enhancement:
426428
-->
427429

428430
- Upgrade
429-
- While the feature gate is enabled, `NodeInclusionPolicies` is allowed to use by end-users.
430-
- While the feature gate is enabled, and we don't set this field, default values
431+
- While the feature gate is enabled, `NodeAffinityPolicy` and `NodeTaintsPolicy` are
432+
allowed to use by end-users.
433+
- While the feature gate is enabled, and we don't set these two fields, default values
431434
will be configured, which will maintain previous behavior.
432435
- Downgrade
433436
- Previously configured values will be ignored.
@@ -485,7 +488,7 @@ Pick one of these and delete the rest.
485488
-->
486489

487490
- [x] Feature gate (also fill in values in `kep.yaml`)
488-
- Feature gate name: PodTopologySpreadNodePolicies
491+
- Feature gate name: NodeInclusionPolicyInPodTopologySpread
489492
- Components depending on the feature gate: kube-scheduler, kube-apiserver
490493

491494
###### Does enabling the feature change any default behavior?
@@ -578,8 +581,9 @@ Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
578581
checking if there are objects with field X set) may be a last resort. Avoid
579582
logs or events for this purpose.
580583
-->
581-
Operator can query `pod.spec.topologySpreadConstraints[].NodeInclusionPolicies` field
582-
and identify if this is set to non-default values
584+
Operator can query `pod.spec.topologySpreadConstraints[].NodeAffinityPolicy`
585+
and `pod.spec.topologySpreadConstraints[].NodeAffinityPolicy` to identify whether
586+
this is set to non-default values
583587

584588
###### How can someone using this feature know that it is working for their instance?
585589

keps/sig-scheduling/3094-pod-topology-spread-considering-taints/kep.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ stage: alpha
3030
# The most recent milestone for which work toward delivery of this KEP has been
3131
# done. This can be the current (upcoming) milestone, if it is being actively
3232
# worked on.
33-
latest-milestone: "v1.24"
33+
latest-milestone: "v1.25"
3434

3535
# The milestone at which this feature was, or is targeted to be, at each stage.
3636
milestone:
37-
alpha: "v1.24"
38-
beta: "v1.25"
37+
alpha: "v1.25"
38+
beta: "v1.26"
3939
stable: ""
4040

4141
# The following PRR answers are required at alpha release
4242
# List the feature gate name and the components for which it must be enabled
4343
feature-gates:
44-
- name: PodTopologySpreadNodePolicies
44+
- name: NodeInclusionPolicyInPodTopologySpread
4545
components:
4646
- kube-apiserver
4747
- kube-scheduler

0 commit comments

Comments
 (0)