Commit Graph

207 Commits

Author SHA1 Message Date
Lalit Chauhan
0aea256ef9 revert of 8f0a6583ca 2025-11-05 00:13:26 +00:00
Kubernetes Prow Robot
c1a6a3ca71 Merge pull request #134152 from pohly/dra-device-taints-1.35
DRA: device taints: new ResourceSlice API, new features
2025-11-04 15:32:07 -08:00
Aaron Prindle
0631a66d52 address feedback - refactor validateSlice and validateSet to use validateItems 2025-11-04 04:15:56 +00:00
Aaron Prindle
39ad8278e2 feat: update DRA to short-circuit on maxSize checks, add a declarative validation test related to this case 2025-11-03 21:16:45 +00:00
Patrick Ohly
75c9186792 generated files 2025-10-31 18:11:18 +01:00
Patrick Ohly
e4dda7b282 DRA device taints: fix DeviceTaintRule + missing slice case
When the ResourceSlice no longer exists, the ResourceSlice tracker didn't and
couldn't report the tainted devices even if they are allocated and in use. The
controller must keep track of DeviceTaintRules itself and handle this scenario.

In this scenario it is impossible to evaluation CEL expressions because the
necessary device attributes aren't available. We could:
- Copy them in the allocation result: too large, big change.
- Limit usage of CEL expressions to rules with no eviction: inconsistent.
- Remove the fields which cannot be supported well.

The last option is chosen.

The tracker is now no longer needed by the eviction controller. Reading
directly from the informer means that we cannot assume that pointers are
consistent. We have to track ResourceSlices by their name, not their pointer.
2025-10-31 18:11:18 +01:00
Patrick Ohly
fee14ffca2 DRA API: device taints 1.35
This raises the number of allowed taints per device to 16 by lowering
the number of allowed devices to 64 per ResourceSlice if (and only if!)
taints are used.

"effect: None" and DeviceTaintRule status with conditions get added
to support giving feedback to admins.

Instead of merely adding the new effect value, this also changes validation of
the enum so that unknown values are valid if they were already stored. This
will simplify adding new effects in the future because validation won't fail
for them after a downgrade. Consumers must treat them like this new None
effect, i.e. ignore them.
2025-10-31 18:11:18 +01:00
yongruilin
d80ac77d98 feat(dra): add k8s:optional for all DV migrated optional fields 2025-10-30 23:31:01 +00:00
yongruilin
2713803c78 feat(dra): migrate NetworkDeviceData.IPs maxItems to declarative validation 2025-10-30 07:14:06 +00:00
yongruilin
0d6d2aa6a5 feat(dra): migrate DeviceAllocationConfiguration.Requests maxItems to declarative validation 2025-10-30 07:14:06 +00:00
yongruilin
a553ac0e92 feat(dra): migrate DeviceAllocationConfiguration.Requests uniqueness to declarative validation 2025-10-30 07:06:35 +00:00
yongruilin
a4e8b54dee test(validation): add case for handling duplicate request names in ResourceClaim status update 2025-10-30 07:06:35 +00:00
yongruilin
9bbf28e2f4 feat(dra): migrate NetworkDeviceData.IPs uniqueness to declarative validation 2025-10-30 07:06:35 +00:00
Lalit Chauhan
37ba7bb454 Address feedbacks 2025-10-29 04:41:10 +00:00
Lalit Chauhan
ec8c2246b2 Use k8s-resource-fully-qualified-name format to validate MatchAttribute 2025-10-29 04:41:07 +00:00
Lalit Chauhan
8f0a6583ca Use eachKey DV in DRA resources. 2025-10-28 20:09:09 +00:00
Kubernetes Prow Robot
bdcff90855 Merge pull request #134805 from aaron-prindle/dv-deviceclaim-subfield
feat: add subfield +k8s:format=k8s-long-name validation for DeviceClass ObjeMeta.Name field
2025-10-28 12:10:03 -07:00
Kubernetes Prow Robot
ffdfc17ebc Merge pull request #134824 from lalitc375/union
use union member DV in the DRA
2025-10-27 10:29:35 -07:00
Lalit Chauhan
8a6b3caaa0 use union member DV in the DRA 2025-10-24 23:04:48 +00:00
Aaron Prindle
97f9819f7e address feedback 2025-10-24 21:21:49 +00:00
Kubernetes Prow Robot
8de3b303e0 Merge pull request #134807 from yongruilin/master_maxlength
Add k8s:maxLength tag and use it on NetworkDeviceData fields
2025-10-24 12:15:41 -07:00
yongruilin
78796239cf feat(validation): add k8s:optional tag to InterfaceName and HardwareAddress in NetworkDeviceData across all versions 2025-10-23 21:04:02 +00:00
Aaron Prindle
9ba536c2e4 feat: add subfield +k8s:format=k8s-long-name validation for DeviceClass ObjeMeta.Name field 2025-10-23 16:42:58 +00:00
Lalit Chauhan
2061ec2be9 Enable DV for resourceslice 2025-10-22 22:48:25 +00:00
yongruilin
833c026435 feat(dra): add k8s:maxLength tag on HardwareAddress in NetworkDeviceData 2025-10-22 22:42:32 +00:00
yongruilin
6fa8cb4a99 feat(dra): add k8s:maxLength on NetworkData.InterfaceName 2025-10-22 22:41:07 +00:00
yongruilin
2b4495f66a feat(dra): add k8s:optional on AllocatedDeviceStatus.NetworkData 2025-10-22 22:38:47 +00:00
Kubernetes Prow Robot
6c8a609fd0 Merge pull request #134555 from aaron-prindle/dv-enum-migration
feat: add +k8s:enum declarative validation to ResourceClaim DeviceTolerationOperator and DeviceTaintEffect
2025-10-21 15:54:37 -07:00
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
Aaron Prindle
2e0319181d address feedback 2025-10-21 00:27:25 +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
Aaron Prindle
0cf9102763 feat: add +k8s:enum declarative validation to ResourceClaim DeviceTolerationOperator and DeviceTaintEffect 2025-10-19 22:36:15 +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