Commit Graph

1097 Commits

Author SHA1 Message Date
Ben Luddy 0b5852eb9a Wire serving codecs to CBOR feature gate.
Integration testing has to this point relied on patching serving codecs for built-in APIs. The
test-only patching is removed and replaced by feature gated checks at runtime.

Kubernetes-commit: 439d2f7b4028638b3d8d9261bb046c3ba8d9bfcb
2024-11-01 16:05:32 -04:00
Ben Luddy ca9c3d965e Add CBOR feature gates.
For alpha, there is one apiserver feature gate and two client-go feature gates controlling
CBOR. They were initially wired to separate test-only feature gate instances in order to prevent
them from being configurable at runtime via command-line flags or environment variables (for
client-go feature gates outside of Kubernetes components). All of the integration tests required by
the KEP as alpha criteria have been implemented. This adds the feature gates to the usual feature
gate instances and removes the temporary code to support separate test-only feature gate instances.

Kubernetes-commit: 072dfcb416fd4e1ddab0a89ac4faf519e268bc96
2024-11-04 10:40:19 -05:00
Joe Betz a5e93cb37c Add MutatingAdmissionPolicy plugin to admission chain
This expands the generic plugin support to both validating and mutating policies.  It also adds the
mutating policy admission plugin using the generics plugin support.

This also implements both ApplyConfiguration and JSONPatch support.

Co-authored-by: Alexander Zielensk <alexzielenski@gmail.com>

Kubernetes-commit: 25e11cd1c143ef136418c33bfbbbd4f24e32e529
2024-10-25 13:46:58 -04:00
Joe Betz 7d5891a801 Unit test for emulated storage version selection
Kubernetes-commit: d5517b7a518c60e8e6f1aadc1806f4e2a254d6a9
2024-10-30 13:15:35 -04:00
Joe Betz f0baf72379 Don't pick versions that have a replacement as storage version
Kubernetes-commit: af811be190b7d04a49ecf47bf55a3858fa7e7e96
2024-10-30 11:47:43 -04:00
Kubernetes Prow Robot 4bece4d457 Merge pull request #128196 from richabanker/move-version
Move k8s.io/apiserver/pkg/util/version to component-base

Kubernetes-commit: 119f114f012ae6d1cd851bdb2c3f849307e83258
2024-10-29 18:49:35 +00:00
Ben Luddy f27bb5491e Wire test-only feature gate for CBOR serving.
To mitigate the risk of introducing a new protocol, integration tests for CBOR will be written using
a test-only feature gate instance that is not wired to runtime options. On alpha graduation, the
test-only feature gate instance will be replaced by a normal feature gate in the existing apiserver
feature gate instance.

Kubernetes-commit: 0cad1a89b6721308746cc1a12f12de31a259a0d3
2024-10-23 16:36:25 -04:00
Mangirdas Judeikis 3e52ced45d fully remove StopCh
Signed-off-by: Mangirdas Judeikis <mangirdas@judeikis.lt>

Kubernetes-commit: fd76176811654c409cd6799de4a174bcb051a90d
2024-09-13 12:08:57 +03:00
Vinayak Goyal 9da53c5ba3 KEP-2862: Fine-grained Kubelet API Authorization
Signed-off-by: Vinayak Goyal <vinaygo@google.com>

Kubernetes-commit: b1f290d444f75b351f77f4d3292bbf557ae1cc45
2024-09-29 04:02:55 +00:00
Monis Khan 4f8e2cfe4c kmsv2: run KDF tests in parallel
This change updates the KDF "feature flag" to be per KMS provider
instead of global to the API server.  This allows integration tests
that use distinct provider names to run in parallel.

Locally this change reduced the runtime of
test/integration/controlplane/transformation by 3.5 minutes.

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

Kubernetes-commit: 43740c0def10f22a0ab7f522c1569188913b35a3
2024-10-16 15:01:35 -04:00
Sean Sullivan e6b796812a TracingConfiguration is now validated strictly
Kubernetes-commit: a9c8061b1e4c2ac38c223fa6bf9c5c1bf8b01606
2024-10-14 18:09:16 -07:00
Sean Sullivan 285603b2d8 EgressSelectorConfiguration now uses strict validation
Kubernetes-commit: 32b2eea50d6457b4b1abf50e8e03be52e81d30c2
2024-10-11 16:17:09 -07:00
Lukasz Szaszkiewicz 3257d91a56 server/config: assing system:apiserver user to system:authenticated group
Kubernetes-commit: dfeb560d4a2294c7a9a6233e2acb6b27039ed37a
2024-10-07 17:39:10 +02:00
Abu Kashem 4483cc97cf apiserver: all bookkeeping must complete before apf handler returns
all bookkeeping must complete before the apf handler returns,
whether it panics or returns normally

Kubernetes-commit: 71d9307eaeda86d6a205548ecdeb7fbf226d7d82
2024-09-05 12:01:36 -04:00
Abu Kashem a785076ef7 apiserver: fix apf watch test
the assert to verify that 'atomicReadOnlyExecuting' is zero
should be executed if the apf handler panics, all apf
bookkeeping must be completed before the handler returns

Kubernetes-commit: 0c8632de57075191e6c4e34897fb7871034c7081
2024-09-05 11:57:47 -04:00
Matthieu MOREL e32a42cf11 fix: enable expected-actual rule from testifylint in module `k8s.io/apiserver`
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: fbd773ecb82aa0afef3c02274db901afe1788220
2024-09-27 07:49:07 +02:00
Matthieu MOREL 9996ba35fd fix: enable compares rule from testifylint in module k8s.io/apiserver
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: 6e82050ef0e8eae2c31e43b402646d7591e5eca4
2024-09-21 22:18:56 +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
xuzhenglun 3abc312093 add test coverage for cohabitating resources in StroageFactory
Kubernetes-commit: d994895dc4580101f17661eb573fc282d4b8517d
2024-09-12 16:59:08 +08:00
xuzhenglun a096b0dd8d API emulation versioning honors cohabitating resources
Kubernetes-commit: cd5b27304f58f6b634be800ec4ec9990d28550a3
2024-09-09 17:54:35 +08:00
Stanislav Láznička cf15325096 delegate authn: don't default the ReqHeaders UID header
Kubernetes-commit: 26902de531620d2df5ce1bb572d2ea6965a7b7e9
2024-05-20 13:43:22 +02:00
Stanislav Láznička b9e6a66c69 requestheaders: add a "requestheader-uid-headers" flag and wire it up
Kubernetes-commit: 7fabd06c2be41f4134f425fa967d79ac31dc5756
2023-02-16 11:28:50 +01:00
Kensei Nakada cfa44309dd Revert "apiserver: fix data race in apf tests in server/filters package"
This reverts commit dde23bb0b103a00ac9c8e568e81826149b42472c.

Kubernetes-commit: d26772120531617e897a745b1bfd1178648fb995
2024-09-03 19:39:38 +09:00
Kensei Nakada 6bd08c5dc4 Revert "apiserver: improve logging for apf tests in server/filters package"
This reverts commit 8fa3e61399b85d534566dca6566ddb287873839c.

Kubernetes-commit: 9fe3b8410726b0276d2d65a79ce7645660d491f9
2024-09-03 19:39:32 +09:00
Abu Kashem 9d542feed9 apiserver: improve logging for apf tests in server/filters package
Kubernetes-commit: 8fa3e61399b85d534566dca6566ddb287873839c
2024-08-07 07:49:54 -04:00
jonyhy96 644a2519ca apiserver: fix data race in apf tests in server/filters package
Signed-off-by: jonyhy96 <hy352144278@gmail.com>
Co-authored-by: chenwen  <wen.chen@daocloud.io>

Kubernetes-commit: dde23bb0b103a00ac9c8e568e81826149b42472c
2022-01-28 15:03:11 +08:00
David Ashpole daa75f8bec fix memory leak from global MeterProvider
Kubernetes-commit: b86cab8c4c3421c6b195fc82990a63c859449072
2024-08-28 14:20:46 +00:00
Sohan Kunkerkar fed8dfe736 dynamiccertificates: denoise Kubelet logs by skipping removal of non-existent file watchers
This commit updates the DynamicFileCAContent controller to skip the removal
of non-existent file watchers. Previously, the controller attempted to remove
a file watch even if it didn't exist, which resulted in a flood of error messages
being logged in the Kubelet logs.

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>

Kubernetes-commit: 17ad4b39f8b6b299d20fb94f99083ea84083b6b2
2024-07-23 10:55:16 -04:00
Monis Khan cd5bba1780 Ensure transformers have access to the resource via request info
This guarantees that logs and metrics that rely on this information
work as expected.

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

Kubernetes-commit: 49d7b4c97e4f7ee5c664b068c207a39b8c3f759e
2024-08-14 10:33:36 -04:00
Monis Khan 272e9eba82 Remove KMSv2 and KMSv2KDF feature gates
These have been GA since v1.29 and can be safely removed.

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

Kubernetes-commit: 6398b8a19fe0e113cf250c13b0639dea258a174f
2024-08-14 15:59:01 -04:00
0x5457 27c3ca736b apiserver: declare kubeClient and dynamicClient as interface types to avoid panic
Kubernetes-commit: 81824b7c2e673f64f70a6e99180bb6bfc6b738d9
2024-08-13 11:25:11 +08:00
Adarsh-verma-14 41e1af4df2 remove duplicate call for ServeMux
Kubernetes-commit: 838d7c9049439b5997f0947258e183d677788475
2024-08-07 02:56:49 +05:30
Abu Kashem 5f6927c810 add test to document request timeout behavior
- using the default handler chain of the kube-apiserver

Kubernetes-commit: c6210ff8ab4a94d1dd31a56acc16dc9fdc2333f4
2024-05-07 13:52:18 -04:00
Joe Betz b754d6e7f2 Remove special case logic in apiserver to serve all APIs when binary version is set artifically to 0.0
Kubernetes-commit: 1864e7131eca32fc9bebf20641becb467f240eca
2024-07-03 14:16:15 -04:00
Eric Lin 5d14d72b5c Fix httplog not logging watch duration in separate goroutines
Signed-off-by: Eric Lin <exlin@google.com>

Kubernetes-commit: 06c7058115e623126884d05c54a30db511a9cb71
2024-06-21 10:03:31 +00:00
Wojciech Tyczyński a643e14347 Implement resilient watchcache initialization post-start-hook
Kubernetes-commit: a5772bd42593f6492f5169eef49bc9884f95abba
2024-06-13 11:02:18 +02:00
Vinayak Goyal 77f498853b KEP-4633: Allow health-only anonymous auth mode.
Signed-off-by: Vinayak Goyal <vinaygo@google.com>

Kubernetes-commit: 5e6a4937f5a3e20dd77238946220461332ecddff
2024-05-16 21:18:34 +00:00
Siyuan Zhang b26fefe178 add DefaultComponentGlobalsRegistry flags in ServerRunOptions
Signed-off-by: Siyuan Zhang <sizhang@google.com>

Kubernetes-commit: 379676c4bef48e5d2add28851302b55b41fcabcf
2024-06-10 17:50:22 +00:00
Siyuan Zhang 00857ca9ec Add version mapping in ComponentGlobalsRegistry.
Signed-off-by: Siyuan Zhang <sizhang@google.com>

Kubernetes-commit: 4352c4ad2762ce49ce30e62381f8ceb24723fbcc
2024-05-31 20:29:48 -07:00
Siyuan Zhang 22612a3528 apiserver: Add API emulation versioning.
Co-authored-by: Siyuan Zhang <sizhang@google.com>
Co-authored-by: Joe Betz <jpbetz@google.com>
Co-authored-by: Alex Zielenski <zielenski@google.com>

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

Kubernetes-commit: 403301bfdf2c7312591077827abd2e72f445a53a
2024-01-19 16:07:00 -08:00
Eric Lin f59dd2d95e Add /readyz for kube-scheduler
/readyz contains `sched-handler-sync`, `leaderElection` (when election is
enabled) and `shutdown` checks

Kubernetes-commit: 44c08fdbd592b7c167ad0c3b0b4a3b52b99c116f
2023-05-20 16:38:21 +00:00
Stephen Kitt 942c16fb6a Use canonical json-patch v4 import
The canonical import for json-patch v4 is
gopkg.in/evanphx/json-patch.v4 (see
https://github.com/evanphx/json-patch/blob/master/README.md#get-it for
reference).

Using the v4-specific path should also reduce the risk of unwanted v5
upgrade attempts, because they won't be offered as automated upgrades
by dependency upgrade management tools, and they won't happen through
indirect dependencies (see
https://github.com/kubernetes/kubernetes/pull/120327 for context).

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: 5300466a5c8988b479a151ceb77f49dd00065c83
2024-02-16 13:57:24 +01:00
Monis Khan b0c3a41fa5 encryptionconfig: detect typos
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 2503fa55ff13e3211e9f17fa97f70f9a67f3f6fc
2024-05-16 12:38:42 -04:00
Mangirdas Judeikis 65ef30865d move to generics for sets in kubeapiserver
Kubernetes-commit: b14936f6795028b1d8dd9f6a4cb0361b4c7bb9bc
2024-05-12 11:49:42 +03:00
Jayapriya Pai c05e83dd40 Expose DisableHTTP2 flag in SecureServingOptions
This is to mitigate CVE-2023-44487
until the Go standard library and golang.org/x/net
are fully fixed.

Signed-off-by: Jayapriya Pai <janantha@redhat.com>

Kubernetes-commit: e2503e50381cc9cc2e4a4c90f0738e54992558f8
2023-12-05 11:41:58 +05: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
Andrew DeMaria 7d59581b90 apiserver/options: avoid segfault by handling unset core k8s client
Fixes: https://github.com/kubernetes/apiserver/issues/108
Signed-off-by: Andrew DeMaria <ademaria@cloudflare.com>

Kubernetes-commit: b2d1aef1e3800c73e266131e585069eb3b177591
2024-04-22 12:50:23 -06:00
cyclinder eca9e91401 Fix data race in apiserver mux handler
Signed-off-by: cyclinder <kuocyclinder@gmail.com>

Kubernetes-commit: 6a194182a141665cfcb9b03815d77cd1e468d34e
2024-02-20 14:34:22 +08:00
Patrick Ohly 5ea67c789a apiserver + controllers: enhance context support
27a68aee3a4834 introduced context support for events. Creating an event
broadcaster with context makes tests more resilient against leaking goroutines
when that context gets canceled at the end of a test and enables per-test
output via ktesting.

The context could get passed to the constructor. A cleaner solution is to
enhance context support for the apiserver and then pass the context into the
controller's run method. This ripples up the call stack to all places which
start an apiserver.

Kubernetes-commit: b92273a760503cc57aba37c4d3a28554f7fec7f8
2023-12-01 09:00:59 +01:00
Marek Siarkowicz 74fb076497 Cleanup defer from SetFeatureGateDuringTest function call
Kubernetes-commit: 3ee81787685e47a7a5da22423c8ca4455577ecb3
2024-04-23 10:39:47 +02:00