Commit Graph

3720 Commits

Author SHA1 Message Date
Tim Hockin 9641d30242 Use randfill, do API renames
Kubernetes-commit: e54719bb6674fac228671e0786d19c2cf27b08a3
2025-02-20 09:45:22 -08:00
Marek Siarkowicz 4305a14262 Separate compactWatchCache from increaseRV
Kubernetes-commit: 15cb82b3b3fa95ba5b914a5a02ac01d42eda892f
2025-02-25 14:44:50 +01:00
Marek Siarkowicz f422062046 Pass storage.ListOptions to WaitUntilFreshAndList
Kubernetes-commit: e6cf9dd1663a9a54fa673873e8e97641f69bcefd
2025-02-19 11:20:04 +01:00
Tim Hockin 0b0eaa35e1 Fix up ErrorMatcher from feedback
a) Rename the type and drop the constructor
b) Make MatchErrors() into a Test() method

For followup:

c) Consider making ByType() assumed
d) Consider making ByField() assumed and handle nil as "don't care"
e) Consider making ByValue() assumed and handle nil as "don't care"

Kubernetes-commit: 0a9f492eedf6dd68fee12e4606d3fef4d608d88f
2025-03-03 10:23:18 -08:00
Jefftree b12d7a1290 Allow OpenAPI verification to pass both with and without strict alpha
handling

Kubernetes-commit: c597cc1f30977bcfaba5aebb2ed7983f578b1f2c
2025-02-20 15:57:37 +00:00
Harish Kuna 6faeace534 Debug latencies in request handler
Kubernetes-commit: 186e6ee2bd55da286f39eef56c83376f3f79e09d
2025-02-25 01:33:14 +00:00
Marek Siarkowicz 79ec45326d Run lists tests in subtests
Kubernetes-commit: 7a84e7630f91014fa3b632d8800e9a943003001c
2025-03-03 20:50:37 +01:00
Joe Betz 7c0ba21066 Add declarative validation utility for use from strategies
Kubernetes-commit: ffc1b32c660e3480381f4b13d0fbaa1313cf1318
2025-03-03 19:37:11 -05:00
Joel Speed 64791740ae Fix implementation of ContainsCIDR to allow non-equal addresses
Kubernetes-commit: b7c80f7f1592356e796a64958bec9a05e0fe3ba1
2025-02-26 14:24:58 +00:00
Marek Siarkowicz 38b01a1f78 Streaming JSON encoder for List
Kubernetes-commit: e7c743b2ebfaed1e3132027c0369ac25b14b6f47
2024-12-19 10:38:30 +01:00
z1cheng c576a626de Implement chunking for gzip encoder in deferredResponseWriter
Signed-off-by: z1cheng <imchench@gmail.com>

Kubernetes-commit: 2472f4965fe2f2013b993b6b56539946a21a3740
2025-02-20 18:36:47 +08:00
Marek Siarkowicz 9e523945a2 Remove limit support from btree store
We cannot use limit as it would apply it before filtering, which is done
in cacher. Limit is not currently used, but let's remove it to be save,
until filtering is implemented in store.

Kubernetes-commit: 168c338f7cb44a08f3d1a7e1d0e72cac241e9a29
2025-02-25 19:17:30 +01:00
Marek Siarkowicz 3ad93853da Move GetCurrentResourceVersion to storage.Interface
Kubernetes-commit: fea89f25d1bfd7290bb0165f49a6d288ab5f717a
2025-02-24 19:49:45 +01:00
Marek Siarkowicz a4587170bd Move watch progress to separate package.
Kubernetes-commit: 740db0f01d9bceaa7bd6c0b6c5e5f96fc78c04dd
2025-02-25 13:53:17 +01:00
Marek Siarkowicz a64613cb08 Rename CacheProxy to CacheDelegator
Kubernetes-commit: 4c635ecf8250c7493481b9b8fb88e384de1b41db
2025-02-24 19:07:25 +01:00
carlory 13a27b8dd7 Fix a bug where the `ResourceQuota` admission plugin does not respect ANY scope change when a resource is being updated. i.e. to set/unset an existing pod's `terminationGracePeriodSeconds` field.
Kubernetes-commit: eb0f003d25209c850b47a275358aea53252274b4
2025-02-10 14:30:50 +08:00
Lukasz Szaszkiewicz 3aea7778be storage/cacher/ready: dynamically calculate the retryAfterSeconds
retryAfterSeconds is based on the time elapsed since the state (ready, unready) was last changed.

Kubernetes-commit: 04f0bd4e83bbc0a24b8a924333544be86b252c97
2024-10-14 08:17:14 +02:00
Marek Siarkowicz 09c0e7d0cd Add snapshotting of watch cache behind a feature gate
Kubernetes-commit: 2de2093bcef6544ef17c84116fbd751fc429820a
2025-02-19 17:03:48 +01:00
Marek Siarkowicz d522031d97 Ensure that btree threadedStoreIndexer implements orderedLister
Kubernetes-commit: 99881453838a63730fb34b6bd02775ae08320184
2025-02-19 11:47:26 +01:00
Antoni Zawodny efe7a1b26d Add watch cache capacity upper bound adjusting logic
Kubernetes-commit: 2173a0fafd448e55b7738b88fbbab392125dd975
2025-02-21 15:07:01 +01:00
xin.li a3d85c236b enable go-required check
Signed-off-by: xin.li <xin.li@daocloud.io>

Kubernetes-commit: d92c70b82693f3c974e63dcf7abd2d5068c0530c
2025-02-23 16:54:43 +08:00
xin.li afb79f83b3 fix wrong assertion on tests
Signed-off-by: xin.li <xin.li@daocloud.io>

Kubernetes-commit: bc4ae15d77beab23f321bf6547f82c04ba27c3fa
2025-02-22 12:39:01 +08:00
Marek Siarkowicz 476d81d4ba Test continuations and exact revision LISTs
Kubernetes-commit: 034285dc4774f2217ca4df4626ca44b8f5f4f261
2025-02-18 17:32:41 +01:00
Marek Siarkowicz 1e6e6f0a46 Refactor TestList and validate continuations to allow testing pagination and more exact RVs in the future
Kubernetes-commit: 764e13e27aedfd9e304e6014af23f20b5619216b
2025-02-19 17:10:58 +01:00
张可10140699 9da16fa551 Fix non-recursive list should also read RequestWatchProgress feature when consistent list from cache is enabled
Kubernetes-commit: bdf2e2d0646fcb6fa56289d85222e2de0b686244
2025-02-20 08:39:36 +08:00
Jordan Liggitt 1bac1a3a1c prevent deletionTimestamp from moving into the past
Kubernetes-commit: 88090c49732ff53ce09d4872b6029e21d33361ba
2023-09-02 13:09:42 -04:00
HirazawaUi c533eff8e7 adjusting loopback certificate validity in kube-apiserver
Kubernetes-commit: 553e9bf84d199be3d6a3da6675671859723219f4
2025-02-08 19:43:48 +08:00
nkeert 11288ef6c1 Add a test to validate deferredResponseWriteron multiple write calls
Signed-off-by: nkeert <197718357+nkeert@users.noreply.github.com>

Kubernetes-commit: 45e2f3e438e18b74f3b7a6645ff2073862ef0e38
2025-02-15 10:23:21 +05:30
Wei Fu 2a04234bdc proxy: should add PingPeriod for websocket translator
IIUC, before using the translator handler, the ping data can be delivered from
the client to the runtime side since kube-apiserver does not parse any client
data. However, with WebSocket, the server responds with a pong to the client
without forwarding the data to the runtime side. If a proxy is present, it may
close the connection due to inactivity. SPDY's PingPeriod can help address this
issue.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
Co-authored-by: Antonio Ojea <aojea@google.com>

Kubernetes-commit: dc59c0246fb407dcf035afc224f63fcf0da8244e
2025-02-12 21:39:59 -05:00
Lukasz Szaszkiewicz 23e8a6cc2f cacher: decrease the running time of TestConsistentReadFallback
Kubernetes-commit: 601c0e359dc959bbfaf42c5d8a8a0a9a2175db74
2025-01-28 13:31:43 +01:00
Lukasz Szaszkiewicz 8a149c9296 cacher/cacher_whitebox_test: newTestCacherWithoutSyncing allow passing a clock
Kubernetes-commit: cfd6d9a2b4476d4256959dc2ebdd517f20191ea3
2025-01-27 19:51:35 +01:00
Aleksander Mistewicz 87cccf7779 Limit ResourceQuota LIST requests to times when informer is not synced
This should reduce the number of slow (100ms) LIST requests when there
are no ResourceQuota objects present in the namespace. The behavior
stays virtually the same.

Kubernetes-commit: b346ac0f8e013cedb8d91b4065d385f84e81c43e
2025-02-12 13:34:09 +01:00
Marek Siarkowicz c1a2d5992c Graduate BtreeWatchCache feature gate to GA
Kubernetes-commit: e0f548183c46b1a488afa788666638b99499fb3a
2025-01-31 15:33:07 +01:00
Siyuan Zhang 9bb4aa730a Refactor compatibility version code
Replace DefaultComponentGlobalsRegistry with new instance of componentGlobalsRegistry in test api server.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

move kube effective version validation out of component base.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

move DefaultComponentGlobalsRegistry out of component base.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

move ComponentGlobalsRegistry out of featuregate pkg.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

remove usage of DefaultComponentGlobalsRegistry in test files.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

change non-test DefaultKubeEffectiveVersion to use DefaultBuildEffectiveVersion.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

Restore useDefaultBuildBinaryVersion in effective version.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

rename DefaultKubeEffectiveVersion to DefaultKubeEffectiveVersionForTest.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

pass options.ComponentGlobalsRegistry into config for controller manager and scheduler.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

Pass apiserver effective version to DefaultResourceEncodingConfig.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

change statusz registry to take effective version from the components.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

Address review comments

Signed-off-by: Siyuan Zhang <sizhang@google.com>

update vendor

Signed-off-by: Siyuan Zhang <sizhang@google.com>

Kubernetes-commit: 8fc3a33454ba38783bb63de41ecf5343e2ced67c
2024-12-20 07:03:03 +00:00
Marek Siarkowicz 66f788143e Flip SeparateCacheWatchRPC feature gate to false and deprecate it.
Watch requests to etcd are mapped to a single stream that has a limited throughput.
By opening a lot of concurrent watch requests to single resource, users
could starve other watches from getting any events.

Separating the RPC was meant to protect the watch opened by cache.
However, as we are no longer planning to allow users to open watch directly to etcd,
the flag is not needed.

Kubernetes-commit: 4a5bbc4c159ec7d185d5fc39b95c48dbf3fab7d9
2025-01-31 11:38:58 +01:00
Marek Siarkowicz 0167eb5d20 Deprecate WatchFromStorageWithoutResourceVersion
Around the 1.31 release, we discovered that a change introduced in 1.27 allowead
clients to open WATCH requests directly to etcd. This had detrimental consequences,
enabling abusive clients to bypass caching and overwhelm etcd.
Unlike the API server, etcd lacks protection against such behavior.

To mitigate this, we redirected all WATCH requests to be served from the cache.
The WatchFromStorageWithoutResourceVersion feature gate was retained as an escape hatch.
However, since we have no plans to allow direct WATCH requests to etcd again,
this flag is now obsolete.

Direct WATCH requests to etcd offer no advantage, as they don't provide stronger
consistency guarantees. WATCH operations are inherently inconsistent; unlike LIST
operations, they do not confirm the resource version with a quorum. While Kubernetes
uses the WithRequireLeader option on WATCH requests to prevent maintaining connections
to isolated etcd members, the API server provides the same level of guarantee through
its health checks, which fail if it cannot connect to etcd member.  Therefore,
the WatchFromStorageWithoutResourceVersion feature gate can be deprecated and removed.

Kubernetes-commit: 065bf2004d27e5e3f1be3c0f128347d4060d8954
2025-01-31 11:49:28 +01:00
Abhishek Kr Srivastav 55da1afddb Additional timeout to receive all watchEvents
Kubernetes-commit: f6b527cb54e37513bbe60edb52890f3de481d000
2025-01-31 10:19:19 +05:30
Cici Huang 69f7857a7a Update the env option.
Kubernetes-commit: 8a3d0d68a20958d82f119c56036750f18bc52963
2025-02-03 18:07:23 +00:00
yongruilin ee59411d80 feat: add a lint rule to prevent Add unversioned featuregate
Kubernetes-commit: 8a0937c03467d04a25e10473e9570d2c8286cf4b
2025-01-24 11:02:16 -08:00
Cici Huang 3a132bfa52 Add test for compatible version
Kubernetes-commit: e179f0e364d58681377286c76af66e6084310f02
2025-01-13 19:11:32 +00:00
Paco Xu a2ab8dc0e3 remove GAed EfficientWatchResumption since v1.24
Kubernetes-commit: 69964319d1466d39a190a634a78440247ef83316
2025-01-22 16:50:26 +08: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
Joel Speed a3f27ceda4 Drop declaration of IP/CDIR type CEL variables
Kubernetes-commit: 2b24c518b04b67070c2e6bdbeb9f8ee74eb429c8
2025-01-23 15:15:42 +00:00
Zhonghu Xu 29de537bfa Cleanupï: only initiate http2 server options when http2 is not disabled
Kubernetes-commit: a2a0a7521027c2887855dcc0c16857c79f720826
2025-01-09 11:28:51 +08:00
Paco Xu b66aedfe5c remove APIListChunking which was GAed since v1.29
Kubernetes-commit: 8d7aed698b772d38087103f385569ab769647923
2025-01-17 15:56:19 +08:00
Dr. Stefan Schimanski ca7102a0c4 apiserver/admission/cel: add unit tests for JSONPatch expressions
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>

Kubernetes-commit: 78f9f214c02f8476b49749d23ffcd2fc312b5c39
2024-12-19 11:59:52 +01:00
张可10140699 e802cf6daf remove duplicate getAttrsFunc calls to reduce temporary memory allocations
Kubernetes-commit: 479ff5a02b026caec40e8262785e8ffffb42085a
2025-01-15 10:15:02 +08:00
Marek Siarkowicz a6c0914bb9 Only test requests that pass validation
Kubernetes-commit: 1b2bacda5bd978b68a6dc704606495b29b181690
2025-01-09 12:55:45 +01:00
Davanum Srinivas 5f060d93ca Drop github.com/asaskevich/govalidator
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 43d86c2a3ef056789c67b0f80bd1ebfcd375a0d4
2025-01-14 13:33:54 -05:00
Omer Aplatony 7ca4de7334 lint: removed empty line
Signed-off-by: Omer Aplatony <omerap12@gmail.com>

Kubernetes-commit: c0b49120e5318202b79a28212db150079acdfb01
2025-01-14 11:42:50 +02:00