Commit graph

3635 commits

Author SHA1 Message Date
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
Lalit Chauhan
8b5cf608fd Add k8s-label-key format for toleration key 2025-10-10 16:25:48 +00:00
Kubernetes Prow Robot
28c655e79b
Merge pull request #134286 from aaron-prindle/dv-format-long-name-caseless-tag-migration
feat: migrate k8s:format=k8s-long-name-caseless validation on OpaqueDeviceConfiguration.Driver to declarative validation
2025-10-08 19:16:59 -07:00
Kubernetes Prow Robot
3e4b5e48f2
Merge pull request #134193 from hoskeri/fix-ipv6allocator
Fix IPv6 allocator for /64 CIDRs
2025-10-08 18:03:01 -07:00
Aaron Prindle
8e4cd1f3b6 address feedback 2025-10-08 20:45:07 +00:00
Aaron Prindle
d77cb206a0 feat: migrate k8s:format=k8s-long-name-caseless validation on OpaqueDeviceConfiguration.Driver to declarative validation 2025-10-08 20:45:01 +00:00
Aaron Prindle
2fa703bfb6 address feedback 2025-10-07 22:49:14 +00:00
Aaron Prindle
1c0f0add8a feat: add +k8s:immutable tag to ResourceClaim.spec and associated tests 2025-10-07 22:49:11 +00:00
Kubernetes Prow Robot
73bcd2b0e4
Merge pull request #134333 from lalitc375/reserved-for
Add listType=map and listMapekey=uid for ResourceClaimStatus.ReservedFor
2025-10-07 15:44:59 -07:00
Kubernetes Prow Robot
62e9524c85
Merge pull request #134412 from aaron-prindle/resourceclaim-strategy-cleanup
fix: remove unnecessary ValidateResourceClaim call from resourclaim ValidateUpdate
2025-10-07 14:24:59 -07:00
Lalit Chauhan
1fb8674387 Add listType=map and listMapekey=uid for ResourceClaimStatus.ReservedFor 2025-10-07 20:07:48 +00:00
Kubernetes Prow Robot
ad82c3d39f
Merge pull request #134391 from lalitc375/k8s-uuid
Add DV for uids in resourceClaim Status
2025-10-06 15:42:59 -07:00
Aaron Prindle
fd12fc00c9 fix: remove unnecessary ValidateResourceClaim call from resourclaim ValidateUpdate 2025-10-06 22:10:30 +00:00
Kubernetes Prow Robot
9343d04120
Merge pull request #134408 from yongruilin/vg_resourceclaim
feat(validation-gen): add path normalization options & migration k8s:maxItem on ResourceClaimSpec fields
2025-10-06 14:53:06 -07:00
Lalit Chauhan
4ca286819a Add DV for uids in resourceClaim Status 2025-10-06 20:54:00 +00:00
yongruilin
763c01ef68 feat(validation): Add normalization rules for ResourceClaim validation 2025-10-06 17:54:01 +00:00
Tim Hockin
8443187688
Warn when quota request > limit 2025-10-03 10:58:35 -07:00
rongfu.leng
79678dd393
feat: add resourcequota WarningsOnCreate request less than limits
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
2025-10-03 10:58:34 -07:00
Lalit Chauhan
f79fb9e59e Fix rebase issues 2025-10-02 17:23:25 +00:00
Lalit Chauhan
c4c7efc4f9 apply feedback 2025-10-02 05:40:59 +00:00
Lalit Chauhan
515b579945 feat(resource): Add maxItems validation for DeviceClass configs 2025-10-02 05:40:58 +00:00
Lalit Chauhan
e693da7290 feat(resource): Add maxItems validation for DeviceClass selectors
This commit introduces a validation rule to limit the number of selectors
in a DeviceClass to 32. This is done by adding the `+k8s:maxItems=32`
marker to the DeviceClassSpec and running the code generator.

The following changes are included:
- Updated `staging/src/k8s.io/api/resource/v*/types.go` with the validation marker.
- Regenerated validation code in `pkg/apis/resource/v*/zz_generated.validations.go`.
- Improved error message in `pkg/apis/resource/validation/validation.go`.
- Added tests in `pkg/registry/resource/deviceclass/declarative_validation_test.go`
  to cover the new validation.
2025-10-02 05:40:58 +00:00
Tim Allclair
4986abe0b8 Automated refactoring to use SetFeatureGatesDuringTest 2025-10-01 21:10:53 -07:00
Kubernetes Prow Robot
48390fb98e
Merge pull request #134347 from yongruilin/master_vg-cleanup
feat(validation-gen): Add "cohorts" & Tighten and simplify test framework
2025-10-01 16:40:56 -07:00
Kubernetes Prow Robot
0f8107c736
Merge pull request #134211 from aaron-prindle/resourceclaim_maxitems
Add declarative validation +k8s:maxItems tag to ResourceClaim
2025-10-01 15:22:56 -07:00
Tim Hockin
0a26ff5cb4 Update CSR DV test to match RC style
Once we go broad, people will copy these.  Let's make them easy to debug
:)
2025-10-01 19:45:37 +00:00
Tim Hockin
229c6b13ca Validate ReplicationController.metadata.name
This relies on `+k8s:subfield` and validation cohorts.  The
`k8s:optional` ensures that we don't run the name validation if name is
empty, because core apimachinery will already flag it as Required().

This demonstrates some of the DV value - docs and clients are now (in
theory) able to see what RC's name format is.

Co-Authored-by: Yongrui Lin <yongrlin@outlook.com>
2025-10-01 19:45:37 +00:00
Tim Hockin
7b93851395 Fix ReplicationControl double validation 2025-10-01 18:37:13 +00:00
Aaron Prindle
ef2b68388e add +k8s:maxItems tag logic and tests 2025-09-29 18:53:27 +00:00
Kubernetes Prow Robot
da552ef1d7
Merge pull request #134240 from yongruilin/master_vg_strategy-call
Refactor: Centralize declarative validation logic
2025-09-29 11:30:17 -07:00
Joe Betz
03a1a22478 Add declarative validation tests, use tweak pattern, and additional test structure changes 2025-09-29 16:03:53 +00:00
Dan Bokete
b40b67b9cf Deprecate caseless driver name validation and enforce lowercase warnings
- Deprecate IsDNS1123SubdomainCaseless to avoid caseless validation issues.
- Warn when ResourceSlice driver names contain uppercase characters.
- Clarify driver names must be DNS subdomains and use only lowercase letters.
- Update tests, staging code, and OpenAPI spec to reflect the changes.
2025-09-27 13:23:59 +01:00
yongruilin
96349a4608 chore: Move declarative validation featuregates to staging apiserver 2025-09-26 22:30:16 +00:00
yongruilin
2d7dd9164f Refactor: Centralize declarative validation and migration logic
The boilerplate for running declarative validation was duplicated across multiple resource strategies. This included feature gate checks, metric identifier generation, error comparison, and conditional merging logic, which made the code verbose and difficult to maintain.

This commit introduces a new helper function, `rest.ValidateDeclarativelyWithMigrationChecks`, to encapsulate this common logic. All relevant strategies have been refactored to use this new function, resulting in cleaner and more concise code.
2025-09-26 17:22:46 +00:00
Kubernetes Prow Robot
0bdf1f89c3
Merge pull request #134279 from yongruilin/master_customunique
feat(validation-gen): Introduce k8s:customUnique to control listmap uniqueness
2025-09-26 10:10:16 -07:00
Joe Betz
7efc77f493 Apply feedback 2025-09-25 14:51:52 -04:00
yongruilin
71797498f9 test(certificates): Add ratcheting test for CSR conditions 2025-09-25 17:37:16 +00:00
Joe Betz
7019a088c3 Add declarative validation tests for ResourceClaim status 2025-09-24 10:00:17 -04:00
Joe Betz
8606fa03dc Add declarative validation of ResourceClaim status pool field 2025-09-24 10:00:17 -04:00
Abhijit Hoskeri
22551e56a6 Fix IPv6 allocator for /64 CIDRs
An ipAllocator with a 64 bit IPv6 CIDR can allocate
addresses outside the CIDR range, due to an improper uint64 to int64
cast in the addOffsetAddress function.

Replace the cast with a call to `math/big.Int.SetUint64()`.
2025-09-22 11:07:57 -07:00
Kubernetes Prow Robot
725c9153df
Merge pull request #134078 from aaron-prindle/vg-enable-deviceclass
feat(validation-gen) enable declarative validation for resource.k8s.io DeviceClass
2025-09-18 15:24:12 -07:00
Aaron Prindle
17665a39cf feat(validation-gen) enable declarative validation for resource.k8s.io DeviceClass 2025-09-17 17:21:19 +00:00
yongruilin
eca1cfb259 chore(validation): add validation identifier for declarative validation in ResourceClaim 2025-09-16 21:36:18 +00:00
yongruilin
c0fcb10acf fix(tests): update fake client initialization and add resource version handling in validation tests 2025-09-16 21:36:18 +00:00
yongruilin
7c45b1aa3b refactor: simplify declarative validation tests for ResourceClaim 2025-09-16 21:36:18 +00:00
yongruilin
380c4c222e feat(validation-gen): Add declarative validation support for ResourceClaim/(v1,v1beta1,v1beta2) 2025-09-16 21:36:18 +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
Kubernetes Prow Robot
09278c1292
Merge pull request #133946 from lalitc375/k8s-dv-metrics
Add fine grained metrics to narrow down DV mismatches and panics
2025-09-15 19:44:09 -07:00
Lalit Chauhan
1a5e77135b Add fine grained metrics to narrow down DV mismatches and panics 2025-09-16 00:36:14 +00:00
Kubernetes Prow Robot
d2c8e50db3
Merge pull request #133871 from serathius/storage-resource-prefix2
Ensure that storage only accesses keys from under resourcePrefix
2025-09-11 00:08:07 -07:00