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
@@ -110,7 +111,7 @@ tags, and then generate with `hack/update-toc.sh`.
110
111
-[Drawbacks](#drawbacks)
111
112
-[Alternatives](#alternatives)
112
113
-[use pod generateName](#use-pod-generatename)
113
-
-[remove MatchLabelKeys implementation from the scheduler plugin](#remove-matchlabelkeys-implementation-from-the-scheduler-plugin)
114
+
-[implement MatchLabelKeys in only either the scheduler plugin or kube-apiserver](#implement-matchlabelkeys-in-only-either-the-scheduler-plugin-or-kube-apiserver)
In addition, kube-scheduler handles `matchLabelKeys` if the cluster-level default constraints is configured with `matchLabelKeys`.
379
376
380
377
Finally, the feature will be guarded by a new feature flag. If the feature is
381
-
disabled, the field `matchLabelKeys` and corresponding`labelSelector` are preserved
378
+
disabled, the field `matchLabelKeys` and corresponding`labelSelector` are preserved
382
379
if it was already set in the persisted Pod object, otherwise new Pod with the field
383
-
creation will be rejected by kube-apiserver; moreover, kube-scheduler will ignore the
384
-
field and continue to behave as before.
380
+
creation will be rejected by kube-apiserver.
381
+
Also kube-scheduler will ignore `matchLabelKeys` in the cluster-level default constraints configuration.
382
+
383
+
### [v1.33] design change and a safe upgrade path
384
+
kube-apiserver will only merge key-value labels corresponding to `matchLabelKeys` into `labelSelector`
385
+
at pods creation, and it will not affect the existing pods.
386
+
So if there are unscheduled pods with `matchLabelKeys` which are already created when upgrading cluster,
387
+
they may not be scheduled correctly after the upgrade.
388
+
For a safe upgrade path from v1.32 to v1.33, kube-scheduler would handle not only `matchLabelKeys`
389
+
from the default constraints, but also all in-coming pods during v1.33.
390
+
We'll change kube-scheduler to only concern `matchLabelKeys` from the default constraints at v1.34 for efficiency,
391
+
assuming `matchLabelKeys` of all in-coming pods are handled by kube-apiserver.
385
392
386
393
### Test Plan
387
394
@@ -563,7 +570,7 @@ In the event of an upgrade, kube-apiserver will start to accept and store the fi
563
570
564
571
In the event of a downgrade, kube-apiserver will reject pod creation with `matchLabelKeys` in `TopologySpreadConstraint`.
565
572
But, regarding existing pods, we leave `matchLabelKeys` and generated `LabelSelector` even after downgraded.
566
-
kube-scheduler will ignore `MatchLabelKeys` even if it was set.
573
+
kube-scheduler will ignore `MatchLabelKeys` if it was set in the cluster-level default constraints configuration.
567
574
568
575
### Version Skew Strategy
569
576
@@ -651,8 +658,7 @@ The feature can be disabled in Alpha and Beta versions by restarting
651
658
kube-apiserver and kube-scheduler with feature-gate off.
652
659
One caveat is that pods that used the feature will continue to have the
653
660
MatchLabelKeys field set and the corresponding LabelSelector even after
654
-
disabling the feature gate, however kube-scheduler will not take the MatchLabelKeys
655
-
field into account.
661
+
disabling the feature gate.
656
662
In terms of Stable versions, users can choose to opt-out by not setting
657
663
the matchLabelKeys field.
658
664
@@ -934,9 +940,7 @@ Think about adding additional work or introducing new steps in between
934
940
Yes. there is an additional work:
935
941
kube-apiserver uses the keys in `matchLabelKeys` to look up label values from the pod,
936
942
and change `LabelSelector` according to them.
937
-
kube-scheduler also looks up the label values from the pod and checks if those labels
938
-
are included in `LabelSelector`. If not, kube-scheduler will take those labels and AND
939
-
with `LabelSelector`.
943
+
kube-scheduler also handles matchLabelKeys if the cluster-level default constraints has it.
940
944
The impact in the latency of pod creation request in kube-apiserver and kube-scheduler
941
945
should be negligible.
942
946
@@ -1043,13 +1047,15 @@ revisions of the same workload in scheduler plugin. It's decided not to
1043
1047
support because of the following reason: scheduler needs to ensure universal
1044
1048
and scheduler plugin shouldn't have special treatment for any labels/fields.
1045
1049
1046
-
### remove MatchLabelKeys implementation from the scheduler plugin
1047
-
Remove this implementation related to `MatchLabelKeys` from the scheduler plugin
1048
-
and only kube-apiserver handles `MatchLabelKeys` and updates `LabelSelector`.
1049
-
1050
-
However, this idea is rejected because:
1051
-
- This approach prevents the achievement of the Cluster-level default constraints by `matchLabelKeys: ["pod-template-hash"]`.([#129198](https://github.com/kubernetes/kubernetes/issues/129198)) because kube-apiserver can't be aware of the kube-scheduler configuration.
1052
-
- The current implementation of the scheduler plugin is simple, and the risk of increased maintenance overhead is low.
1050
+
### 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.
0 commit comments