Commit Graph

3814 Commits

Author SHA1 Message Date
Anish Ramasekar 9333a5f386 Duplicate v1beta1 AuthenticationConfiguration to v1
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: aea874e5e47c1740d12f1dbea6bba8249407c9f8
2025-05-13 15:48:04 -07:00
Karl Isenberg 80961690c3 test: Use sub-tests in watch tests
- Use sub-tests to avoid side-effects between test cases,
  cancel the context between cases, and make it easier to
  determine the failing case in the test logs.
- Use anonymous closures in benchmarks, instead of sub-tests,
  so the times still include all cases.

Kubernetes-commit: 0e5eab042c314851ae4e653f0037fe901baf94d8
2025-05-01 12:16:42 -07:00
Marek Siarkowicz 6764e31cac Separate getList and watch errors to prevent TestGetCacheBypass flakes
The TestGetCacheBypass requires watch cache to be initialized after
which it will want backend to return errors to check what requests are
cached and which are not.

The watch cache is marked as ready after a list succeeds, but before a watch request is executed.
If watch request fail it will immidietly flip back to unready.

Injecting error after watch cache was ready didn't guarantee that watch
request started, sometimes causing watch to be called after and fail.
This immidietly caused the watch cache to be again unready for the rest
of the test.

The fix is just to separate failure injection for List and Watch
responses.

Kubernetes-commit: 70e05132645d5c49cf0ac61a3ae8869dc60f0bde
2025-05-14 15:52:06 +02:00
Jordan Liggitt 067a2139bb Set non-experimental WatchProgressNotifyInterval config field
Kubernetes-commit: 6b0ebedccc19f3fbf877487cffa34c3694d0c275
2025-03-27 11:54:39 -04:00
Karl Isenberg 32e916b79d test: Close response body in watch tests
- Close response body after http calls in the watch tests
- Add apitesting utility methods for closing and testing errors
  from response body and websocket.
- Validate read after close errors.

Kubernetes-commit: 9d963298a3b7b828f01a9b02af57863a7480eb0b
2025-04-29 17:32:48 -07:00
Davanum Srinivas bc489d7b1b Update staging/src/k8s.io/apiserver/pkg/audit/request_log_test.go
Co-authored-by: Tim Allclair <timallclair@gmail.com>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 721947a5703f2ffaafdc9bef983a6b60c6253ca8
2025-05-12 13:29:57 -04:00
Davanum Srinivas b45c4547ed review from tallclair
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 153233c677d62c0254d54c1e7013645a081ac03d
2025-05-12 12:50:38 -04:00
Davanum Srinivas bda7e28bbb Avoid encoding in LogResponseObject when we are not going to use it
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: e418ee3a92ca6c670d26f775b0f669e8a5fe233c
2025-05-12 09:29:22 -04:00
Davanum Srinivas 1ffdd2403f Eliminate AuditContext`s SetEventLevel
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
Co-Authored-By: Jordan Liggitt <liggitt@google.com>

Set event level during context init

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 960a4939f2502f2a8f2b923203e9075354e4bdc0
2025-05-09 06:57:31 -04:00
Karl Isenberg 1552f6cea3 test: pass the test context to http requests
This handles canceling the request after the test completes, cleaning
up resources on the client and server.

Kubernetes-commit: 080d6f9ead740ec1358e320e388f79cc4de97697
2025-04-29 17:05:13 -07:00
Karl Isenberg 46dd96ca03 refactor: Stop using ioutil in apiserver
- The ioutl package is deprecated. Migrate to os package functions.

Kubernetes-commit: f93e4645c18c6f56bfddc158ef7b3f674b3c41dd
2025-05-08 11:28:52 -07:00
sxllwx e6df86ea96 Fix API server crash on concurrent map iteration and write
Improve audit context handling by encapsulating event data and operations behind a structured API. Make
the Audit system more robust in concurrent environments by properly isolating mutable state. The cleaner
API simplifies interaction with audit events, improving maintainability. Encapsulation reduces bugs
by preventing direct manipulation of audit events.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
Co-Authored-By: Jordan Liggitt <liggitt@google.com>
Co-Authored-By: sxllwx <scottwangsxll@gmail.com>

Kubernetes-commit: 75afa1e0acfb309d984be14937a06f796f220cd6
2023-10-23 20:59:40 +08:00
Karl Isenberg 61451f57b1 refactor: Add request method constants
This avoids linter errors from using inline strings as http request
methods.

Kubernetes-commit: e81887276c65acccc5486f2ff69d8bc54ac3c6ca
2025-04-29 16:45:30 -07:00
Joe Betz 5f14a1e225 Reorganize scheme type converter into apimachinery utils
This removes a dependency from generated applyconfigurations to a testing
package. To do this, the type converter in the testing package has been
moved out to the apimachinery package and the utilities the converter
depend on have been reorganized.

Kubernetes-commit: 4821604f83a6f4764497879b666087ba7cb05060
2025-05-07 10:07:55 -04:00
Ali Abbasi Alaei b6cfd80a0d pkg/storage/cacher/cacher_whitebox_test: deflake TestWatchNotHangingOnStartupFailure when ResilientWatchCacheInitialization is on
Kubernetes-commit: 2073ba2372b2cd1c53b327a50656a2cdd13decba
2025-05-01 16:55:49 -04:00
Joe Betz 62514be921 Apply feedback
Kubernetes-commit: 10c5bdd6a1a98222940c72e9c13ed0ccbb65322e
2025-05-05 15:03:11 -04:00
Joe Betz 7e75755a5a Expand has() tests for omitempty and omitzero
Kubernetes-commit: 47fddb08f75939ce6e40d0217ea1f4d5072b1ed0
2025-05-02 20:52:08 -04:00
Joe Betz 0de899d1ed Add subresource to operation, do not special case subresources in validation-gen
Kubernetes-commit: 2119555e02b357db58e460cd8f38bf187b5f837b
2025-03-26 21:26:14 -04:00
Davanum Srinivas 71463feb30 Adding test case for the webhook behavior change
Authored-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 3be3051fb77be1a1ad250c04a68efe8c6bf61940
2025-05-06 09:23:46 -04:00
Davanum Srinivas 0f91510ab0 Treat error decoding a mutating webhook patch as error calling the webhook
Co-Authored-By: Matthew Wong <mattwon@amazon.com>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: cf82fd7e9ceac60b7a336c90958835865c4f2f0a
2024-10-23 15:52:41 -07:00
Joe Betz c199f9d392 Fix CEL equality bug for structs will nil field not marked as omitempty
Kubernetes-commit: 66b8a8427cf0be6f6a87ea3384e7213696bdfd4c
2025-04-30 09:16:44 -04:00
Jordan Liggitt 0d11839195 Drop null creationTimestamp from test fixtures
Kubernetes-commit: 6bb6c9934294d8265197c9dfc4c9dd3adaca147a
2025-03-24 09:37:26 -04:00
Monis Khan dbbb6a075e jwt: refactor CEL eval to drop unstructured and map[string]any
This prepares us to add support for distributed claims support in
CEL expressions.

Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 43d6ea12e3f757e46e17311801a596aa5e70b06e
2025-04-28 17:19:54 -04:00
Joe Betz 847f0cb7d3 Appease linters
Kubernetes-commit: ea64418271408a6db07b3e6c30f5e42504222af5
2025-04-29 15:37:26 -04:00
Joe Betz f52dfa0eb4 Add lazy reflective CEL object wrapper
Kubernetes-commit: 064074c07ac3c521483b592f37f2a58d4583ee39
2025-04-04 10:03:38 -04:00
Wojciech Tyczyński fc69168d19 Fix etcd3 watcher flake
Kubernetes-commit: c3bb59d078a023153c6ea0c9a93e535b48f2557d
2025-04-24 11:32:49 +02:00
Jon Huhn a4a670721b Fix comment typos
Kubernetes-commit: 006ebbc33a842ed102983c390892d03e908593b9
2025-01-07 21:18:10 -06:00
xigang 056896e970 Fix typo in ResourceEncodingConfig comment
Signed-off-by: xigang <wangxigang2014@gmail.com>

Kubernetes-commit: f844abfc6f950fd90a3b66355641ec53879d79a2
2025-04-18 15:55:38 +08:00
Karl Isenberg 4c858d18eb chore: move watch handler tests to handlers pkg
- Move the watch handler unit tests to the same package as the
  WatchServer implementation.
  k8s.io/apiserver/pkg/endpoints -> k8s.io/apiserver/endpoints/handlers
- Copy over minimal scheme and codec test setup
- Refactor the tests to use testify assert and require

This unblocks making WatchServer private, if we decide to do that.

Kubernetes-commit: 7fcc1bcf1d1fdb2da6ea1c5b49798a7c7eeb6e6d
2025-04-15 16:34:28 -07:00
Antoni Zawodny cd728bc91b Remove FlowSchemas handling non-leases-backed leader election
Kubernetes-commit: 2800c16c8b97991b228c00b86934daa134f08add
2025-04-08 13:57:46 +02:00
Wojciech Tyczyński 4f42467c04 Simplify etcd3 watcher
Kubernetes-commit: 6d6abaab7d1b8f288ed949a115cc769d83bf0fe2
2025-03-24 14:02:07 +01:00
Benjamin Elder 0710a6fd0a make update
Kubernetes-commit: 1c3dc397ae137cc8b1d2095ea33217a239b81b55
2025-03-21 18:19:43 -07:00
Benjamin Elder 81c5d13c4d remove inaccurate hostNetwork doc comment
also remove from copies in example / test APIs

Kubernetes-commit: 8af1629f7aeeabeaec21f3fbcee5bc60d9ad2015
2025-03-21 18:19:29 -07:00
Rafael Franzke 213eed6ea1 Allow disabling caching for webhook authorizers when using `apiserver.config.k8s.io/v1{alpha1,beta1}.AuthorizationConfiguration` (#129237)
* Introduce new boolean `cache{Una,A}uthorizedRequests` field

* Run `hack/update-codegen.sh`

* Respect legacy flags values for caching

With the legacy `--authorization-webhook-cache-{un}authorized-ttl`
flags, caching was disabled when the TTL was set to `0`, so let's
continue doing so when building the authz configuration struct.

* Pass TTL=0 to webhook authz plugin when cache disabled

Kubernetes-commit: fa8e37f7805d608c121f07da5259d3086436d397
2025-04-23 22:30:52 +02:00
David Mengqi Yu c9834df380 Add example in etcd override flag help text
Kubernetes-commit: 44d31af29bf442520722024f7fa58a64b44d68de
2024-09-04 12:28:53 -07:00
David Eads f5da7d2a32 Stop exposing list-via-watch from the server
With StreamingCollectionEncodingToJSON and
StreamingCollectionEncodingToProtobuf, the WatchList must re-justify its
necessity.  To prevent an ecosystem from building around a feature that
may not be promoted, we will stop serving list-via-watch until
performance numbers can justify its inclusion.

This also stops the kube-controller-manager from using the
list-via-watch by default.  The fallback is a regular list, so during
the skew during an upgrade the "right" thing will happen and the new
StreamingCollectionEncoding will be used.

Kubernetes-commit: 660df229bf3929741cf31659187060d0c651dcf9
2025-04-17 16:34:46 -04:00
Siyuan Zhang 5a4ec0a797 bug fix: fix version order in emulation forward compatibility.
Signed-off-by: Siyuan Zhang <sizhang@google.com>

Kubernetes-commit: b1a9cc347311012bade7230b55ab95229a1e22c9
2025-04-07 18:38:43 -07:00
Wojciech Tyczyński b9e86eb851 Fix race for sending errors in watch
Kubernetes-commit: c8c2844aaf1d04835624ff2d46417492e10dec11
2025-03-24 14:02:07 +01:00
Jordan Liggitt 1776f0c3f2 Parallelize cacher list tests
Kubernetes-commit: eca90dab3f553c5794e780c67e17ae75d9acb65b
2025-03-31 15:17:04 -04:00
Marek Siarkowicz e228aeaf39 Don't start etcd for skipped test
Kubernetes-commit: 1a15d582ae5fc84177f305d93ff473cca5de6f93
2025-03-31 21:06:54 +02:00
Marek Siarkowicz 29a5d82129 Stop cacher in TestWatchStreamSeparation to speed up shutdown
Kubernetes-commit: 75186095c58630fde0b3f89892c69c8ef91fffab
2025-03-31 21:28:21 +02:00
Marek Siarkowicz 30b60eb0a6 Fix flake, non-consistent list doesn't give any guarantees about staleness
Kubernetes-commit: 38d5cb368dd95b7f185dbba97fc3e193f48a83f2
2025-03-31 08:10:42 +02:00
Marek Siarkowicz aed144f141 Ensure that cacher is terminated in TestGetListRecursivePrefix
Kubernetes-commit: 9b5c4504ee49c366be3d7c806482ef4665dc5f70
2025-03-31 18:17:08 +02:00
David Ashpole 6898b8387d restrict trace context propagation to system:master and system:monitoring
Kubernetes-commit: 3842d74d97d803372eb8e2d6cfc3d3d56a4c7a0d
2024-09-01 18:03:26 +00:00
Marek Siarkowicz 6811fdeb2d Unify should delegate list
Kubernetes-commit: 8fdd6fe4768d81da09f339c1dda831a05bb26f00
2025-03-20 11:08:37 +01:00
Marek Siarkowicz 5a059075db Serve LISTs with exact RV and continuations from cache
Kubernetes-commit: f82c9e56d928d1028d4b298578f275a2e5e69490
2024-07-03 21:36:51 +02:00
Siyuan Zhang b94acad08e chore: update emulation version help msg.
Signed-off-by: Siyuan Zhang <sizhang@google.com>

Kubernetes-commit: 0ec6566c68c4e10b0379518bb91fdc4edfce7adc
2025-03-19 10:29:42 -07:00
yongruilin 8702b38eb1 chore: Remove unused unversioned feature gate map by consolidating feature gate files
Kubernetes-commit: 7b5cbbb9618ae369fc5d5379703b3c2bda3f9d73
2025-02-12 13:41:01 -08:00
Marek Siarkowicz fa558b198a Create Snapshotter interface to fake the implementation
Kubernetes-commit: 3edeb60c089106229b582a8c6800388de433426a
2025-03-19 14:04:47 +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