Skip to content

Commit 580f1c1

Browse files
committed
KEP-3633: graduate matchLabelKeys/mismatchLabelKeys to beta
1 parent 567de61 commit 580f1c1

File tree

3 files changed

+109
-13
lines changed

3 files changed

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

keps/sig-scheduling/3633-matchlabelkeys-to-podaffinity/README.md

Lines changed: 105 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,24 @@ rollout. Similarly, consider large clusters and how enablement/disablement
758758
will rollout across nodes.
759759
-->
760760

761+
It shouldn't impact already running workloads. It's an opt-in feature,
762+
and users need to set `matchLabelKeys` or `mismatchLabelKeys` field in PodAffinity or PodAntiAffinity to use this feature.
763+
764+
When this feature is disabled by the feature flag, the already created Pod's `matchLabelKeys`/`mismatchLabelKeys` (+ `labelSelector` generated from them) is kept.
765+
But, the newly created Pod's `matchLabelKeys` or `mismatchLabelKeys` field is silently dropped.
766+
761767
###### What specific metrics should inform a rollback?
762768

763769
<!--
764770
What signals should users be paying attention to when the feature is young
765771
that might indicate a serious problem?
766772
-->
767773

774+
- A spike on metric `schedule_attempts_total{result="error|unschedulable"}` when pods using this feature are added.
775+
776+
No need to check latency of the scheduler because the scheduler doesn't get changed at all for this feature.
777+
The only possibility is the bug in the Pod creation process in kube-apiserver and it results in some unintended scheduling.
778+
768779
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
769780

770781
<!--
@@ -773,12 +784,32 @@ Longer term, we may want to require automated upgrade/rollback tests, but we
773784
are missing a bunch of machinery and tooling and can't do that now.
774785
-->
775786

787+
We'll test it via this scenario:
788+
789+
1. start kube-apiserver with this feature disabled.
790+
2. create one Pod with `matchLabelKeys` in PodAffinity.
791+
3. No change should be observed in `labelSelector` in PodAffinity because the feature is disabled.
792+
4. restart kube-apiserver with this feature enabled. (**First enablement**)
793+
5. No change in Pod created at (2).
794+
6. create one Pod with `matchLabelKeys` in PodAffinity.
795+
7. `labelSelector` in PodAffinity should be changed based on `matchLabelKeys` and label value in the Pod because the feature is enabled.
796+
8. restart kube-apiserver with this feature disabled. (**First disablement**)
797+
9. No change in Pods created before.
798+
10. create one Pod with `matchLabelKeys` in PodAffinity.
799+
11. No change should be observed in `labelSelector` in PodAffinity because the feature is disabled.
800+
12. restart kube-apiserver with this feature enabled. (**Second enablement**)
801+
13. No change in Pods created before.
802+
14. create one Pod with `matchLabelKeys` in PodAffinity.
803+
15. `labelSelector` in PodAffinity should be changed based on `matchLabelKeys` and label value in the Pod because the feature is enabled.
804+
776805
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
777806

778807
<!--
779808
Even if applying deprecation policies, they may still surprise some users.
780809
-->
781810

811+
No.
812+
782813
### Monitoring Requirements
783814

784815
<!--
@@ -796,6 +827,8 @@ checking if there are objects with field X set) may be a last resort. Avoid
796827
logs or events for this purpose.
797828
-->
798829

830+
The operator can query pods with `matchLabelKeys` or `mismatchLabelKeys` field set in PodAffinity or PodAntiAffinity.
831+
799832
###### How can someone using this feature know that it is working for their instance?
800833

801834
<!--
@@ -807,13 +840,13 @@ and operation of this feature.
807840
Recall that end users cannot usually observe component logs or access metrics.
808841
-->
809842

810-
- [ ] Events
811-
- Event Reason:
812-
- [ ] API .status
813-
- Condition name:
814-
- Other field:
815-
- [ ] Other (treat as last resort)
843+
- [x] Other (treat as last resort)
816844
- Details:
845+
This feature doesn't cause any logs, any events, any pod status updates.
846+
But, people can determine it's being evaluated by looking at `labelSelector` in PodAffinity or PodAntiAffinity
847+
in which they set `matchLabelKey` or `mismatchLabelKeys`.
848+
If `labelSelector` is modified after Pods' creation, this feature is working correctly.
849+
817850

818851
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
819852

@@ -832,18 +865,20 @@ These goals will help you determine what you need to measure (SLIs) in the next
832865
question.
833866
-->
834867

868+
Metric `plugin_execution_duration_seconds{plugin="InterPodAffinity"}` <= 100ms on 90-percentile.
869+
870+
This feature shouldn't change the latency of InterPodAffinity plugin at all.
871+
835872
###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?
836873

837874
<!--
838875
Pick one more of these and delete the rest.
839876
-->
840877

841-
- [ ] Metrics
878+
- [x] Metrics
842879
- Metric name:
843-
- [Optional] Aggregation method:
844-
- Components exposing the metric:
845-
- [ ] Other (treat as last resort)
846-
- Details:
880+
- Metric name: `schedule_attempts_total{result="error|unschedulable"}`
881+
- Components exposing the metric: kube-scheduler
847882

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

@@ -852,6 +887,8 @@ Describe the metrics themselves and the reasons why they weren't added (e.g., co
852887
implementation difficulties, etc.).
853888
-->
854889

890+
No.
891+
855892
### Dependencies
856893

857894
<!--
@@ -875,6 +912,8 @@ and creating new ones, as well as about cluster-level services (e.g. DNS):
875912
- Impact of its degraded performance or high-error rates on the feature:
876913
-->
877914

915+
No.
916+
878917
### Scalability
879918

880919
<!--
@@ -902,6 +941,8 @@ Focusing mostly on:
902941
heartbeats, leader election, etc.)
903942
-->
904943

944+
No.
945+
905946
###### Will enabling / using this feature result in introducing new API types?
906947

907948
<!--
@@ -911,6 +952,8 @@ Describe them, providing:
911952
- Supported number of objects per namespace (for namespace-scoped objects)
912953
-->
913954

955+
No.
956+
914957
###### Will enabling / using this feature result in any new calls to the cloud provider?
915958

916959
<!--
@@ -919,6 +962,8 @@ Describe them, providing:
919962
- Estimated increase:
920963
-->
921964

965+
No.
966+
922967
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
923968

924969
<!--
@@ -928,6 +973,9 @@ Describe them, providing:
928973
- Estimated amount of new objects: (e.g., new Object X for every existing Pod)
929974
-->
930975

976+
No.
977+
978+
931979
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
932980

933981
<!--
@@ -939,6 +987,10 @@ Think about adding additional work or introducing new steps in between
939987
[existing SLIs/SLOs]: https://git.k8s.io/community/sig-scalability/slos/slos.md#kubernetes-slisslos
940988
-->
941989

990+
Yes. there is an additional work: kube-apiserver uses the keys in `matchLabelKeys` or `mismatchLabelKeys` to look up label values from the pod,
991+
and change `labelSelector` according to them.
992+
Maybe result in a very small impact in the latency of pod creation request in kube-apiserver.
993+
942994
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
943995

944996
<!--
@@ -951,6 +1003,35 @@ This through this both in small and large cases, again with respect to the
9511003
[supported limits]: https://git.k8s.io/community//sig-scalability/configs-and-limits/thresholds.md
9521004
-->
9531005

1006+
No.
1007+
1008+
1009+
###### Can enabling / using this feature result in resource exhaustion of some node resources (PIDs, sockets, inodes, etc.)?
1010+
1011+
<!--
1012+
Focus not just on happy cases, but primarily on more pathological cases
1013+
(e.g. probes taking a minute instead of milliseconds, failed pods consuming resources, etc.).
1014+
If any of the resources can be exhausted, how this is mitigated with the existing limits
1015+
(e.g. pods per node) or new limits added by this KEP?
1016+
1017+
Are there any tests that were run/should be run to understand performance characteristics better
1018+
and validate the declared limits?
1019+
-->
1020+
No.
1021+
1022+
###### Can enabling / using this feature result in resource exhaustion of some node resources (PIDs, sockets, inodes, etc.)?
1023+
1024+
<!--
1025+
Focus not just on happy cases, but primarily on more pathological cases
1026+
(e.g. probes taking a minute instead of milliseconds, failed pods consuming resources, etc.).
1027+
If any of the resources can be exhausted, how this is mitigated with the existing limits
1028+
(e.g. pods per node) or new limits added by this KEP?
1029+
Are there any tests that were run/should be run to understand performance characteristics better
1030+
and validate the declared limits?
1031+
-->
1032+
1033+
No.
1034+
9541035
### Troubleshooting
9551036

9561037
<!--
@@ -966,6 +1047,9 @@ details). For now, we leave it here.
9661047

9671048
###### How does this feature react if the API server and/or etcd is unavailable?
9681049

1050+
If the API server and/or etcd is not available, this feature will not be available.
1051+
This is because this feature depends on Pods creation.
1052+
9691053
###### What are other known failure modes?
9701054

9711055
<!--
@@ -981,8 +1065,17 @@ For each of them, fill in the following information by copying the below templat
9811065
- Testing: Are there any tests for failure mode? If not, describe why.
9821066
-->
9831067

1068+
N/A.
1069+
9841070
###### What steps should be taken if SLOs are not being met to determine the problem?
9851071

1072+
- Check the metric `schedule_attempts_total{result="error|unschedulable"}` to determine if the number
1073+
of attempts increased.
1074+
If increased, You need to determine the cause of the failure by the event of
1075+
the pod. If it's caused by plugin `InterPodAffinity`, you can further analyze this problem by looking
1076+
at `labelSelector` in PodAffinity/PodAntiAffinity with `matchLabelKeys`/`mismatchLabelKeys`.
1077+
If `labelSelector` seems to be updated incorrectly, it's the problem in this feature.
1078+
9861079
## Implementation History
9871080

9881081
<!--
@@ -998,6 +1091,7 @@ Major milestones might include:
9981091

9991092
- 2022-11-09: Initial KEP PR is submitted.
10001093
- 2023-05-14 / 2023-06-08: PRs to change it from MatchLabelKeys to MatchLabelSelector are submitted. (to satisfy the user story 2)
1094+
- 2024-01-28: The PR to update KEP for beta is submitted.
10011095

10021096
## Drawbacks
10031097

keps/sig-scheduling/3633-matchlabelkeys-to-podaffinity/kep.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ approvers:
1313
see-also:
1414
- "/keps/sig-scheduling/3243-respect-pod-topology-spread-after-rolling-upgrades"
1515

16-
stage: alpha
16+
stage: beta
1717

18-
latest-milestone: "v1.29"
18+
latest-milestone: "v1.30"
1919

2020
milestone:
2121
alpha: "v1.29"

0 commit comments

Comments
 (0)