Commit Graph

177 Commits

Author SHA1 Message Date
Lalit Chauhan
229b33c440 Address feedbacks 2025-10-21 18:09:10 +00:00
Lalit Chauhan
95c42b9951 Fix rebase issues 2025-10-21 18:09:10 +00:00
Lalit Chauhan
cf96486aed Add format validator for DeviceClass.ExtendedResourceName 2025-10-21 18:09:10 +00:00
yongruilin
a817e2b923 test(validation): Mark bindingConditions and bindingFailureConditions errors as covered by declarative 2025-10-20 23:38:48 +00:00
yongruilin
2a116e29ce feat(dra): Add maxItems tag on DeviceRequestAllocationResul.BindingFailureConditions field 2025-10-20 23:35:09 +00:00
yongruilin
ab08274be1 feat(dra): Add maxItems tag on DeviceRequestAllocationResul.BindingConditions field 2025-10-20 23:34:00 +00:00
Aaron Prindle
47e9686b4d feat(validation-gen): add +k8s:format=k8s-long-name-caseless declarative validation for DeviceRequestAllocationResult.Driver 2025-10-19 23:55:16 +00:00
Lalit Chauhan
2072acb3ba Add listType=map and listMapekeys on ResourceClaimStatus.Devices 2025-10-17 22:48:52 +00:00
Kubernetes Prow Robot
2158dd67e9 Merge pull request #134630 from lalitc375/k8s-enum
feat: add enum validation for AllocationConfigSource
2025-10-17 15:40:51 -07:00
Lalit Chauhan
1f803aa314 Use DV for long name validation of spec.devices.requests[%d].firstAvailable[%d].deviceClassName 2025-10-17 19:15:34 +00:00
Aaron Prindle
2fd727bf92 address feedback - comment on declarative defaulting gap w/ DV 2025-10-16 22:47:22 +00:00
Aaron Prindle
9d83f71cde fix validation_test.go to use path normalization 2025-10-16 17:40:19 +00:00
Aaron Prindle
a77f845141 address feedback - remove origin for enum as NotSupported handles this 2025-10-16 17:40:19 +00:00
Aaron Prindle
9a7dace734 feat: add +k8s:enum declarative validation to ResourceClaim DeviceAllocationMode 2025-10-16 17:40:18 +00:00
Lalit Chauhan
9020a17731 feat: add enum validation for AllocationConfigSource
This commit introduces enum-based validation for the `AllocationConfigSource` field.

The following changes are included:
- The `AllocationConfigSource` type is now marked with `+k8s:enum`.
- The `Source` field in `DeviceAllocationConfiguration` is marked as required.
- Generated validation files are updated to enforce the enum constraint.
- A declarative validation test is added for the `AllocationConfigSource` field.
2025-10-16 04:28:14 +00:00
Kubernetes Prow Robot
5277a104e6 Merge pull request #134496 from yongruilin/master_vg-rc-unique
feat(DRA): migrate list uniqueness to declarative validation
2025-10-13 20:37:33 -07:00
Kubernetes Prow Robot
7d87691fe3 Merge pull request #134558 from yongruilin/master_vg-rcstatus-maxitem
feat(validation): add k8s:update & migrate ResourceClaimStatus maxItem validation to declarative
2025-10-13 16:29:33 -07:00
yongruilin
b3eb152db4 feat(dra): Migrate DeviceAllocationResult.Config maxItems validation to declarative
This commit migrates the validation for the DeviceAllocationResult.Config field to declarative validation by adding the +k8s:maxItems=64 annotation.

The change is applied to the following API versions:
- resource/v1
- resource/v1beta1
- resource/v1beta2
2025-10-13 22:18:10 +00:00
yongruilin
a05fce7c22 feat(dra): Add maxItems tag on AllocationResult.Results
This commit migrates the validation for the AllocationResult.Results field to declarative validation by adding the +k8s:maxItems=32 tag.

This aligns with the existing AllocationResultsMaxSize constant and ensures consistency with similar fields like ReservedFor.

This change is applied to the following API versions:
- resource/v1
- resource/v1beta1
- resource/v1beta2
2025-10-13 22:18:10 +00:00
Aaron Prindle
f70142a6a9 feat(validation-gen): migrate ResourceClaimStatus.Allocation NoModify validation to declarative validation
Co-Authored-by: Yongrui Lin <yongrlin@outlook.com>
2025-10-13 22:18:10 +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
b0a511d309 feat(dra): Add maxItems tag on ReservedFor field
This commit migrates the validation for the ReservedFor field to declarative validation by adding the +k8s:maxItems=256 tag.

This change is applied to the following versions:
- resource/v1
- resource/v1beta1
- resource/v1beta2
2025-10-13 06:58:46 +00:00
Lalit Chauhan
8b5cf608fd Add k8s-label-key format for toleration key 2025-10-10 16:25:48 +00:00
yongruilin
9c2520b633 test: mark duplicate device requests as covered by declarative validation 2025-10-09 18:54:53 +00:00
yongruilin
ed932547cf feat: migrate DeviceClaimConfiguration.Requests to declarative validation 2025-10-09 07:52:36 +00:00
yongruilin
63f8c0a4fe feat: migrate DeviceConstraint.Requests uniqueness to declarative validation 2025-10-09 07:11:27 +00:00
yongruilin
3ad7b189b7 feat: migrate DeviceRequest.FirstAvailable uniqueness to declarative validation 2025-10-09 05:58:21 +00:00
yongruilin
ca9e09b7d3 feat: migrate DeviceClaim.Requests uniqueness to declarative validation
This change migrates the validation for unique device request names
for the DeviceClaim.Requests field to a declarative format.

The `+k8s:unique=map` and `+k8s:listMapKey=name` tags have been added
to the `Requests` field within the `DeviceClaim` API type. This ensures
the generated validation code enforces that all entries in the `requests`
slice have a unique `name`.
2025-10-09 05:55:49 +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
b4fa5794ef generate 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
Kubernetes Prow Robot
251b3ad820 Merge pull request #134284 from aaron-prindle/fix-resourceclaim-oneof-logic
fix: update pkg/apis/resource validateDeviceRequest to short-circuit on the oneOf check
2025-10-07 13:35:01 -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
3a53784ecb Merge pull request #133876 from kei01234kei/make_v1_version_fist_priotiry_inresource
make v1 resource version first priority in resource
2025-10-07 08:55:02 -07: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
111fc04e1d fix: update pkg/apis/resource validateDeviceRequest to short-circuit on the oneOf check 2025-10-06 22:15:53 +00:00
Aaron Prindle
e62523e1f5 address feedback 2025-10-06 22:10:33 +00:00
Lalit Chauhan
4ca286819a Add DV for uids in resourceClaim Status 2025-10-06 20:54:00 +00:00
yongruilin
6138a68f4e fix(validation): Mark covered errors in TestValidateClaim for better clarity 2025-10-06 17:54:03 +00:00
yongruilin
7bbc7228ac run update-codegen.sh 2025-10-04 03:28:50 +00:00
yongruilin
7366031541 feat(dra): Add maxItems validation tags for ResourceClaim fields
This commit adds +k8s:maxItems tags to several slice fields within the ResourceClaimSpec across versions v1, v1beta1, and v1beta2.

The following fields under ResourceClaimSpec are now validated for their maximum number of items:
 - DeviceRequest.FirstAvailable
 - ExactDeviceRequest.Selectors
 - DeviceSubRequest.Selectors
 - DeviceConstraint.Requests
 - DeviceClaimConfiguration.Requests
2025-10-04 03:26:24 +00:00
Lalit Chauhan
f79fb9e59e Fix rebase issues 2025-10-02 17:23:25 +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
yongruilin
04d632dd05 fix: Adjust validation for pool names to ensure proper coverage in device requests 2025-10-01 18:35:23 +00:00