Skip to content

Commit fbd534d

Browse files
committed
Document the new NodeInclusionPolicyInPodTopologySpread feature gate
Signed-off-by: kerthcet <[email protected]>
1 parent eac909a commit fbd534d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

content/en/docs/concepts/workloads/pods/pod-topology-spread-constraints.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ spec:
6868
topologyKey: <string>
6969
whenUnsatisfiable: <string>
7070
labelSelector: <object>
71+
nodeAffinityPolicy: <string> # optional; alpha since v1.25
72+
nodeTaintsPolicy: <string> # optional; alpha since v1.25
7173
```
7274
7375
You can define one or multiple `topologySpreadConstraint` to instruct the kube-scheduler how to place each incoming Pod in relation to the existing Pods across your cluster. The fields are:
@@ -93,7 +95,7 @@ You can define one or multiple `topologySpreadConstraint` to instruct the kube-s
9395
Pod topology spread treats "global minimum" as 0, and then the calculation of `skew` is performed.
9496
The "global minimum" is the minimum number of matching Pods in an eligible domain,
9597
or zero if the number of eligible domains is less than `minDomains`.
96-
- When the number of eligible domains with matching topology keys equals or is greater than
98+
- When the number of eligible domains with matching topology keys equals or is greater than
9799
`minDomains`, this value has no effect on scheduling.
98100
- When `minDomains` is nil, the constraint behaves as if `minDomains` is 1.
99101
- When `minDomains` is not nil, the value of `whenUnsatisfiable` must be "`DoNotSchedule`".
@@ -112,6 +114,33 @@ You can define one or multiple `topologySpreadConstraint` to instruct the kube-s
112114

113115
- **labelSelector** is used to find matching Pods. Pods that match this label selector are counted to determine the number of Pods in their corresponding topology domain. See [Label Selectors](/docs/concepts/overview/working-with-objects/labels/#label-selectors) for more details.
114116

117+
- **nodeAffinityPolicy** indicates how we will treat Pod's nodeAffinity/nodeSelector
118+
when calculating pod topology spread skew. Options are:
119+
- Honor: only nodes matching nodeAffinity/nodeSelector are included in the calculations.
120+
- Ignore: nodeAffinity/nodeSelector are ignored. All nodes are included in the calculations.
121+
122+
If this value is nil, the behavior is equivalent to the Honor policy.
123+
124+
{{< note >}}
125+
The `nodeAffinityPolicy` is an alpha-level field added in 1.25. You have to enable the
126+
`NodeInclusionPolicyInPodTopologySpread` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
127+
in order to use it.
128+
{{< /note >}}
129+
130+
- **nodeTaintsPolicy** indicates how we will treat node taints when calculating
131+
pod topology spread skew. Options are:
132+
- Honor: nodes without taints, along with tainted nodes for which the incoming pod
133+
has a toleration, are included.
134+
- Ignore: node taints are ignored. All nodes are included.
135+
136+
If this value is nil, the behavior is equivalent to the Ignore policy.
137+
138+
{{< note >}}
139+
The `nodeTaintsPolicy` is an alpha-level field added in 1.25. You have to enable the
140+
`NodeInclusionPolicyInPodTopologySpread` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
141+
in order to use it.
142+
{{< /note >}}
143+
115144
When a Pod defines more than one `topologySpreadConstraint`, those constraints are ANDed: The kube-scheduler looks for a node for the incoming Pod that satisfies all the constraints.
116145

117146
You can read more about this field by running `kubectl explain Pod.spec.topologySpreadConstraints`.

content/en/docs/reference/command-line-tools-reference/feature-gates.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ different Kubernetes components.
156156
| `NetworkPolicyEndPort` | `false` | Alpha | 1.21 | 1.21 |
157157
| `NetworkPolicyEndPort` | `true` | Beta | 1.22 | |
158158
| `NetworkPolicyStatus` | `false` | Alpha | 1.24 | |
159+
| `NodeInclusionPolicyInPodTopologySpread` | `false` | Alpha | 1.25 |
159160
| `NodeSwap` | `false` | Alpha | 1.22 | |
160161
| `NodeOutOfServiceVolumeDetach` | `false` | Alpha | 1.24 | |
161162
| `OpenAPIEnums` | `false` | Alpha | 1.23 | 1.23 |
@@ -1007,6 +1008,9 @@ Each feature gate is designed for enabling/disabling a specific feature:
10071008
- `NetworkPolicyEndPort`: Enable use of the field `endPort` in NetworkPolicy objects,
10081009
allowing the selection of a port range instead of a single port.
10091010
- `NetworkPolicyStatus`: Enable the `status` subresource for NetworkPolicy objects.
1011+
- `NodeInclusionPolicyInPodTopologySpread`: Enable using `nodeAffinityPolicy` and `nodeTaintsPolicy`
1012+
in Pod [topology spread constraints](/docs/concepts/workloads/pods/pod-topology-spread-constraints/)
1013+
when calculating pod topology spread skew.
10101014
- `NodeDisruptionExclusion`: Enable use of the Node label `node.kubernetes.io/exclude-disruption`
10111015
which prevents nodes from being evacuated during zone failures.
10121016
- `NodeLease`: Enable the new Lease API to report node heartbeats, which could be used as a node health signal.

0 commit comments

Comments
 (0)