Commit Graph

241 Commits

Author SHA1 Message Date
Marek Siarkowicz 3007d9c56b Account for caching and maximum object size when estimating LIST request
Kubernetes-commit: 99059895f4fdc7043689c3b81b1e4fc28c526ca9
2025-07-18 17:32:28 +02:00
Marek Siarkowicz 7cfdd00464 Increase maxSeats for List requests
Kubernetes-commit: 66de1960a5d41ccd5631fed32fecf67536ec98e6
2025-07-17 17:48:41 +02:00
Marek Siarkowicz 478396c06d Add apiserver_resource_size_estimate_bytes metric
Kubernetes-commit: a091fa607eaecfa7b80cb0437db1d210aa587f98
2025-07-11 16:38:43 +02:00
Marek Siarkowicz f3eb956bcb Use object size estimation for non-recursive list
Kubernetes-commit: d8747d716e4b92930941a84409f24aef25035972
2025-07-15 11:08:51 +02:00
Marek Siarkowicz 0a86ef71af Use object size to estimate list cost assigning 1 sear per 100KB
Kubernetes-commit: 85adda5e68f07057a8b515779343f928ff61f471
2025-07-14 16:52:41 +02:00
Marek Siarkowicz cf27dab482 Estimate average size of objects in etcd and plug it into request cost estimator
Kubernetes-commit: ec78b8305ad392f6faf4e5247ea33ceabb484c3f
2025-06-13 16:34:42 +02:00
Davanum Srinivas 6db9ead72a Add a replacement for cmp.Diff using json+go-difflib
Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 03afe6471bdbf6462b7035fdaae5aa0dd9545396
2025-06-10 23:08:41 -04:00
Marek Siarkowicz 6811fdeb2d Unify should delegate list
Kubernetes-commit: 8fdd6fe4768d81da09f339c1dda831a05bb26f00
2025-03-20 11:08:37 +01:00
Marek Siarkowicz 91724cfd41 Change precedence order for continue and legacy exact match
This doesn't matter for shouldDelegateList, but matters when picking
source of RV. RV from continue takes precedence.

Kubernetes-commit: 7da942ca7486310893d4f11f3af062957f953555
2025-03-19 13:58:43 +01:00
Marek Siarkowicz cc5ef43352 Extract delegator.Helper interface to allow making delegate decision based on cache state
Kubernetes-commit: 984b475e74904dd61c10b23472798a21496edc8f
2025-03-17 15:46:02 +01:00
Marek Siarkowicz 3cb2448d98 Fix detecting consistent read when watchcache starts handling continue
Kubernetes-commit: 8f83f2446a5e2f11eb751fb56067c663b51cfd12
2025-03-12 18:37:10 +01:00
Marek Siarkowicz 6ed423348f Simplify shouldDelegateList
When ResourceVersionMatch is set to NotOlderThan, there is no need to handle continue or resourceVersion="".
The validation in apimachinery will not pass and return:
* "resourceVersionMatch is forbidden when continue is provided"
* "resourceVersionMatch is forbidden unless resourceVersion is provided"

Kubernetes-commit: a0cc02e264ead76dfb0ae75a505e4d2e54219def
2025-03-12 18:20:47 +01:00
Marek Siarkowicz a64613cb08 Rename CacheProxy to CacheDelegator
Kubernetes-commit: 4c635ecf8250c7493481b9b8fb88e384de1b41db
2025-02-24 19:07:25 +01:00
Davanum Srinivas 0a703e3517 Linter to ensure go-cmp/cmp is used ONLY in tests
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 4e05bc20db99ff89b2d2205218d24b9935a7fdd7
2025-01-24 17:03:29 -05:00
Marek Siarkowicz b43177846d Refactor shouldDelegateList
Kubernetes-commit: e5a3bdb3a71575af0d165e8b08cfaba7d572b802
2024-12-31 11:57:43 +01:00
Patrick Ohly b84662911c remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".

Kubernetes-commit: 8a908e0c0bd96a3455edf7e3b5f5af90564e65b0
2024-12-02 14:43:58 +01:00
Omer Aplatony 965243019f Use PollUntilContextTimeout in flowcontrol
Signed-off-by: Omer Aplatony <omerap12@gmail.com>

Kubernetes-commit: 9fe3f368b1813b491f9b1265547235f309ff87e9
2024-10-08 10:25:15 +03:00
Devesh Goyal b2a5ee84cf Updated width.go
Kubernetes-commit: ed0c2b4f3d33fe7f165ff2c39034ca062c75f964
2024-08-25 02:12:29 +05:30
Mike Spreitzer eb8f232a36 Add unit test of borrowing by exempt, fix bug
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: 9aa9d3d4b7c637a0796e5a25c312a999ac628bd9
2024-06-12 03:38:15 -04:00
Mike Spreitzer 010634c01b More assertive borrowing by exempt
Happy middle ground with what the KEP says?

Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: 56fc11f3bef9f6af16aa30731050168e732754a2
2024-05-08 02:30:27 -04:00
Lukasz Szaszkiewicz bc659f87fc flowcontrol/request/list_work_estimator: sync shouldDelegateList
Kubernetes-commit: c259fe2342162a0c883845bfbdf8a838697fe085
2024-06-17 16:14:39 +02:00
Paco Xu 1c9c46740e Revert "apiserver/storage/cacher: consistent read from cache supports limit"
Kubernetes-commit: df17ea2e37d1b36dcda10fe20de5484c41c615b5
2024-06-26 11:51:12 +08:00
Lukasz Szaszkiewicz 1e440f380b flowcontrol/request/list_work_estimator: sync shouldDelegateList
Kubernetes-commit: a7b1a9bb267cd721e673ae8352f068b4bc0b2f05
2024-06-17 16:14:39 +02:00
ah8ad3 8137baec35 Feat: warn user if etcd version is not supported for RequestWatchProgress
Kubernetes-commit: 9f8273a5c5d6d087c0839145616c828ab9a62f60
2024-04-29 15:56:35 +03:30
Alvaro Aleman da88853b95 Use the generic/typed workqueue throughout
This change makes us use the generic workqueue throughout the project in
order to improve type safety and readability of the code.

Kubernetes-commit: 6d0ac8c561a7ac66c21e4ee7bd1976c2ecedbf32
2024-04-28 18:26:18 +02:00
Marek Siarkowicz 74fb076497 Cleanup defer from SetFeatureGateDuringTest function call
Kubernetes-commit: 3ee81787685e47a7a5da22423c8ca4455577ecb3
2024-04-23 10:39:47 +02:00
José Carlos Chávez f099bff723 chore: adds consistent vanity import to files and provides tooling for verifying and updating them. (#120642)
* chore: drops update vanity imports from script.

* chore: changes copyright year to 2024.

* chore: makes lint happy.

Kubernetes-commit: 6d6398ef9266abce3518a4c9a3d4e4d8feeffdc1
2024-02-08 14:10:27 +00:00
SataQiu 7751f0aa90 remove import hack about k8s.io/utils/clock/testing
Kubernetes-commit: 81d040d538101b89bd8edd51bb78a58ea5bf793c
2023-11-16 12:30:14 +08:00
weilaaa febd537a31 use build-in max and min func to instead of k8s.io/utils/integer funcs
Kubernetes-commit: eb8f3f194fed16484162aebdaab69168e02f8cb4
2023-12-15 15:09:11 +08:00
Abu Kashem b041969f97 apiserver: allow zero value for the 'nominalConcurrencyShares' field
Kubernetes-commit: 9fd2ab419ad771790d3cb80ea7b8e6828d9ce305
2023-10-27 19:26:08 -04:00
Abu Kashem 2a3f44cd21 apiserver: fix lint issue, defaulting and validation test for flowcontrol v1
Kubernetes-commit: 430c226709b4dfd1284f6463c7a37603154ad39c
2023-10-11 14:03:42 -04:00
Abu Kashem 0b0a995736 apiserver: apf controller, bootstrap, tests should use flowcontrol v1 API
Kubernetes-commit: 17bda3c3e05a75943591f61f37d7fdc0d07870ec
2023-10-11 09:20:41 -04:00
Abu Kashem 04acc93a12 apf: request ejected from queue should use reason 'time-out'
Kubernetes-commit: 6297067ff1afaa2d63d83183a23e8744865d7c2b
2023-08-29 16:30:02 -04:00
Abu Kashem d64c9b18da apf: remove RequestWaitLimit from queueset config
Kubernetes-commit: 11ef9514dad6f46a4315198978fee14132c4bbca
2023-08-29 12:11:08 -04:00
Abu Kashem 290096a4d0 apf: remove timeoutOldRequestsAndRejectOrEnqueueLocked function
Kubernetes-commit: da8a472206623d0727ba486489d34780c4b6c1d9
2023-08-28 17:26:11 -04:00
Abu Kashem 27772523df apf: refactor promise to use a context
Kubernetes-commit: 0039f24d74d0f57c8ba868ae361821d37fd908d6
2023-08-21 15:19:31 -04:00
Wojciech Tyczyński 3030f660a8 Graduate APIListChunking to GA
Kubernetes-commit: 6acfa3cb4ac876e46ead5ba4772ba18e480435ce
2023-07-21 11:35:21 +02:00
Mike Spreitzer 7c7ff34a5a Handle edge cases in seat demand stats
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: b0e249f657a18c1435ace391fa752711dafce732
2023-08-21 15:26:38 -04:00
Andrew Sy Kim 066c7cb8cc apiserver: add flow control metric current_inqueue_seats
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: fb9646fd60d4b8e79223b729c1cb54fc6818fdd1
2023-07-24 19:40:05 +00:00
Mike Spreitzer b8bc556baa Add tracking and reporting of executing requests
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: a8a2fb317c8bc9c64ced023988802b2517d34f81
2023-06-30 22:55:35 -04:00
Andrew Sy Kim f00505bddc priority & fairness: support dynamically configuring work estimator max seats
Max seats from prioriy & fairness work estimator is now min(0.15 x
nominalCL, nominalCL/handSize)

'Max seats' calculated by work estimator is currently hard coded to 10.
When using lower values for --max-requests-inflight, a single
LIST request taking up 10 seats could end up using all if not most seats in
the priority level. This change updates the default work estimator
config such that 'max seats' is at most 10% of the
maximum concurrency limit for a priority level, with an upper limit of 10.
This ensures seats taken from LIST request is proportional to the total
available seats.

Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: d3ef2d4fe95c3ef7b1c606ad01be1183659da391
2023-04-26 11:13:14 +00:00
Mike Spreitzer 003feef4b3 Fix, deprecate apiserver_flowcontrol_request_concurrency_limit
Because it is redundant and has a bad name and its HELP string was
outdated.

Also note intended retention period for request_concurrency_in_use.

Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: 75186b1c32a7e9e92ced270eb303a686315a5c44
2023-06-29 01:29:15 -04:00
Andrew Sy Kim 73f18d34af promote the following APF metrics to beta:
apiserver_flowcontrol_request_wait_duration_seconds
apiserver_flowcontrol_request_concurrency_in_use
apiserver_flowcontrol_request_concurrency_limit
apiserver_flowcontrol_rejected_requests_total
apiserver_flowcontrol_dispatched_requests_total
apiserver_flowcontrol_current_inqueue_requests
apiserver_flowcontrol_current_executing_requests

Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: 0bb419b1498a664d1dda3b487e9f15fd220ea363
2023-07-05 18:19:36 +00:00
Mike Spreitzer 90abb3933b QueueSet and controller part of borrowing by exempt PLs
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: 7305c967101813f794449db21a6edfbc05df2575
2023-06-20 23:35:21 -04:00
Wojciech Tyczyński c7b06c9136 Add support for watchlist to APF
Kubernetes-commit: c0030a4d27e0a30d89b1b0fddb32928942ca8085
2023-06-27 16:08:33 +02:00
Marek Siarkowicz 9002dac854 Implement ConsistentListFromCache feature gate
Request bookmark every 100ms when there is at least one request blocked on revision not present in watch cache.

Kubernetes-commit: 39bb8f4bb1d013937aceac6c387563ffe13545c5
2023-06-06 15:49:46 +02:00
Mskxn 2595ae0416 use stopCh to avoid goroutine leak in tests
Kubernetes-commit: 132d477cb7aa323c0eae6dd9a09f9c93fb570b83
2023-07-06 16:24:58 +08:00
Mike Spreitzer d03cf9927b Introduce apiserver_flowcontrol_current_executing_seats metric
This is a duplicate of
`apiserver_flowcontrol_request_concurrency_in_use` but with a better
name.  Hopefully we can later remove the copy with the inferior name.

Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: 65e818d4ecfb7bf2a165897fb1caf29bf42f4f83
2023-06-29 01:43:17 -04:00
Mike Spreitzer 078694d35d Make QueueSet support exempt behavior; use it
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: f269acd12b225f6a2dbbfae64a475f73f448b918
2023-06-28 22:55:30 -04:00
Andrew Sy Kim d969ae0916 apiserver: introduce larger buckets for flowcontrol request_wait_duration_seconds bucket
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>

Kubernetes-commit: 16fdd3e5eef452712165b7625b2fec078fa79b7b
2023-06-28 15:08:15 +00:00