You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-scheduling/3243-respect-pod-topology-spread-after-rolling-upgrades/README.md
+25-11Lines changed: 25 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -381,6 +381,10 @@ creation will be rejected by kube-apiserver.
381
381
Also kube-scheduler will ignore `matchLabelKeys` in the cluster-level default constraints configuration.
382
382
383
383
### [v1.33] design change and a safe upgrade path
384
+
Previously, only kube-scheduler handled `matchLabelKeys`.
385
+
But, we changed the design to make both kube-apiserver and kube-scheduler handle `matchLabelKeys`
386
+
for the reason described in [implement MatchLabelKeys in only either the scheduler plugin or kube-apiserver](#implement-matchlabelkeys-in-only-either-the-scheduler-plugin-or-kube-apiserver).
387
+
384
388
kube-apiserver will only merge key-value labels corresponding to `matchLabelKeys` into `labelSelector`
385
389
at pods creation, and it will not affect the existing pods.
386
390
So if there are unscheduled pods with `matchLabelKeys` which are already created when upgrading cluster,
@@ -586,7 +590,9 @@ enhancement:
586
590
- Will any other components on the node change? For example, changes to CSI,
587
591
CRI or CNI may require updating that component before the kubelet.
588
592
-->
589
-
N/A
593
+
594
+
To ensure a safe upgrade path from v1.32 to v1.33, we plan to change the design between v1.33 and v1.34.
595
+
For more details, please refer to the section [[v1.33] design change and a safe upgrade path](#v133-design-change-and-a-safe-upgrade-path).
590
596
591
597
## Production Readiness Review Questionnaire
592
598
@@ -806,7 +812,10 @@ Recall that end users cannot usually observe component logs or access metrics.
806
812
-->
807
813
808
814
- [x] Other (treat as last resort)
809
-
- Details: We can determine if this feature is being used by checking deployments that have only `MatchLabelKeys` set in `TopologySpreadConstraint` and no `LabelSelector`. These Deployments will strictly adhere to TopologySpread after both deployment and rolling upgrades if the feature is being used.
815
+
- Details:
816
+
This feature doesn't cause any logs, any events, any pod status updates.
817
+
But, users can know whether it's being evaluated by looking at `labelSelector` in `TopologySpreadConstraint`.
818
+
If key-value labels corresponding to `matchLabelKeys` are merged into `labelSelector` after Pods' creation, this feature is working correctly.
810
819
811
820
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
812
821
@@ -941,7 +950,7 @@ Yes. there is an additional work:
941
950
kube-apiserver uses the keys in `matchLabelKeys` to look up label values from the pod,
942
951
and change `LabelSelector` according to them.
943
952
kube-scheduler also handles matchLabelKeys if the cluster-level default constraints has it.
944
-
The impact in the latency of pod creation request in kube-apiserver and kube-scheduler
953
+
The impact in the latency of pod creation request in kube-apiserver and the scheduling latency
945
954
should be negligible.
946
955
947
956
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
@@ -1026,6 +1035,7 @@ Major milestones might include:
1026
1035
- 2022-03-17: Initial KEP
1027
1036
- 2022-06-08: KEP merged
1028
1037
- 2023-01-16: Graduate to Beta
1038
+
- 2025-01-23: Change the design
1029
1039
1030
1040
## Drawbacks
1031
1041
@@ -1048,14 +1058,18 @@ support because of the following reason: scheduler needs to ensure universal
1048
1058
and scheduler plugin shouldn't have special treatment for any labels/fields.
1049
1059
1050
1060
### implement MatchLabelKeys in only either the scheduler plugin or kube-apiserver
1051
-
If the implementation for handling `MatchLabelKeys` exists only in scheduler plugin, merging the key-value labels
1052
-
corresponding to `MatchLabelKeys` into `LabelSelector` becomes impossible due to its immutability.
1053
-
It may confuse users because this behavior is different from PodAffinity's `MatchLabelKeys`,
1054
-
On the other hand, if this implementation exists only in kube-apiserver, it prevents the achievement of the Cluster-level
1055
-
default constraints by `matchLabelKeys: ["pod-template-hash"]` ([#129198](https://github.com/kubernetes/kubernetes/issues/129198))
1056
-
because kube-apiserver can't be aware of the scheduler configuration.
1057
-
In addition, each implementation is simple, and the risk of increased maintenance overhead is low.
1058
-
As a result, these ideas are rejected, and we have decided to implement `MatchLabelKeys` in both scheduler plugin and kube-apiserver.
1061
+
Technically, we can implement this feature within the PodTopologySpread plugin only;
1062
+
merging the key-value labels corresponding to `MatchLabelKeys` into `LabelSelector` internally
1063
+
within the plugin before calculating the scheduling results.
1064
+
But, it may confuse users because this behavior would be different from PodAffinity's `MatchLabelKeys`.
1065
+
1066
+
Also, we cannot implement this feature only within kube-apiserver because it'd make it
1067
+
impossible to handle `MatchLabelKeys` within the cluster-level default constraints in the scheduler configuration.
1068
+
1069
+
So we decided to go with the current design that implements this feature within both
1070
+
the PodTopologySpread plugin and kube-apiserver.
1071
+
Although the final design has a downside requiring us to maintain two implementations handling `MatchLabelKeys`,
1072
+
each implementation is simple and we regard the risk of increased maintenance overhead as fairly low.
0 commit comments