Skip to content

Commit d805cc3

Browse files
committed
KEP-3243: Graduate MatchLabelKeys In PodTopologySpread to beta
Signed-off-by: Alex Wang <[email protected]>
1 parent 475b18a commit d805cc3

File tree

3 files changed

+105
-21
lines changed

3 files changed

+105
-21
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
kep-number: 3243
22
alpha:
33
approver: "@wojtek-t"
4+
beta:
5+
approver: "@wojtek-t"

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

Lines changed: 93 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ checklist items _must_ be updated for the enhancement to be released.
131131
Items marked with (R) are required *prior to targeting to a milestone / release*.
132132

133133
- [x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
134-
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
134+
- [x] (R) KEP approvers have approved the KEP status as `implementable`
135135
- [x] (R) Design details are appropriately documented
136136
- [x] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
137137
- [ ] e2e Tests for all Beta API Operations (endpoints)
@@ -142,7 +142,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
142142
- [ ] (R) Production readiness review completed
143143
- [ ] (R) Production readiness review approved
144144
- [x] "Implementation History" section is up-to-date for milestone
145-
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
145+
- [x] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
146146
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
147147

148148
<!--
@@ -640,7 +640,13 @@ feature gate after having objects written with the new field) are also critical.
640640
You can take a look at one potential example of such test in:
641641
https://github.com/kubernetes/kubernetes/pull/97058/files#diff-7826f7adbc1996a05ab52e3f5f02429e94b68ce6bce0dc534d1be636154fded3R246-R282
642642
-->
643-
No, unit and integration tests will be added.
643+
Yes. there are unit and integration tests for feature enablement/disablement.
644+
- unit tests:
645+
- `pkg/scheduler/framework/plugins/podtopologyspread/filtering_test.go`
646+
- `pkg/scheduler/framework/plugins/podtopologyspread/scoring_test.go`
647+
- integration tests
648+
- `test/integration/scheduler/filters/filters_test.go`
649+
- `test/integration/scheduler/scoring/priorities_test.go`
644650

645651
### Rollout, Upgrade and Rollback Planning
646652

@@ -659,13 +665,18 @@ feature flags will be enabled on some API servers and not others during the
659665
rollout. Similarly, consider large clusters and how enablement/disablement
660666
will rollout across nodes.
661667
-->
668+
It won't impact already running workloads because it is an opt-in feature.
669+
662670

663671
###### What specific metrics should inform a rollback?
664672

665673
<!--
666674
What signals should users be paying attention to when the feature is young
667675
that might indicate a serious problem?
668676
-->
677+
- If the metric `schedule_attempts_total{result="error|unschedulable"}` increased significantly after pods using this feature are added.
678+
- If the metric `plugin_execution_duration_seconds{plugin="PodTopologySpread"}` increased to higher than 100ms on 90% after pods using this feature are added.
679+
669680

670681
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
671682

@@ -674,12 +685,60 @@ Describe manual testing that was done and the outcomes.
674685
Longer term, we may want to require automated upgrade/rollback tests, but we
675686
are missing a bunch of machinery and tooling and can't do that now.
676687
-->
688+
Yes, it was tested manually by following the steps below, and it was working at intended.
689+
1. create a kubernetes cluster v1.26 with 3 nodes where `MatchLabelKeysInPodTopologySpread` feature is disabled.
690+
2. deploy a deployment with this yaml
691+
```yaml
692+
apiVersion: apps/v1
693+
kind: Deployment
694+
metadata:
695+
name: nginx
696+
spec:
697+
replicas: 12
698+
selector:
699+
matchLabels:
700+
foo: bar
701+
template:
702+
metadata:
703+
labels:
704+
foo: bar
705+
spec:
706+
restartPolicy: Always
707+
containers:
708+
- name: nginx
709+
image: nginx:1.14.2
710+
topologySpreadConstraints:
711+
- maxSkew: 1
712+
topologyKey: kubernetes.io/hostname
713+
whenUnsatisfiable: DoNotSchedule
714+
labelSelector:
715+
matchLabels:
716+
foo: bar
717+
matchLabelKeys:
718+
- pod-template-hash
719+
```
720+
3. pods spread across nodes as 4/4/4
721+
4. update the deployment nginx image to `nginx:1.15.0`
722+
5. pods spread across nodes as 5/4/3
723+
6. delete deployment nginx
724+
7. upgrade kubenetes cluster to v1.27 (at master branch) while `MatchLabelKeysInPodTopologySpread` is enabled.
725+
8. deploy a deployment nginx like step2
726+
9. pods spread across nodes as 4/4/4
727+
10. update the deployment nginx image to `nginx:1.15.0`
728+
11. pods spread across nodes as 4/4/4
729+
12. delete deployment nginx
730+
13. downgrade kubenetes cluster to v1.26 where `MatchLabelKeysInPodTopologySpread` feature is enabled.
731+
14. deploy a deployment nginx like step2
732+
15. pods spread across nodes as 4/4/4
733+
16. update the deployment nginx image to `nginx:1.15.0`
734+
17. pods spread across nodes as 4/4/4
677735

678736
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
679737

680738
<!--
681739
Even if applying deprecation policies, they may still surprise some users.
682740
-->
741+
No.
683742

684743
### Monitoring Requirements
685744

@@ -694,6 +753,7 @@ Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
694753
checking if there are objects with field X set) may be a last resort. Avoid
695754
logs or events for this purpose.
696755
-->
756+
Operator can query pods that have the `pod.spec.topologySpreadConstraints.matchLabelKeys` field set to determine if the feature is in use by workloads.
697757

698758
###### How can someone using this feature know that it is working for their instance?
699759

@@ -706,13 +766,8 @@ and operation of this feature.
706766
Recall that end users cannot usually observe component logs or access metrics.
707767
-->
708768

709-
- [ ] Events
710-
- Event Reason:
711-
- [ ] API .status
712-
- Condition name:
713-
- Other field:
714-
- [ ] Other (treat as last resort)
715-
- Details:
769+
- [x] Other (treat as last resort)
770+
- Details: We can determine if the feature is being used by comparing the expected and actual scheduling results.
716771

717772
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
718773

@@ -730,26 +785,27 @@ high level (needs more precise definitions) those may be things like:
730785
These goals will help you determine what you need to measure (SLIs) in the next
731786
question.
732787
-->
788+
Metric plugin_execution_duration_seconds{plugin="PodTopologySpread"} <= 100ms on 90-percentile.
733789

734790
###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?
735791

736792
<!--
737793
Pick one more of these and delete the rest.
738794
-->
739795

740-
- [ ] Metrics
741-
- Metric name:
742-
- [Optional] Aggregation method:
743-
- Components exposing the metric:
744-
- [ ] Other (treat as last resort)
745-
- Details:
796+
- [x] Metrics
797+
- Component exposing the metric: kube-scheduler
798+
- Metric name: `plugin_execution_duration_seconds{plugin="PodTopologySpread"}`
799+
- Metric name: `schedule_attempts_total{result="error|unschedulable"}`
746800

747801
###### Are there any missing metrics that would be useful to have to improve observability of this feature?
748802

749803
<!--
750804
Describe the metrics themselves and the reasons why they weren't added (e.g., cost,
751805
implementation difficulties, etc.).
752806
-->
807+
Yes. It's helpful if we have the metrics to see which plugins affect to scheduler's decisions in Filter/Score phase.
808+
There is the related issue: https://github.com/kubernetes/kubernetes/issues/110643 . It's very big and still on the way.
753809

754810
### Dependencies
755811

@@ -773,6 +829,7 @@ and creating new ones, as well as about cluster-level services (e.g. DNS):
773829
- Impact of its outage on the feature:
774830
- Impact of its degraded performance or high-error rates on the feature:
775831
-->
832+
No.
776833

777834
### Scalability
778835

@@ -800,6 +857,7 @@ Focusing mostly on:
800857
- periodic API calls to reconcile state (e.g. periodic fetching state,
801858
heartbeats, leader election, etc.)
802859
-->
860+
No.
803861

804862
###### Will enabling / using this feature result in introducing new API types?
805863

@@ -809,6 +867,7 @@ Describe them, providing:
809867
- Supported number of objects per cluster
810868
- Supported number of objects per namespace (for namespace-scoped objects)
811869
-->
870+
No.
812871

813872
###### Will enabling / using this feature result in any new calls to the cloud provider?
814873

@@ -817,6 +876,7 @@ Describe them, providing:
817876
- Which API(s):
818877
- Estimated increase:
819878
-->
879+
No.
820880

821881
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
822882

@@ -826,6 +886,7 @@ Describe them, providing:
826886
- Estimated increase in size: (e.g., new annotation of size 32B)
827887
- Estimated amount of new objects: (e.g., new Object X for every existing Pod)
828888
-->
889+
No.
829890

830891
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
831892

@@ -837,6 +898,7 @@ Think about adding additional work or introducing new steps in between
837898

838899
[existing SLIs/SLOs]: https://git.k8s.io/community/sig-scalability/slos/slos.md#kubernetes-slisslos
839900
-->
901+
No.
840902

841903
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
842904

@@ -849,6 +911,7 @@ This through this both in small and large cases, again with respect to the
849911

850912
[supported limits]: https://git.k8s.io/community//sig-scalability/configs-and-limits/thresholds.md
851913
-->
914+
No.
852915

853916
### Troubleshooting
854917

@@ -861,6 +924,8 @@ details). For now, we leave it here.
861924
-->
862925

863926
###### How does this feature react if the API server and/or etcd is unavailable?
927+
If the API server and/or etcd is not available, this feature will not be available.
928+
This is because the scheduler needs to update the scheduling results to the pod via the API server/etcd.
864929

865930
###### What are other known failure modes?
866931

@@ -876,8 +941,18 @@ For each of them, fill in the following information by copying the below templat
876941
Not required until feature graduated to beta.
877942
- Testing: Are there any tests for failure mode? If not, describe why.
878943
-->
944+
N/A
879945

880946
###### What steps should be taken if SLOs are not being met to determine the problem?
947+
- Check the metric `plugin_execution_duration_seconds{plugin="PodTopologySpread"}` to determine
948+
if the latency increased. If increased, it means this feature may increased scheduling latency.
949+
You can disable the feature `MatchLabelKeysInPodTopologySpread` to see if it's the cause of the
950+
increased latency.
951+
- Check the metric `schedule_attempts_total{result="error|unschedulable"}` to determine if the number
952+
of attempts increased. If increased, You need to determine the cause of the failure by the event of
953+
the pod. If it's caused by plugin `PodTopologySpread`, You can further analyze this problem by looking
954+
at the scheduler log.
955+
881956

882957
## Implementation History
883958

@@ -892,6 +967,8 @@ Major milestones might include:
892967
- when the KEP was retired or superseded
893968
-->
894969
- 2022-03-17: Initial KEP
970+
- 2022-06-08: KEP merged
971+
- 2023-01-16: Graduate to Beta
895972

896973
## Drawbacks
897974

keps/sig-scheduling/3243-respect-pod-topology-spread-after-rolling-upgrades/kep.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kep-number: 3243
33
authors:
44
- "@denkensk"
55
owning-sig: sig-scheduling
6-
status: provisional
6+
status: implementable
77
creation-date: 2022-03-17
88
reviewers:
99
- "@ahg-g"
@@ -17,18 +17,18 @@ see-also:
1717
- "/keps/sig-scheduling/3094-pod-topology-spread-considering-taints"
1818

1919
# The target maturity stage in the current dev cycle for this KEP.
20-
stage: alpha
20+
stage: beta
2121

2222
# The most recent milestone for which work toward delivery of this KEP has been
2323
# done. This can be the current (upcoming) milestone, if it is being actively
2424
# worked on.
25-
latest-milestone: "v1.25"
25+
latest-milestone: "v1.27"
2626

2727
# The milestone at which this feature was, or is targeted to be, at each stage.
2828
milestone:
2929
alpha: "v1.25"
30-
beta: "v1.26"
31-
stable: "v1.28"
30+
beta: "v1.27"
31+
stable: "v1.29"
3232

3333
# The following PRR answers are required at alpha release
3434
# List the feature gate name and the components for which it must be enabled
@@ -39,3 +39,8 @@ feature-gates:
3939
- kube-scheduler
4040

4141
disable-supported: true
42+
43+
# The following PRR answers are required at beta release
44+
metrics:
45+
- plugin_execution_duration_seconds{plugin="PodTopologySpread"}
46+
- schedule_attempts_total{result="error|unschedulable"}

0 commit comments

Comments
 (0)