Skip to content

Commit ecd8737

Browse files
committed
fix3
1 parent 4906e22 commit ecd8737

File tree

1 file changed

+25
-11
lines changed
  • keps/sig-scheduling/3243-respect-pod-topology-spread-after-rolling-upgrades

1 file changed

+25
-11
lines changed

keps/sig-scheduling/3243-respect-pod-topology-spread-after-rolling-upgrades/README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ creation will be rejected by kube-apiserver.
381381
Also kube-scheduler will ignore `matchLabelKeys` in the cluster-level default constraints configuration.
382382

383383
### [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+
384388
kube-apiserver will only merge key-value labels corresponding to `matchLabelKeys` into `labelSelector`
385389
at pods creation, and it will not affect the existing pods.
386390
So if there are unscheduled pods with `matchLabelKeys` which are already created when upgrading cluster,
@@ -586,7 +590,9 @@ enhancement:
586590
- Will any other components on the node change? For example, changes to CSI,
587591
CRI or CNI may require updating that component before the kubelet.
588592
-->
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).
590596

591597
## Production Readiness Review Questionnaire
592598

@@ -806,7 +812,10 @@ Recall that end users cannot usually observe component logs or access metrics.
806812
-->
807813

808814
- [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.
810819

811820
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
812821

@@ -941,7 +950,7 @@ Yes. there is an additional work:
941950
kube-apiserver uses the keys in `matchLabelKeys` to look up label values from the pod,
942951
and change `LabelSelector` according to them.
943952
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
945954
should be negligible.
946955

947956
###### 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:
10261035
- 2022-03-17: Initial KEP
10271036
- 2022-06-08: KEP merged
10281037
- 2023-01-16: Graduate to Beta
1038+
- 2025-01-23: Change the design
10291039

10301040
## Drawbacks
10311041

@@ -1048,14 +1058,18 @@ support because of the following reason: scheduler needs to ensure universal
10481058
and scheduler plugin shouldn't have special treatment for any labels/fields.
10491059

10501060
### 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.
10591073

10601074
## Infrastructure Needed (Optional)
10611075

0 commit comments

Comments
 (0)