@@ -90,7 +90,7 @@ tags, and then generate with `hack/update-toc.sh`.
90
90
- [ Possible misuse] ( #possible-misuse )
91
91
- [ The update to labels specified at <code >matchLabelKeys</code > isn't supported] ( #the-update-to-labels-specified-at-matchlabelkeys-isnt-supported )
92
92
- [ Design Details] ( #design-details )
93
- - [[ v1.33 ] design change and a safe upgrade path] ( #v133 -design-change-and-a-safe-upgrade-path )
93
+ - [[ v1.34 ] design change and a safe upgrade path] ( #v134 -design-change-and-a-safe-upgrade-path )
94
94
- [ Test Plan] ( #test-plan )
95
95
- [ Prerequisite testing updates] ( #prerequisite-testing-updates )
96
96
- [ Unit tests] ( #unit-tests )
@@ -401,25 +401,28 @@ kube-apiserver modifies the `labelSelector` like the following:
401
401
In addition, kube-scheduler will handle `matchLabelKeys` within the cluster-level default constraints
402
402
in the scheduler configuration in the future (see https://github.com/kubernetes/kubernetes/issues/129198).
403
403
404
- Finally, the feature will be guarded by a new feature flag. If the feature is
404
+ Finally, the feature will be guarded by a new feature flag `MatchLabelKeysInPodTopologySpread` . If the feature is
405
405
disabled, the field `matchLabelKeys` and corresponding `labelSelector` are preserved
406
406
if it was already set in the persisted Pod object, otherwise new Pod with the field
407
407
creation will be rejected by kube-apiserver.
408
408
Also kube-scheduler will ignore `matchLabelKeys` in the cluster-level default constraints configuration.
409
409
410
- # ## [v1.33 ] design change and a safe upgrade path
410
+ # ## [v1.34 ] design change and a safe upgrade path
411
411
Previously, kube-scheduler just internally handled `matchLabelKeys` before the calculation of scheduling results.
412
412
But, we changed the implementation design to the current form to make the design align with PodAffinity's `matchLabelKeys`.
413
413
(See the detailed discussion in [the alternative section](#implement-matchlabelkeys-in-only-either-the-scheduler-plugin-or-kube-apiserver))
414
414
415
415
However, this implementation change could break `matchLabelKeys` of unscheduled pods created before the upgrade
416
416
because kube-apiserver only handles `matchLabelKeys` at pods creation, that is,
417
417
it doesn't handle `matchLabelKeys` at existing unscheduled pods.
418
- So, for a safe upgrade path from v1.32 to v1.33 , kube-scheduler would handle not only `matchLabelKeys`
419
- from the default constraints, but also all incoming pods during v1.33 .
420
- We're going to change kube-scheduler to only concern `matchLabelKeys` from the default constraints at v1.34 for efficiency,
418
+ So, for a safe upgrade path from v1.33 to v1.34 , kube-scheduler would handle not only `matchLabelKeys`
419
+ from the default constraints, but also all incoming pods during v1.34 .
420
+ We're going to change kube-scheduler to only concern `matchLabelKeys` from the default constraints at v1.35 for efficiency,
421
421
assuming kube-apiserver handles `matchLabelKeys` of all incoming pods.
422
422
423
+ This implementation change can be disabled by the `MatchLabelKeysInPodTopologySpreadSelectorMerge` feature flag.
424
+ (See more details in [Feature Enablement and Rollback](#feature-enablement-and-rollback))
425
+
423
426
# ## Test Plan
424
427
425
428
<!--
@@ -619,8 +622,8 @@ enhancement:
619
622
620
623
There's no version skew issue.
621
624
622
- We changed the implementation design between v1.33 and v1.34 , but we designed the change not to involve any version skew issue
623
- as described at [[v1.33 ] design change and a safe upgrade path](#v133 -design-change-and-a-safe-upgrade-path).
625
+ We changed the implementation design between v1.34 and v1.35 , but we designed the change not to involve any version skew issue
626
+ as described at [[v1.34 ] design change and a safe upgrade path](#v134 -design-change-and-a-safe-upgrade-path).
624
627
625
628
# # Production Readiness Review Questionnaire
626
629
@@ -652,6 +655,15 @@ you need any help or guidance.
652
655
This section must be completed when targeting alpha to a release.
653
656
-->
654
657
658
+ - ` MatchLabelKeysInPodTopologySpread` feature flag will toggle enabling `MatchLabelKeys` in `TopologySpreadConstraint`.
659
+ - ` MatchLabelKeysInPodTopologySpreadSelectorMerge` feature flag will toggle merging the key-value labels
660
+ corresponding to `MatchLabelKeys` into `LabelSelector` of `TopologySpreadConstraint`.
661
+ This flag cannot be enabled on its own, and has to be enabled together with `MatchLabelKeysInPodTopologySpread`.
662
+
663
+ The `MatchLabelKeysInPodTopologySpreadSelectorMerge` feature flag has been added in v1.34 and enabled by default.
664
+ This flag can be disabled to revert [the implementation design change in v1.34](#v134-design-change-and-a-safe-upgrade-path)
665
+ and go back to the previous behavior.
666
+
655
667
# ##### How can this feature be enabled / disabled in a live cluster?
656
668
657
669
<!--
@@ -667,6 +679,9 @@ well as the [existing list] of feature gates.
667
679
- [x] Feature gate (also fill in values in `kep.yaml`)
668
680
- Feature gate name : ` MatchLabelKeysInPodTopologySpread`
669
681
- Components depending on the feature gate : ` kube-scheduler` , `kube-apiserver`
682
+ - [x] Feature gate (also fill in values in `kep.yaml`)
683
+ - Feature gate name : ` MatchLabelKeysInPodTopologySpreadSelectorMerge`
684
+ - Components depending on the feature gate : ` kube-apiserver`
670
685
671
686
# ##### Does enabling the feature change any default behavior?
672
687
@@ -1086,7 +1101,7 @@ and scheduler plugin shouldn't have special treatment for any labels/fields.
1086
1101
Technically, we can implement this feature within the PodTopologySpread plugin only;
1087
1102
merging the key-value labels corresponding to `MatchLabelKeys` into `LabelSelector` internally
1088
1103
within the plugin before calculating the scheduling results.
1089
- This is the actual implementation up to 1.32 .
1104
+ This is the actual implementation up to 1.33 .
1090
1105
But, it may confuse users because this behavior would be different from PodAffinity's `MatchLabelKeys`.
1091
1106
1092
1107
Also, we cannot implement this feature only within kube-apiserver because it'd make it
0 commit comments