Commit Graph

779 Commits

Author SHA1 Message Date
Marek Siarkowicz 3adae5fd46 Make object transformation concurrent to remove watch cache scalability issue for conversion webhook
Test by enabling consistent list from cache in storage version migrator stress test that uses
conversion webhook that bottlenects events comming to watch cache.

Set concurrency to 10, based on maximum/average transform latency when
running stress test. In my testing max was about 60-100ms, while average
was 6-10ms.

Kubernetes-commit: bb686f203308481bcd7808f767171cdef27e12a0
2024-07-22 11:24:37 +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
Davanum Srinivas 1292729d42 Fix for typecheck doesn't notice compile errors in test files
- ensure we add all the staging modules so the _test files in there are "loaded"
- use build tags to skip tests that fail to build in specific os/arch pairs

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
Co-Authored-By: Tim Hockin <thockin@google.com>

Kubernetes-commit: c230a45383c372e3861de3d4854cdfe28f4c482f
2024-07-02 16:26:41 -04: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 f0e44d48b8 apiserver/storage: storagetesting.RunTestList validates RemainingItemCount
Kubernetes-commit: f9b15700fb5a99ab74d51c7779ea2aae0f51168c
2024-06-27 11:01:37 +02:00
Lukasz Szaszkiewicz 9afcce8b2b storage/cacher/cacher_whitebox_test.go: deflake TestWaitUntilFreshAndListFromCache
Kubernetes-commit: 662672a6cacd71ad0cfc168a793d6a75a7e0ffff
2024-06-26 15:04:15 +02:00
Wojciech Tyczyński 58b911dc71 Fix test flakes for TestWatchSemantics
Kubernetes-commit: 5081ba45f9ed84784a250338ee6d96b485ff4e4a
2024-06-26 17:49:54 +02:00
Lukasz Szaszkiewicz 4500696478 apiserver/storage: decrease running time of RunWatchSemantics
Kubernetes-commit: c6ef512b5bb15aa3c2430ae03dad91e16a342bce
2024-06-26 10:49:20 +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
Davanum Srinivas 11d0eb6174 drop OWNERS in kubeadm
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 16e24513b76f66bfa47a93291ec52a2fcd1e11c0
2024-06-25 06:36:05 -04:00
Davanum Srinivas cca712b8b8 Add sig/etcd labels for related directories
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1390ac0e250da4697b706c68cbb955268e27037d
2024-06-24 17:03:34 -04: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
Lukasz Szaszkiewicz 253c97b2e8 apiserver/storage: factor PrepareContinueToken to a new function (#125548)
* apiserver/storage/continue: intro PrepareContinueToken

PrepareContinueToken prepares optional
parameters for retrieving additional results for a paginated request.

This function sets up parameters that a client can use to fetch the remaining results
from the server if they are available.

* apiserver/storage/etcd3: refactor to use PrepareContinueToken

Kubernetes-commit: efef32652af0af08a0b9c9bc547a4dce4a95f9f5
2024-06-17 18:23:23 +00:00
Mauri de Souza Meneguzzo 48995fc82a Fix flaking TestStoreListResourceVersion
Kubernetes-commit: e59988d769a87ec3efb12af0f9909f7549eecf05
2024-06-11 23:12:23 -03:00
TommyStarK 2c2eb3836c kube-apiserver: remove deprecated otel NewNoopTracerProvider
Signed-off-by: TommyStarK <thomasmilox@gmail.com>

Kubernetes-commit: cce8551272de44882a3cd4fc7c06805247941086
2024-06-07 19:57:37 +02: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
Wojciech Tyczyński fd60fafe9c Deflake watchcache tests
Kubernetes-commit: 6d9edcc694415d4c1a897c4312ecd872a7f0fbf3
2024-04-29 14:26:25 +02:00
ah8ad3 2b7a0cfef8 Add FeatureSupportChecker for etcd storage
Kubernetes-commit: 70e65eee46cbf72efabe8440a92117d1fedf6497
2024-04-23 16:58:01 +03:30
Marek Siarkowicz 74fb076497 Cleanup defer from SetFeatureGateDuringTest function call
Kubernetes-commit: 3ee81787685e47a7a5da22423c8ca4455577ecb3
2024-04-23 10:39:47 +02:00
Marek Siarkowicz 5571570302 Remove workarounds for https://github.com/etcd-io/etcd/issues/17507
Kubernetes-commit: a08d1b5f3286c6f3698abf59022055dc0b4b922f
2024-04-23 12:27:03 +02:00
Marek Siarkowicz 0e8e550153 Upgrade etcd libraries to v3.5.13
Add otelgrpc.WithMessageEvents(otelgrpc.ReceivedEvents, otelgrpc.SentEvents) to tracing options due to https://github.com/open-telemetry/opentelemetry-go-contrib/pull/3964

Kubernetes-commit: 3e5b03eb433ee359782f5aa6e9368ab2a0d0370c
2024-04-23 11:10:37 +02:00
Lukasz Szaszkiewicz dcdc23d1b3 apiserver/storage/cacher: decrease running time of TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived
before:
go test -v -race -count 1 -run ^TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived$
ok  	k8s.io/apiserver/pkg/storage/cacher	3.792s

after:
go test -v -race -count 1 -run ^TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived$
ok  	k8s.io/apiserver/pkg/storage/cacher	1.783s

Kubernetes-commit: d21b86d53a3c4c42e41f8374e537c721251a00d2
2024-03-14 10:44:51 +01:00
Abhishek Kr Srivastav 1d434b32e1 Added locks when accessing dummyStorage to prevent data race
Removed redundant locks

Removed locks and used existing func

Kubernetes-commit: eb5d2ca9d8efd6dcbbea582920c700ae86db4132
2024-03-20 14:23:33 +05:30
Wojciech Tyczyński b1a1768456 Relax WatchSemanticsTest to make it faster
Kubernetes-commit: a26ee123952eeb86467e61ff2eb744c9e736a045
2024-03-19 20:23:56 +01:00
Lukasz Szaszkiewicz 9bfd27dc1c apiserver/storage: use metav1.InitialEventsAnnotationKey const
Kubernetes-commit: ed2b92c3dfb7d56155021824f0d9a61609dac051
2024-03-11 11:40:21 +01:00
Lukasz Szaszkiewicz d4f6eff589 apiserver/pkg/storage/utils: remove unused EverythingFunc
since we don't provide compatibility guarantees for the storage
package it is okay to simply remove unused function.

Kubernetes-commit: a40f25f8e6516d1a59169cf88db8b3850a8c48c7
2024-03-11 11:47:02 +01:00
Davanum Srinivas a22f7973bf Rename `cluster` to `storage_cluster_id` for apiserver_storage_size_bytes metric
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: fb5140f562289f3ffe596b4a3af4650b850a0941
2024-04-11 15:06:03 -04:00
Marek Siarkowicz 7a3a726271 Undo double run of the TestWatchSemantics test to avoid hitting timeout
Kubernetes-commit: 225749eb68b3aa3485a1f2dc5d0cafb5dfe53421
2024-03-19 15:16:52 +01:00