Skip to content

Commit c1fe194

Browse files
authored
Merge pull request kubernetes#90771 from alculquicondor/api-comment
Clarify usage of MaxSkew and WhenUnsatisfiable
2 parents c0dab07 + 883e486 commit c1fe194

File tree

5 files changed

+37
-22
lines changed

5 files changed

+37
-22
lines changed

api/openapi-spec/swagger.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/core/types.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5176,8 +5176,8 @@ const (
51765176
// TopologySpreadConstraint specifies how to spread matching pods among the given topology.
51775177
type TopologySpreadConstraint struct {
51785178
// MaxSkew describes the degree to which pods may be unevenly distributed.
5179-
// It's the maximum permitted difference between the number of matching pods in
5180-
// any two topology domains of a given topology type.
5179+
// When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference
5180+
// between the number of matching pods in the target topology and the global minimum.
51815181
// For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same
51825182
// labelSelector spread as 1/1/0:
51835183
// +-------+-------+-------+
@@ -5189,6 +5189,8 @@ type TopologySpreadConstraint struct {
51895189
// scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2)
51905190
// violate MaxSkew(1).
51915191
// - if MaxSkew is 2, incoming pod can be scheduled onto any zone.
5192+
// When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence
5193+
// to topologies that satisfy it.
51925194
// It's a required field. Default value is 1 and 0 is not allowed.
51935195
MaxSkew int32
51945196
// TopologyKey is the key of node labels. Nodes that have a label with this key
@@ -5199,10 +5201,13 @@ type TopologySpreadConstraint struct {
51995201
TopologyKey string
52005202
// WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy
52015203
// the spread constraint.
5202-
// - DoNotSchedule (default) tells the scheduler not to schedule it
5203-
// - ScheduleAnyway tells the scheduler to still schedule it
5204-
// It's considered as "Unsatisfiable" if and only if placing incoming pod on any
5205-
// topology violates "MaxSkew".
5204+
// - DoNotSchedule (default) tells the scheduler not to schedule it.
5205+
// - ScheduleAnyway tells the scheduler to schedule the pod in any location,
5206+
// but giving higher precedence to topologies that would help reduce the
5207+
// skew.
5208+
// A constraint is considered "Unsatisfiable" for an incoming pod
5209+
// if and only if every possible node assigment for that pod would violate
5210+
// "MaxSkew" on some topology.
52065211
// For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same
52075212
// labelSelector spread as 3/1/1:
52085213
// +-------+-------+-------+

staging/src/k8s.io/api/core/v1/generated.proto

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/api/core/v1/types.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,8 +3072,8 @@ const (
30723072
// TopologySpreadConstraint specifies how to spread matching pods among the given topology.
30733073
type TopologySpreadConstraint struct {
30743074
// MaxSkew describes the degree to which pods may be unevenly distributed.
3075-
// It's the maximum permitted difference between the number of matching pods in
3076-
// any two topology domains of a given topology type.
3075+
// When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference
3076+
// between the number of matching pods in the target topology and the global minimum.
30773077
// For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same
30783078
// labelSelector spread as 1/1/0:
30793079
// +-------+-------+-------+
@@ -3085,6 +3085,8 @@ type TopologySpreadConstraint struct {
30853085
// scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2)
30863086
// violate MaxSkew(1).
30873087
// - if MaxSkew is 2, incoming pod can be scheduled onto any zone.
3088+
// When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence
3089+
// to topologies that satisfy it.
30883090
// It's a required field. Default value is 1 and 0 is not allowed.
30893091
MaxSkew int32 `json:"maxSkew" protobuf:"varint,1,opt,name=maxSkew"`
30903092
// TopologyKey is the key of node labels. Nodes that have a label with this key
@@ -3095,10 +3097,13 @@ type TopologySpreadConstraint struct {
30953097
TopologyKey string `json:"topologyKey" protobuf:"bytes,2,opt,name=topologyKey"`
30963098
// WhenUnsatisfiable indicates how to deal with a pod if it doesn't satisfy
30973099
// the spread constraint.
3098-
// - DoNotSchedule (default) tells the scheduler not to schedule it
3099-
// - ScheduleAnyway tells the scheduler to still schedule it
3100-
// It's considered as "Unsatisfiable" if and only if placing incoming pod on any
3101-
// topology violates "MaxSkew".
3100+
// - DoNotSchedule (default) tells the scheduler not to schedule it.
3101+
// - ScheduleAnyway tells the scheduler to schedule the pod in any location,
3102+
// but giving higher precedence to topologies that would help reduce the
3103+
// skew.
3104+
// A constraint is considered "Unsatisfiable" for an incoming pod
3105+
// if and only if every possible node assigment for that pod would violate
3106+
// "MaxSkew" on some topology.
31023107
// For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same
31033108
// labelSelector spread as 3/1/1:
31043109
// +-------+-------+-------+

staging/src/k8s.io/api/core/v1/types_swagger_doc_generated.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)