Commit graph

433 commits

Author SHA1 Message Date
Lalit Chauhan
ee481b97e0 fix sorting logic after after normalizing errors 2025-11-06 06:17:49 +00:00
tinatingyu
59e075e8d3 Promote PodCertificateRequests to v1beta1 2025-11-02 05:33:44 +00:00
darshansreenivas
4a9a010c53 adding back v1alpha1 2025-10-28 14:58:43 -07:00
darshansreenivas
68710ce086 add declarative validation test
- restore v1alpha1
- fix lint issues
- ensure tests run with valid objects
2025-10-28 14:56:10 -07:00
darshansreenivas
2e257dffd8 update code-gen for new tags and ignore v1alpha1 2025-10-28 14:53:54 -07:00
Joe Betz
bd6fb65f83 Reduce fuzz test runs by 10x to avoid timeouts 2025-10-21 10:13:04 -04:00
Aaron Prindle
9d83f71cde fix validation_test.go to use path normalization 2025-10-16 17:40:19 +00:00
Kubernetes Prow Robot
db63a581ca
Merge pull request #134366 from tallclair/feature-gates-test
Set multiple feature gates simultaneously in test
2025-10-13 13:11:33 -07:00
yongruilin
6965075ebd Address feedback: simpliy errormatcher instantiation 2025-10-06 17:54:03 +00:00
yongruilin
ae8ea8994e feat(validation): Enhance validation tests with normalization rules support 2025-10-04 03:28:52 +00:00
Tim Allclair
4986abe0b8 Automated refactoring to use SetFeatureGatesDuringTest 2025-10-01 21:10:53 -07:00
yongruilin
96349a4608 chore: Move declarative validation featuregates to staging apiserver 2025-09-26 22:30:16 +00:00
Lalit Chauhan
3015e58e40 Improve tests devex for DV tests. 2025-09-25 17:29:30 +00:00
Jordan Liggitt
840aa4722e
Drop unnecessary gogo dependencies 2025-09-23 13:44:20 -04:00
Kubernetes Prow Robot
ec4e321f00
Merge pull request #134072 from yongruilin/master_vg_enable-resourceclaim
Enable Declarative Validation for resource.k8s.io v1/v1beta1/v1beta2
2025-09-17 12:50:14 -07:00
Kubernetes Prow Robot
7bbea380f4
Merge pull request #134085 from jpbetz/patch-9
Add reviewers and approvers to api/testing
2025-09-16 16:26:24 -07:00
yongruilin
380c4c222e feat(validation-gen): Add declarative validation support for ResourceClaim/(v1,v1beta1,v1beta2) 2025-09-16 21:36:18 +00:00
Joe Betz
fb184a9ff4
Update pkg/api/testing/OWNERS
Co-authored-by: Yongrui Lin <yongrlin@google.com>
2025-09-16 16:05:21 -04:00
Lalit Chauhan
f5cd1a1664 Address tests grouping comment 2025-09-16 17:20:17 +00:00
Lalit Chauhan
92dcd02459 Add helpers for declarative validation tests
Introduces new testing helpers to simplify testing of declarative validation rules. The new `VerifyValidationEquivalence` and `VerifyUpdateValidationEquivalence` functions reduce boilerplate by encapsulating the logic for:

- Toggling the `DeclarativeValidation` and `DeclarativeValidationTakeover` feature gates.
- Comparing the validation output from the imperative and declarative paths.

The declarative validation tests for CertificateSigningRequest and ReplicationController are updated to use these new, simpler helpers.
2025-09-16 16:57:21 +00:00
Joe Betz
3799b8bf6a
Add reviewers and approvers to api/testing 2025-09-16 10:25:56 -04:00
Kevin Torres
9f5b09eb7b Unit test pod level hugepage Default and Validation logic 2025-07-24 21:29:04 +00:00
Patrick Ohly
cff91579e8 DRA API: v1 registration + tests 2025-07-24 08:30:25 +02:00
Taahir Ahmed
4624cb9bb9 Pod Certificates: Basic implementation
* Define feature gate
* Define and serve PodCertificateRequest
* Implement Kubelet projected volume source
* kube-controller-manager GCs PodCertificateRequests
* Add agnhost subcommand that implements a toy signer for testing

Change-Id: Id7ed030d449806410a4fa28aab0f2ce4e01d3b10
2025-07-21 21:49:57 +00:00
Cici Huang
a3ecea296c manual change 2025-07-15 01:44:13 +00:00
yongruilin
5d4a85f9f6 Enable versioned validation fuzz testing for certificates v1/v1alpha1/v1beta1 group 2025-07-01 16:13:56 +00:00
yongruilin
a55318fe14 fix: versioned validation test avoid incorrect conversion 2025-06-30 23:11:49 +00:00
Joe Betz
5013938100 Change option to a slice 2025-06-05 18:24:06 -04:00
Joe Betz
9715c90b31 Clarify errors and improve tests 2025-05-23 21:47:09 -04:00
Joe Betz
7dc8660d03 Update testing to fully track subresources 2025-05-23 21:47:08 -04:00
Jordan Liggitt
6bb6c99342
Drop null creationTimestamp from test fixtures 2025-05-02 15:38:40 -04:00
Morten Torkildsen
39507d911f Add resource v1beta2 API 2025-03-26 14:41:09 +00:00
Patrick Ohly
797475e113 DRA: add device taints API
This adds the "DeviceTaint" top-level type to v1alpha3 and related fields to
ResourceSlice and ResourceClaim. It's complete enough bring up an API server
and generate files.
2025-03-18 20:52:54 +01:00
Joe Betz
ed08387663 Enable versioned validation fuzz testing for core v1 group 2025-03-12 19:53:47 -04:00
Tim Hockin
1d365762a5 Introduce versioned validation test utilitizes and add fuzz tester
This makes a bold assumption: that the errors (count and basic content)
will be the same across versions.  If this turns out to be untrue, this
may need to get more sophisticated.  It should fail obviously when we
hit that edge.
2025-03-11 20:37:21 -04:00
Tim Hockin
e54719bb66
Use randfill, do API renames 2025-03-08 15:18:00 -08:00
Patrick Ohly
2e64c72249 DRA API: register v1beta1
This is the minimal set of changes that are needed to make the new version
usable. The storage version is still v1alpha3. More changes will follow.
2024-11-06 13:03:18 +01:00
Joe Betz
3a1733f302 Add MutatingAdmissionPolicy API
This is closely aligned with ValidatingAdmissionPolicy
except that instead of validations that can fail with
messages, there are mutations, which can be defined
either with as an ApplyConfiguration or JSONPatch.

Co-authored-by: cici37 <cicih@google.com>
2024-11-04 21:40:38 -05:00
Luis Sanchez
aaa7364f60 cover additional types in unstructured roundtrip test
Co-authored-by: Ben Luddy <bluddy@redhat.com>
2024-10-11 16:07:39 -04:00
Patrick Ohly
91d7882e86 DRA: new API for 1.31
This is a complete revamp of the original API. Some of the key
differences:
- refocused on structured parameters and allocating devices
- support for constraints across devices
- support for allocating "all" or a fixed amount
  of similar devices in a single request
- no class for ResourceClaims, instead individual
  device requests are associated with a mandatory
  DeviceClass

For the sake of simplicity, optional basic types (ints, strings) where the null
value is the default are represented as values in the API types. This makes Go
code simpler because it doesn't have to check for nil (consumers) and values
can be set directly (producers). The effect is that in protobuf, these fields
always get encoded because `opt` only has an effect for pointers.

The roundtrip test data for v1.29.0 and v1.30.0 changes because of the new
"request" field. This is considered acceptable because the entire `claims`
field in the pod spec is still alpha.

The implementation is complete enough to bring up the apiserver.
Adapting other components follows.
2024-07-22 18:09:34 +02:00
Patrick Ohly
62d21589ef api test: update TestDefaulting
Logging and sub-tests were added to help debug this problem:
the test passes for ResourceClaim (same defaulting!) and fails
for the list, but only if run together with the other test cases?!

    $ go test ./pkg/api/testing
    --- FAIL: TestDefaulting (1.76s)
        --- FAIL: TestDefaulting/resource.k8s.io/v1alpha3,_Kind=ResourceClaimList (0.01s)
            defaulting_test.go:238: expected resource.k8s.io/v1alpha3, Kind=ResourceClaimList to trigger defaulting due to fuzzing
    FAIL
    FAIL	k8s.io/kubernetes/pkg/api/testing	17.294s
    FAIL
    $ go test -run=TestDefaulting/resource.k8s.io/v1alpha3,_Kind=ResourceClaimList ./pkg/api/testing
    ok  	k8s.io/kubernetes/pkg/api/testing	0.062s

What fixed that problem was increasing the likelihood of generating the right
test object by iterating more often before giving up.
2024-07-21 17:28:14 +02:00
Patrick Ohly
de5742ae83 DRA: remove immediate allocation
As agreed in https://github.com/kubernetes/enhancements/pull/4709, immediate
allocation is one of those features which can be removed because it makes no
sense for structured parameters and the justification for classic DRA is weak.
2024-07-21 17:28:14 +02:00
Patrick Ohly
b51d68bb87 DRA: bump API v1alpha2 -> v1alpha3
This is in preparation for revamping the resource.k8s.io completely. Because
there will be no support for transitioning from v1alpha2 to v1alpha3, the
roundtrip test data for that API in 1.29 and 1.30 gets removed.

Repeating the version in the import name of the API packages is not really
required. It was done for a while to support simpler grepping for usage of
alpha APIs, but there are better ways for that now. So during this transition,
"resourceapi" gets used instead of "resourcev1alpha3" and the version gets
dropped from informer and lister imports. The advantage is that the next bump
to v1beta1 will affect fewer source code lines.

Only source code where the version really matters (like API registration)
retains the versioned import.
2024-07-21 17:28:13 +02:00
Ben Luddy
4755e1f859
Automatically transcode RawExtension between unstructured protocols. 2024-07-09 17:02:34 -04:00
Ben Luddy
532471618e
Extract RoundtripToUnstructured to apimachinery apitesting library.
This will allow the same scenarios to be exercised on types defined in staging modules, like
apiextensions-apiserver, without importing them all from the root module.
2024-06-26 15:02:58 -04:00
Ben Luddy
38f87df0e3
Enable JSON-compatible base64 encoding of []byte for CBOR.
The encoding/json package marshals []byte to a JSON string containing the base64 encoding of the
input slice's bytes, and unmarshals JSON strings to []byte by assuming the JSON string contains a
valid base64 text.

As a binary format, CBOR is capable of representing arbitrary byte sequences without converting them
to a text encoding, but it also needs to interoperate with the existing JSON serializer. It does
this using the "expected later encoding" tags defined in RFC 8949, which indicate a specific text
encoding to be used when interoperating with text-based protocols. The actual conversion to or from
a text encoding is deferred until necessary, so no conversion is performed during roundtrips of
[]byte to CBOR.
2024-06-25 21:05:26 -04:00
Ben Luddy
0600269c1a
Fuzz roundtrip to Unstructured via both JSON and CBOR. 2024-05-29 17:48:10 -04:00
cici37
de506ce7ac Promote ValidatingAdmissionPolicy to GA. 2024-03-05 16:00:21 -08:00
Kubernetes Prow Robot
745a364422
Merge pull request #120866 from bzsuni/cleanup/sets/api
use generic Set in api
2024-01-22 18:20:48 +01:00
Abu Kashem
430c226709
apiserver: fix lint issue, defaulting and validation test for flowcontrol v1 2023-10-30 08:18:40 -04:00