APIServer APF estimates cost for LIST not work #130139
Labels
kind/bug
Categorizes issue or PR as related to a bug.
sig/api-machinery
Categorizes an issue or PR as relevant to SIG API Machinery.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What happened?
According to the documentation https://kubernetes.io/docs/concepts/cluster-administration/flow-control/#seats-occupied-by-a-request , the APIServer's APF (API Priority and Fairness) calculates seats for each request as a reference to measure the consumption of each API. Specifically, List requests determine the number of seats based on the number of objects returned.
However, in actual usage, I have observed that all List requests (regardless of the number of objects) are assigned only 1 seat by APF.
For example, I have 1w+ pods in cluster, seat expected to be 10.
I found that the seat calculation for List requests happens at
kubernetes/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/request/list_work_estimator.go
Line 50 in 2642d82
and every request hit the error:
kubernetes/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/request/list_work_estimator.go
Line 100 in 2642d82
.
So I add some debug log in
objectCountTracker
set, found thatobjectCountTracker
is nil, so it will never update the object count, which will causeObjectCountNotFoundErr
in APF list estimator.kubernetes/staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go
Lines 1673 to 1675 in 2642d82
What did you expect to happen?
In APF (API Priority and Fairness), the seats for a List request should increase with the number of objects returned, rather than always being 1.
How can we reproduce it (as minimally and precisely as possible)?
There is my apf config.
Anything else we need to know?
No response
Kubernetes version
Server Version: v1.32.2
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: