Commit Graph

270 Commits

Author SHA1 Message Date
Antoni Zawodny 0dcf3e9d26 Configure watch cache history window based on request timeout
Kubernetes-commit: 4a2b7ee5699331df31b7483be082c201a1e7f51f
2024-12-13 15:40:03 +01:00
Marek Siarkowicz e85d45c0a4 Use btree for watch cache storage to serve LIST more efficiently
Can be disabled via BtreeWatchCache feature flag.

Kubernetes-commit: 5ea427ebb508ce2871d4d0f9869959275c0d3bce
2024-08-17 11:01:41 +02:00
Wojciech Tyczyński 0679efd5ba Fix TestCacherDontMissEventsOnReinitialization test
Kubernetes-commit: d35ea217fa7541a2b1942aaf533697a2e4e7a222
2024-10-31 12:33:04 +01:00
Marek Siarkowicz 518e8ed25c Adding tests for using indexers in tests
Kubernetes-commit: 711772a1e15288d813a830780317a134df9acb5c
2024-08-22 20:04:37 +02:00
Marek Siarkowicz 5913dac984 Implement btree based storage indexer
Kubernetes-commit: 50d2fab27903c66837d625b6ff702cf7873e3c7f
2024-10-24 18:17:56 +02:00
Marek Siarkowicz 37f422396a Update recorders to wrap kubernetes.Client
Kubernetes-commit: 066c1c05d73690b48c872f3fbc23b7722cd44fe3
2024-07-05 14:19:49 +02:00
Abu Kashem 14881364b3 refactor: extract decode functions into an interface for etcd3 store
Kubernetes-commit: 1d1a656d8de1cdb99deaa6ec771aa354616eaa16
2024-09-24 07:19:19 -04:00
Abu Kashem 3a0975b22c refactor: add delete options for Delete method in storage interface
Kubernetes-commit: bc0ea34bc380e073a7278216fe6690a1b9aee48c
2024-09-19 10:31:08 -04:00
Lukasz Szaszkiewicz 36e57697d1 apiserver/handlers/watch: encode initialEventsListBlueprint with watchEncoder (#127587)
* apiserver/handlers/get: construct versionedList

* storage/cacher: document caching the serialization of bookmark events

* endpoints/handlers/response: add watchListTransformer

* endpoints/handlers/watch: wire watchListTransformer

Kubernetes-commit: fbf1a0dc181ccbeb9925ad9c284d913a25c16562
2024-10-01 11:55:50 +00:00
Chaunceyctx f7eddd4bda send bookmark right now after sending all items in watchCache store
Kubernetes-commit: 723920253349ee3c272c5b5a77e9d19548c1533c
2024-08-29 17:31:36 +08:00
Lukasz Szaszkiewicz eb3a20ad8b storage/cacher/cache_watcher: processInterval sets RV from the snapshot
Kubernetes-commit: de735be512767dd2eced78530693d2e3ae997e6e
2024-09-20 08:48:31 +02:00
Lukasz Szaszkiewicz 743b5776f9 storage/cacher/cache_watcher: add RV to watchCacheInterval
Kubernetes-commit: f87e4a19c88fa908eb176ee7925f211bafba9b45
2024-09-20 08:47:49 +02:00
Vadim Rutkovsky 7da1f042b3 tracing: add span for cacher.Get
Also updates tracing integration tests for cacher.GetList

Kubernetes-commit: dff0075e7cd687f77fd38337e9ba487bb2437ecc
2024-09-12 14:18:40 +02:00
Abhishek Kr Srivastav 17ab6c21d5 Fix Go vet errors for master golang
Co-authored-by: Rajalakshmi-Girish <rajalakshmi.girish1@ibm.com>
Co-authored-by: Abhishek Kr Srivastav <Abhishek.kr.srivastav@ibm.com>

Kubernetes-commit: 95860cff1c418ea6f5494e4a6168e7acd1c390ec
2024-09-12 18:15:22 +05:30
Lukasz Szaszkiewicz 87a5cdebbc storage/cacher/cacher_whitebox_test:deflake TestCacherDontAcceptRequestsStopped when ResilientWatchCacheInitialization is off
Kubernetes-commit: 5b7faca6b66dc0664f36c611867f5799377b0514
2024-09-20 06:40:47 +02:00
Lukasz Szaszkiewicz bafce892d3 pkg/storage/cacher/cacher_whitebox_test: deflake TestConsistentReadFallback when ResilientWatchCacheInitialization is off
Kubernetes-commit: 077c35ee82e40fa808fa4b45b86d843cded3cfa3
2024-09-20 06:15:22 +02:00
Lukasz Szaszkiewicz 8a764cf9c3 cacher: apply key for initial events only if the call is not recursive
Kubernetes-commit: 7cb51b1c278f9eb57c43f929fcc80bfed8438e17
2024-09-10 10:58:26 +02:00
Marek Siarkowicz a8c26a18b8 Extract watch cache store to separate file and cover with tests
Kubernetes-commit: c93d2e8fb19da0082765cb3e5a6db952eca628ce
2024-08-28 13:31:02 +02:00
Marek Siarkowicz 94a5e3cd04 Refactor WaitUntilFreshAndList to split out filtering to separate function
Kubernetes-commit: 7400d57943cf7576925d54e7daa42e397e71dfe4
2024-08-28 12:59:38 +02:00
Marek Siarkowicz de0559ec7b Benchmark storage
Kubernetes-commit: fa5008807add2776ff87f346a7b7d3c029d19efc
2024-07-02 22:50:57 +02:00
Marek Siarkowicz 132d3e46d6 Add paging tests
Kubernetes-commit: 99e69569808cf746262b25a9d9d515c26256c7e5
2024-07-07 16:15:47 +02:00
Marek Siarkowicz 6c5ee08ccf Implement fallback for consistent reads from cache
Kubernetes-commit: 35962561e44425fe5e23f19aeccba9269fab3a56
2024-07-30 18:57:22 +02:00
Matthieu MOREL 8705baa8b2 fix: enable empty and len rules from testifylint on pkg package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

Kubernetes-commit: f014b754fb5925dfbca6e27a44d0c3968b157e14
2024-06-28 21:20:13 +02:00
Wojciech Tyczyński a643e14347 Implement resilient watchcache initialization post-start-hook
Kubernetes-commit: a5772bd42593f6492f5169eef49bc9884f95abba
2024-06-13 11:02:18 +02:00
Lukasz Szaszkiewicz 5e71b4e71d apiserver/storage/watchcache: WaitUntilFreshAndList supports path prefix
Kubernetes-commit: 2f9660db6b0ba37ff383559b1b0324c635f1eb66
2024-06-26 14:34:32 +02:00
Lukasz Szaszkiewicz 54645c663b apiserver/storage/cacher: cache supports pagination
Kubernetes-commit: 09e85983d84b5f6c3fed6c09dd0adcbdde7e9d5f
2024-06-10 10:14:38 +02:00
Lukasz Szaszkiewicz 9afcce8b2b storage/cacher/cacher_whitebox_test.go: deflake TestWaitUntilFreshAndListFromCache
Kubernetes-commit: 662672a6cacd71ad0cfc168a793d6a75a7e0ffff
2024-06-26 15:04:15 +02:00
Marek Siarkowicz 6c1033e89d Remove 5 seconds from TestWatchStreamSeparation execution by reusing etcdserver
Kubernetes-commit: 1c111c603e1962b4bfd5aae40d8a5ecc0e3ad9d5
2024-06-26 11:32:57 +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 2aadb1cb38 cacher: returns an error when watch list was requested and storage.RequestWatchProgress is disabled
Kubernetes-commit: cb8cbc60a15dd340ea834974355bd2f03453727c
2024-06-17 15:29:59 +02:00
Lukasz Szaszkiewicz 062ed2e6c0 apiserver/storage/cacher: cache supports pagination
Kubernetes-commit: 87536f367dd67b4fd9b1c7ee31189896921f2f9e
2024-06-10 10:14:38 +02:00
Marek Siarkowicz 22c2235078 Explicitly disable ConsistentListFromCache in TestGetListNonRecursiveCacheBypass
Kubernetes-commit: 4e51e9cff8f48a38bb5ce45e8602842486c3a59e
2024-02-26 16:43:24 +01:00
Lukasz Szaszkiewicz 2ac45c2a57 storage/cacher/cacher_whitebox_test.go: deflake tests that require storage.RequestWatchProgress
Kubernetes-commit: 47a61f03d4fad96fb40f4c1c6857061ee68b7ca5
2024-06-17 16:54:44 +02:00
Marek Siarkowicz 2abbfffe9a Fix TestGetListRecursivePrefix for all types of LIST
Kubernetes-commit: c207f967ac3122d3a2a5ae4befdc5ada22347323
2024-06-19 10:31:37 +02:00
xyz-li e5e53b7acc apiserver: fix watch namespace
For request like '/api/v1/watch/namespaces/*', don't set scope.namespace.
Because the func `addWatcher` add a watcher to allWatchers with the value `scope.namespace` not empty.
But the function `dispatchEvent` dispatch event with an empty namespace.

Signed-off-by: xyz-li <hui0787411@163.com>

Kubernetes-commit: 818fabe37b3fd7cebe36a43244120388977373cd
2024-05-27 17:48:49 +08:00
Mauri de Souza Meneguzzo 48995fc82a Fix flaking TestStoreListResourceVersion
Kubernetes-commit: e59988d769a87ec3efb12af0f9909f7549eecf05
2024-06-11 23:12:23 -03:00
Wojciech Tyczyński 147e65f573 Reduce lock contention by using reader lock in watchcache interval
Kubernetes-commit: 6f0a400a1a7bb7d77d13181a91654f77f612c856
2024-06-11 12:20:57 +02:00
Marek Siarkowicz a8b9f862fb Add tests for how recursive parameter works with object prefixes
Kubernetes-commit: faa6193f34f7dac775328fbacb2f957370482024
2024-06-11 14:29:51 +02:00
Wojciech Tyczyński 794b1d5ff6 Expose resource version metrics from watchcache
Kubernetes-commit: dbed4f12107c549d8bb9efab105162d32316ce01
2024-06-07 09:39:23 +02:00
Wojciech Tyczyński 5a0e942d09 Implement ResilientWatchCacheInitialization
Kubernetes-commit: a8ef6e9f0104a44023162bb8229fb677ec80beb1
2024-04-29 14:19:46 +02:00
Eric Lin 9cab6e4eee cacher: apply key for initial events
For case of SendInitialEvents, a buffer of objects is created. That
process takes a significant amount of memory and CPU when the resource
is of a large volume. Many objects may be not relevant when key is provided.
This commit applies key when composing the buffer for SendInitialEvents.

Signed-off-by: Eric Lin <exlin@google.com>

Kubernetes-commit: d9c6c8aa5047d724e0ebc8907f5fee4b10012ae3
2024-05-04 10:46:02 +00:00
Lukasz Szaszkiewicz 175dd7c904 cacher: dispatchEvents is synced to watchCache.listResourceVersion
The internal informer populates the RV as soon as it conducts
The first successful sync with the underlying store.
The cache must wait until this first sync is completed to be deemed ready.
Since we cannot send a bookmark when the lastProcessedResourceVersion is 0,
we poll aggressively for the first list RV before entering the dispatch loop.

Kubernetes-commit: a20abdb1f425b215ce969ef7114281741fce249d
2024-06-03 10:26:50 +02:00
Marek Siarkowicz 2c4a9730b5 Reset timer to zero when no progress notify was sent
Kubernetes-commit: 98e384fcd093d3cff4767ee009f8164b83bd4753
2024-05-24 11:07:01 +02:00
Marek Siarkowicz 6fb09e7027 Use normal Mutex instead of RWMutex
There is no benefit of having RWMutex as we have one reader and multiple
writers. In such cases RWMutex has worse performance than Mutex.

Kubernetes-commit: 544ea424826ef60d703c5f4fb91b2c6a95f303aa
2024-05-24 10:16:48 +02:00
Marek Siarkowicz 9af63b1bc9 Don't signal when lowering number of waiting routines
Signal is not needed as we never need to wake up when the waiting
is lowered, only when increased.

Kubernetes-commit: e6b54149bb42d58301e34872ebbcf2ea4bcfb474
2024-05-24 10:13:52 +02:00
Marek Siarkowicz be4e4c6bdd Use timer instead of ticker in progress requestor
Ticker behaves differently from what we want, we need a stable period
interval, but ticker doesn't provide that. From NewTicker docstring:
```
The ticker will adjust the time interval or drop ticks to make up for slow receivers.
```

Unfortunatelly there is no way to test it as the FakeClock doesn't
follow the real ticker behavior.

Kubernetes-commit: 7c0e9cda461e176959866b9c2d03b00e817e9b76
2024-05-24 10:10:27 +02:00
Wojciech Tyczyński 34333a8e98 Reduce critical section for watchcache.lock
Kubernetes-commit: 202b4ffdf0cff90b5954d3442a1cdf7f2517cb2d
2024-05-21 13:58:35 +02:00
Lukasz Szaszkiewicz 438190132c storage/cacher: waitUntilWatchCacheFreshAndForceAllEvents checks if storage.RequestWatchProgress is supported
Kubernetes-commit: 2db69ae1cd0073da97a0efdacf5df0ad42abce4c
2024-05-14 12:53:43 +02:00
Lukasz Szaszkiewicz 0750099ebf storage/cacher: dispatchEvents use progressRequester
Kubernetes-commit: 33f81ee23fc3f48d2f3aee85661944792c117694
2024-05-08 15:43:23 +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