Commit graph

153 commits

Author SHA1 Message Date
Richa Banker
a902b8ffdc Graduate ComponentFlagz feature gate to Beta 2026-03-10 09:50:16 -07:00
Kubernetes Prow Robot
c37f97806d
Merge pull request #137351 from ibihim/ibihim/2026-02-24_kep-3926-add-cr-and-bitflip-tests
kep-3926: add integration tests for CR and bit-flip corrupt object deletion
2026-03-06 15:42:21 +05:30
Kubernetes Prow Robot
4915f3f8b3
Merge pull request #137304 from aaron-prindle/fieldsv1-encapsulation
refactor: fieldsv1 encapsulation via accessors and deprecation of direct "Raw" field usage
2026-03-06 06:50:17 +05:30
Aaron Prindle
e57b3a74f3 refactor: update in-tree FieldsV1 consumers to use format-specific accessors 2026-03-05 22:23:05 +00:00
Krzysztof Ostrowski
80cc27ae50
kep-3926: fix 60s shutdown timeout in transformation tests
Cancel informer watch connections before tearing down the test
apiserver to avoid hitting the 60s http.Server.Shutdown drain timeout.
Each subtest was blocking on open watch connections, adding ~300s to
the total suite runtime.

Decouple the informer lifecycle from the apiserver by using a separate
cancellable context for factory.Start(). Go's defer LIFO ordering
ensures the informer stops before test.cleanUp() shuts down the
server.

Also reduce EncryptionConfigFileChangePollDuration to 1s in TestMain.
2026-03-05 18:44:52 +01:00
Kubernetes Prow Robot
ad854f3495
Merge pull request #137411 from jpbetz/add-controlplane-test-owners
Add OWNERS file for test/integration/controlplane
2026-03-05 05:02:33 +05:30
Joe Betz
a48ca688da
Add OWNERS file for test/integration/controlplane 2026-03-04 14:54:37 -05:00
Richa Banker
adbf7dee82 graduate config.k8s.io.v1alpha1.flagz to beta 2026-03-03 13:12:16 -08:00
Krzysztof Ostrowski
df9ee166f5
kep-3926: add bit-flip corruption test for Secrets decoder error path
Add TestBitFlipCorruptObjectDeletion to exercise the decoder error path
for KEP-3926 using Secrets (protobuf encoding). Unlike the existing
TestAllowUnsafeMalformedObjectDeletionFeature which tests transformer
errors (wrong encryption key), this test uses identity encryption and
corrupts stored bytes directly in etcd, triggering "undecodable" errors
at the protobuf decoder layer.

The informer is given an extended timeout (2 minutes) after deletion
to recover from the exponential backoff accumulated during the
corruption window. The reflector's backoff caps at [30s, 60s) with
jitter, so 2 minutes provides sufficient leeway.

The gate=false subtest is skipped because writing corrupt bytes directly
to etcd emits a watch event that the cacher cannot decode, breaking its
watch. Without the feature gate, the subsequent re-list aborts on the
first decode error (abortOnFirstError aggregator), so the cacher never
recovers and GET requests hang. This differs from the encryption-config
swap tests where no etcd data changes and no watch event is emitted.
This is a known issue to be addressed separately.
2026-03-03 18:49:09 +01:00
Krzysztof Ostrowski
77b45524d9
kep-3926: add integration tests for corrupt CR object deletion
Add tests that exercise the AllowUnsafeMalformedObjectDeletion feature
gate for Custom Resources (foos.cr.bar.com), mirroring the existing
Secret-based tests. This covers the dynamic storage registry code path
that is distinct from built-in resources, including unsafe delete with
privilege escalation and LIST behavior for corrupt CR objects.
2026-03-03 18:49:08 +01:00
Krzysztof Ostrowski
783b84cff9
kep-3926: refactor secrets_transformation_test.go
Refactoring as a preparation for the following commits.
Modernize the test file:
- interface{} -> any
- ioutil.ReadFile -> os.ReadFile
- ptr.To[bool](true) -> ptr.To(true)
- Extract grantUserVerbsOnResource from permitUserToDoVerbOnSecret
  to support granting RBAC verbs on arbitrary resources, not just secrets
2026-03-02 22:32:04 +01:00
Richa Banker
8f48e83df7 Support multiple versions, add v1alpha1 to deprecated versions 2026-02-27 22:24:15 -08:00
Richa Banker
0e5872dc6a graduate config.k8s.io.v1alpha1.statusz to beta 2026-02-27 22:22:35 -08:00
Mads Jensen
cb7f56f30d Use Go 1.22 for-range in test/utils and test/integrations
This was changed using modernize/rangeint.
2026-02-05 16:13:58 +01:00
Richa Banker
4e47bea7b0 Move flagz installation together with statusz's 2026-01-30 11:25:19 -08:00
Kubernetes Prow Robot
8d05750d56
Merge pull request #135262 from cmuuss/auditrulegroupwildcards
added wildcard * for GroupResources to allow filtering of noisy subgr…
2026-01-29 21:11:51 +05:30
Christian Muuß
ea3bfd9ea0 feat: Allow wildcard '*' for API groups in audit policy rules 2026-01-29 08:17:10 +00:00
Mads Jensen
757647786d Remove redundant re-assignments in for-loops in test/{e2e,integration,utils}
The modernize forvar rule was applied. There are more details in this blog
post: https://go.dev/blog/loopvar-preview
2026-01-25 22:58:27 +01:00
Kubernetes Prow Robot
6fde485ec9
Merge pull request #135309 from richabanker/zpages
Enhance content negotiation for zpages
2026-01-22 03:17:25 +05:30
Patrick Ohly
ad79e479c2 build: remove deprecated '// +build' tag
This has been replaced by `//build:...` for a long time now.

Removal of the old build tag was automated with:

    for i in $(git grep -l '^// +build' | grep -v -e '^vendor/'); do if ! grep -q '^// Code generated' "$i"; then sed -i -e '/^\/\/ +build/d' "$i"; fi; done
2025-12-18 12:16:21 +01:00
Richa Banker
e179f38cb8 zpages - add proper handling of the application/yaml Accept Header 2025-12-17 15:57:29 -08:00
yongruilin
16db8e2375 feat: add integration test for /flagz kube-apiserver endpoint 2025-11-04 19:45:32 +00:00
Richa Banker
c1a95eb7e2 Structured statusz 2025-10-30 10:39:52 -07:00
Tim Allclair
4986abe0b8 Automated refactoring to use SetFeatureGatesDuringTest 2025-10-01 21:10:53 -07:00
Anish Ramasekar
480fad996d
kmsv2: run TestKMSv2ProviderKeyIDStaleness in parallel
This change updates the NowFunc 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 when simulating key expiry.

Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2025-09-10 14:15:43 -07:00
Kubernetes Prow Robot
ef4add4509
Merge pull request #133356 from mayuka-c/issue-133175
Replace usage of deprecated ErrWaitTimeout with recommended method across all Pkgs
2025-09-05 06:43:34 -07:00
Patrick Ohly
ad9ae3ab9d test: fix data race in test/integration/controlplane/transformation
TestKMSv2ProviderKeyIDStaleness runs two tests which both modify
kmsv2.NowFunc temporarily. Those two cannot run in parallel. They can be run in
parallel with other tests because nothing else changes kmsv2.NowFunc.

Found during local testing.
2025-09-02 21:01:04 +02:00
Mayuka Channankaiah
6c56d2fd1b Replace usage of deprecated ErrWaitTimeout with recommended method across all Pkgs 2025-08-01 14:18:06 +05:30
Simran Kaur
c7d6c09683
List available endpoints for kube-apiserver (#132581)
Fix tests and formatting

Use ListedPaths for finding useful endpoints

Fix maps import

Update dependencies

Fix lint

Add option to pass listedpaths

Remove apiserver component check

Install statuz in genericapiserver

Register zpagesfeatures

Fix import order

Avoid adding non-debugging endpoints

Fix tests

Fix tests

fix tests

Sort paths

Sort in-place

Copy paths before sorting

Fix string initialization

Move sorting to later stage

Fix imports
2025-07-23 21:44:27 -07:00
Anish Ramasekar
21e2fcea9e
Add automatic_reload_last_config_info metric for auth configs
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2025-07-17 17:47:51 -05:00
Sascha Grunert
8e6651520e
Convert k8s.io/kms/apis from gogo to protoc
Use standard protoc for the kms APIs instead of gogo.

Part of kubernetes#96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-07-16 16:46:39 +02:00
PatrickLaabs
1802c55652 chore: depr. pointer pkg replacement for test integration 2025-07-06 22:02:04 +02:00
Anish Ramasekar
dc3836c49e
Remove deprecated encryption config controller metrics
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2025-06-11 15:31:37 -07:00
Kubernetes Prow Robot
a6227695ab
Merge pull request #128402 from richabanker/mvp-agg-discovery
KEP 4020: Replace StorageVersionAPI with aggregated discovery to fetch served resources by a peer apiserver
2025-03-18 21:43:49 -07:00
Marek Siarkowicz
506e4fed14 In TestListCorruptObject corrupt the object in etcd instead of changing encryption key
Changing the encryption key doesn't work with watch cache as it doesn't
break decoding newly written objects. A new object will be written using
a new key, and decoded using a new key.
2025-03-18 21:49:17 +01:00
Richa Banker
8b2cee83c1 Replace StorageVersion API with aggregated discovery to fetch served resources by a peer for MVP
Co-authored-by: Joe Betz <jpbetz@google.com>

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
2025-03-18 13:27:27 -07:00
Kubernetes Prow Robot
e1fc73d251
Merge pull request #130325 from pohly/test-integration-apiserver-defaults
test/integration: use default API groups in test apiserver
2025-02-25 11:08:30 -08:00
Kubernetes Prow Robot
566f939b19
Merge pull request #129366 from zhifei92/statusz-integration-test
test: Add integration test for apiserver statusz endpoint
2025-02-24 23:34:29 -08:00
Patrick Ohly
56bd8d86a5 test/integration: use default API groups in test apiserver
The goal is to make the test apiserver behave as much as kube-apiserver as
possible. This ensures that tests are as realistic as possible out-of-the-box.
If a test needs a special setup, then that should be visible in the test
because it passes additional flags or options.

One historic deviation from that goal was enabling all API groups. That
change (from 7185624688) gets reverted and tests
which happened to rely on this get updated.
2025-02-24 10:20:06 +01:00
yongruilin
b1d72a5b7c test: Add emulated-version flag verification in flagz test 2025-02-07 22:18:36 -08:00
Siyuan Zhang
8fc3a33454 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>
2025-02-05 16:10:53 -08:00
zhifei92
63ddf4bf33 test: Add integration test for apiserver statusz endpoint 2024-12-23 15:07:17 +08:00
Jefftree
6c94adcc63 expand etcd storage tests to test for 1.31..1.33 2024-12-20 19:07:54 +00:00
yongruilin
8836548806 test: Add integration test for apiserver flagz endpoint 2024-12-11 09:22:25 -08:00
Abu Kashem
25efc8f2d1 handle watch for unsafe delete 2024-11-07 17:37:59 -05:00
Abu Kashem
9932dbef57 add access control check for unsafe delete
add access control check to ensure that the user has permission to do
'unsafe-delete-ignore-read-error' on the resource being deleted
2024-11-07 17:37:59 -05:00
Abu Kashem
367a265c0e add an integration test that exercises the unsafe delete flow
- add an integration test that exercises the unsafe delete flow
- extend newTransformTest to enable RBAC
- add integration test to verify that LIST returns corrupt object keys
2024-11-07 17:37:59 -05:00
Kubernetes Prow Robot
a660b51201
Merge pull request #128498 from googs1025/flake/TestReconcilerAPIServerLeaseMultiCombined
flake(TestReconcilerAPIServerLeaseMultiCombined): fix TestReconcilerAPIServerLeaseMultiCombined flake
2024-11-07 16:10:43 +00:00
Ben Luddy
439d2f7b40
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.
2024-11-06 15:41:39 -05:00
Kubernetes Prow Robot
a50b4e52a9
Merge pull request #128553 from thockin/master
Validation: merge TooLong and TooLongMaxLen
2024-11-06 04:19:43 +00:00