From 8b9159baa41418bcc62592e9da3b878e7cd138ca Mon Sep 17 00:00:00 2001 From: Nour Date: Wed, 18 Mar 2026 05:17:28 +0200 Subject: [PATCH] Drop CSR analogy, mark ObjectMeta +required,reduce limits (maxItems=500, maxLength=128) for etcd safety, add Errors printer column Signed-off-by: Nour --- api/openapi-spec/swagger.json | 15 ++++++- ...is__resource.k8s.io__v1alpha3_openapi.json | 39 ++++++++++++++++++- pkg/apis/resource/types.go | 12 ++---- .../v1alpha3/zz_generated.validations.go | 2 +- .../resourcepoolstatusrequest/controller.go | 4 ++ pkg/generated/openapi/zz_generated.openapi.go | 4 +- pkg/printers/internalversion/printers.go | 19 ++++++--- pkg/printers/internalversion/printers_test.go | 20 +++++----- .../declarative_validation_test.go | 4 +- .../api/resource/v1alpha3/generated.proto | 11 ++---- .../src/k8s.io/api/resource/v1alpha3/types.go | 11 ++---- .../v1alpha3/types_swagger_doc_generated.go | 2 +- .../v1alpha3/resourcepoolstatusrequest.go | 7 +--- 13 files changed, 99 insertions(+), 51 deletions(-) diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index c88ca7e9592..d07b747f77c 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -17002,7 +17002,7 @@ "type": "object" }, "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest": { - "description": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. The request follows a request/response pattern similar to CertificateSigningRequest - create a request, and the controller populates the status.\n\nOnce status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", + "description": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", "properties": { "apiVersion": { "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", @@ -17026,6 +17026,7 @@ } }, "required": [ + "metadata", "spec" ], "type": "object", @@ -84991,6 +84992,9 @@ { "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" }, + { + "$ref": "#/parameters/shardSelector-Kgyki_3_" + }, { "$ref": "#/parameters/timeoutSeconds-yvYezaOC" } @@ -85056,6 +85060,9 @@ { "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" }, + { + "$ref": "#/parameters/shardSelector-Kgyki_3_" + }, { "$ref": "#/parameters/timeoutSeconds-yvYezaOC" }, @@ -85859,6 +85866,9 @@ { "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" }, + { + "$ref": "#/parameters/shardSelector-Kgyki_3_" + }, { "$ref": "#/parameters/timeoutSeconds-yvYezaOC" }, @@ -85943,6 +85953,9 @@ { "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" }, + { + "$ref": "#/parameters/shardSelector-Kgyki_3_" + }, { "$ref": "#/parameters/timeoutSeconds-yvYezaOC" }, diff --git a/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha3_openapi.json b/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha3_openapi.json index dcc3de5317c..9f592627cd5 100644 --- a/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha3_openapi.json +++ b/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha3_openapi.json @@ -256,7 +256,7 @@ "type": "object" }, "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest": { - "description": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. The request follows a request/response pattern similar to CertificateSigningRequest - create a request, and the controller populates the status.\n\nOnce status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", + "description": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", "properties": { "apiVersion": { "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", @@ -294,6 +294,7 @@ } }, "required": [ + "metadata", "spec" ], "type": "object", @@ -2452,6 +2453,15 @@ "uniqueItems": true } }, + { + "description": "shardSelector restricts the list of returned objects using a CEL-based shard selector expression. The format uses the shardRange() function combined with || (logical OR) to specify one or more hash ranges:\n\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000')\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n\nField paths use CEL-style object-rooted syntax (e.g. \"object.metadata.uid\"), NOT the fieldSelector format (\"metadata.uid\"). Currently supported paths:\n - object.metadata.uid\n - object.metadata.namespace\n\nhexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a hash space. The full range is [0x0, 0x10000000000000000), where the exclusive upper bound equals 2^64.\n\nExamples:\n 2-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n 4-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000')\n shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000')\n shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000')\n\nThis is an alpha field and requires enabling the ShardedListAndWatch feature gate.", + "in": "query", + "name": "shardSelector", + "schema": { + "type": "string", + "uniqueItems": true + } + }, { "description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", "in": "query", @@ -2587,6 +2597,15 @@ "uniqueItems": true } }, + { + "description": "shardSelector restricts the list of returned objects using a CEL-based shard selector expression. The format uses the shardRange() function combined with || (logical OR) to specify one or more hash ranges:\n\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000')\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n\nField paths use CEL-style object-rooted syntax (e.g. \"object.metadata.uid\"), NOT the fieldSelector format (\"metadata.uid\"). Currently supported paths:\n - object.metadata.uid\n - object.metadata.namespace\n\nhexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a hash space. The full range is [0x0, 0x10000000000000000), where the exclusive upper bound equals 2^64.\n\nExamples:\n 2-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n 4-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000')\n shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000')\n shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000')\n\nThis is an alpha field and requires enabling the ShardedListAndWatch feature gate.", + "in": "query", + "name": "shardSelector", + "schema": { + "type": "string", + "uniqueItems": true + } + }, { "description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", "in": "query", @@ -4038,6 +4057,15 @@ "uniqueItems": true } }, + { + "description": "shardSelector restricts the list of returned objects using a CEL-based shard selector expression. The format uses the shardRange() function combined with || (logical OR) to specify one or more hash ranges:\n\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000')\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n\nField paths use CEL-style object-rooted syntax (e.g. \"object.metadata.uid\"), NOT the fieldSelector format (\"metadata.uid\"). Currently supported paths:\n - object.metadata.uid\n - object.metadata.namespace\n\nhexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a hash space. The full range is [0x0, 0x10000000000000000), where the exclusive upper bound equals 2^64.\n\nExamples:\n 2-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n 4-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000')\n shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000')\n shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000')\n\nThis is an alpha field and requires enabling the ShardedListAndWatch feature gate.", + "in": "query", + "name": "shardSelector", + "schema": { + "type": "string", + "uniqueItems": true + } + }, { "description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", "in": "query", @@ -4209,6 +4237,15 @@ "uniqueItems": true } }, + { + "description": "shardSelector restricts the list of returned objects using a CEL-based shard selector expression. The format uses the shardRange() function combined with || (logical OR) to specify one or more hash ranges:\n\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000')\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n\nField paths use CEL-style object-rooted syntax (e.g. \"object.metadata.uid\"), NOT the fieldSelector format (\"metadata.uid\"). Currently supported paths:\n - object.metadata.uid\n - object.metadata.namespace\n\nhexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a hash space. The full range is [0x0, 0x10000000000000000), where the exclusive upper bound equals 2^64.\n\nExamples:\n 2-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n 4-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000')\n shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000')\n shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000')\n\nThis is an alpha field and requires enabling the ShardedListAndWatch feature gate.", + "in": "query", + "name": "shardSelector", + "schema": { + "type": "string", + "uniqueItems": true + } + }, { "description": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.", "in": "query", diff --git a/pkg/apis/resource/types.go b/pkg/apis/resource/types.go index d2dbfbe3e38..0bc4ab55dac 100644 --- a/pkg/apis/resource/types.go +++ b/pkg/apis/resource/types.go @@ -2063,15 +2063,12 @@ type DeviceTaintRuleList struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ResourcePoolStatusRequest triggers a one-time calculation of resource pool status -// based on the provided filters. The request follows a request/response pattern similar -// to CertificateSigningRequest - create a request, and the controller populates the status. -// -// Once status is set, the request is considered complete and will not -// be reprocessed. Users should delete and recreate requests to get updated information. +// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. +// Users should delete and recreate requests to get updated information. type ResourcePoolStatusRequest struct { metav1.TypeMeta // Standard object metadata - // +optional + // +required metav1.ObjectMeta // Spec defines the filters for which pools to include in the status. @@ -2097,8 +2094,7 @@ type ResourcePoolStatusRequestSpec struct { PoolName *string // Limit optionally specifies the maximum number of pools to return in the status. - // If more pools match the filter criteria, the response will be truncated - // and status.truncated will be set to true. + // If more pools match the filter criteria, the response will be truncated. // // Default: 100 // Maximum: 1000 diff --git a/pkg/apis/resource/v1alpha3/zz_generated.validations.go b/pkg/apis/resource/v1alpha3/zz_generated.validations.go index 2b122447856..11499dd7664 100644 --- a/pkg/apis/resource/v1alpha3/zz_generated.validations.go +++ b/pkg/apis/resource/v1alpha3/zz_generated.validations.go @@ -337,7 +337,7 @@ func Validate_PoolStatus(ctx context.Context, op operation.Operation, fldPath *f if earlyReturn { return // do not proceed } - errs = append(errs, validate.MaxLength(ctx, op, fldPath, obj, oldObj, 256)...) + errs = append(errs, validate.MaxBytes(ctx, op, fldPath, obj, oldObj, 256)...) return }(fldPath.Child("validationError"), obj.ValidationError, safe.Field(oldObj, func(oldObj *resourcev1alpha3.PoolStatus) *string { return oldObj.ValidationError }), oldObj != nil)...) diff --git a/pkg/controller/resourcepoolstatusrequest/controller.go b/pkg/controller/resourcepoolstatusrequest/controller.go index 22483d6cf41..51be74c39ca 100644 --- a/pkg/controller/resourcepoolstatusrequest/controller.go +++ b/pkg/controller/resourcepoolstatusrequest/controller.go @@ -389,6 +389,10 @@ func (c *Controller) calculatePoolStatus(ctx context.Context, request *resourcev // Incomplete pool: set validation error, leave device counts and slice count nil errMsg := fmt.Sprintf("pool %s/%s is incomplete: observed %d/%d slices at generation %d", info.driver, info.poolName, info.sliceCount, info.expectedSliceCount, info.generation) + // Truncate to 256 bytes to stay within the API field's +k8s:maxBytes=256 limit. + if len(errMsg) > 256 { + errMsg = errMsg[:256] + } pool.ValidationError = &errMsg } else { // Complete pool: populate device counts and slice count diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 0673f6fc6f3..6078f227b35 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -49425,7 +49425,7 @@ func schema_k8sio_api_resource_v1alpha3_ResourcePoolStatusRequest(ref common.Ref return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. The request follows a request/response pattern similar to CertificateSigningRequest - create a request, and the controller populates the status.\n\nOnce status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", + Description: "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { @@ -49463,7 +49463,7 @@ func schema_k8sio_api_resource_v1alpha3_ResourcePoolStatusRequest(ref common.Ref }, }, }, - Required: []string{"spec"}, + Required: []string{"metadata", "spec"}, }, }, Dependencies: []string{ diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index 6c7cb99ace3..2fda708e9a3 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -700,10 +700,11 @@ func AddHandlers(h printers.PrintHandler) { resourcePoolStatusRequestColumnDefinitions := []metav1.TableColumnDefinition{ {Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, {Name: "Driver", Type: "string", Description: "The driver to query pools for."}, - {Name: "Total", Type: "integer", Description: "Total number of devices across all pools."}, - {Name: "Available", Type: "integer", Description: "Number of available devices across all pools."}, - {Name: "Allocated", Type: "integer", Description: "Number of allocated devices across all pools."}, - {Name: "Unavailable", Type: "integer", Description: "Number of unavailable devices across all pools."}, + {Name: "Total", Type: "string", Description: "Total number of devices across all pools."}, + {Name: "Available", Type: "string", Description: "Number of available devices across all pools."}, + {Name: "Allocated", Type: "string", Description: "Number of allocated devices across all pools."}, + {Name: "Unavailable", Type: "string", Description: "Number of unavailable devices across all pools."}, + {Name: "Errors", Type: "string", Description: "Number of pools with validation errors."}, {Name: "Pools", Type: "integer", Description: "Total number of matching pools."}, {Name: "Status", Type: "string", Description: "Processing status."}, {Name: "Completed", Type: "string", Description: "Time since the observation completed."}, @@ -3292,11 +3293,12 @@ func printResourcePoolStatusRequest(obj *resource.ResourcePoolStatusRequest, opt status := "Pending" var poolCount int32 - var totalDevices, availableDevices, allocatedDevices, unavailableDevices interface{} + var totalDevices, availableDevices, allocatedDevices, unavailableDevices, validationErrors interface{} totalDevices = "-" availableDevices = "-" allocatedDevices = "-" unavailableDevices = "-" + validationErrors = "-" var completedTime *metav1.Time if obj.Status != nil { @@ -3323,7 +3325,11 @@ func printResourcePoolStatusRequest(obj *resource.ResourcePoolStatusRequest, opt // Aggregate device counts if not failed if !isFailed { var sumTotal, sumAvail, sumAlloc, sumUnavail int32 + var errorCount int32 for _, p := range obj.Status.Pools { + if p.ValidationError != nil { + errorCount++ + } if p.TotalDevices != nil { sumTotal += *p.TotalDevices } @@ -3341,13 +3347,14 @@ func printResourcePoolStatusRequest(obj *resource.ResourcePoolStatusRequest, opt availableDevices = sumAvail allocatedDevices = sumAlloc unavailableDevices = sumUnavail + validationErrors = errorCount } } completed := "" if completedTime != nil { completed = translateTimestampSince(*completedTime) } - row.Cells = append(row.Cells, obj.Name, obj.Spec.Driver, totalDevices, availableDevices, allocatedDevices, unavailableDevices, poolCount, status, completed) + row.Cells = append(row.Cells, obj.Name, obj.Spec.Driver, totalDevices, availableDevices, allocatedDevices, unavailableDevices, validationErrors, poolCount, status, completed) return []metav1.TableRow{row}, nil } diff --git a/pkg/printers/internalversion/printers_test.go b/pkg/printers/internalversion/printers_test.go index fe9d77fde6b..e74178d50b6 100644 --- a/pkg/printers/internalversion/printers_test.go +++ b/pkg/printers/internalversion/printers_test.go @@ -8311,8 +8311,8 @@ func TestPrintResourcePoolStatusRequest(t *testing.T) { Driver: "driver.example.com", }, }, - // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Pools, Status, Completed - expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", "-", "-", "-", "-", int32(0), "Pending", ""}}}, + // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Errors, Pools, Status, Completed + expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", "-", "-", "-", "-", "-", int32(0), "Pending", ""}}}, }, { name: "ResourcePoolStatusRequest with Complete status", @@ -8364,8 +8364,8 @@ func TestPrintResourcePoolStatusRequest(t *testing.T) { }, }, }, - // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Pools, Status, Completed - expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", int32(24), int32(12), int32(6), int32(6), int32(3), "Complete", "5m"}}}, + // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Errors, Pools, Status, Completed + expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", int32(24), int32(12), int32(6), int32(6), int32(0), int32(3), "Complete", "5m"}}}, }, { name: "ResourcePoolStatusRequest with Complete status and truncated pools", @@ -8408,9 +8408,9 @@ func TestPrintResourcePoolStatusRequest(t *testing.T) { }, }, }, - // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Pools, Status, Completed + // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Errors, Pools, Status, Completed // Status shows truncation: "Complete (2/5 pools)" because len(Pools)=2 < PoolCount=5 - expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", int32(18), int32(9), int32(5), int32(4), int32(5), "Complete (2/5 pools)", "5m"}}}, + expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", int32(18), int32(9), int32(5), int32(4), int32(0), int32(5), "Complete (2/5 pools)", "5m"}}}, }, { name: "ResourcePoolStatusRequest with Failed status", @@ -8431,8 +8431,8 @@ func TestPrintResourcePoolStatusRequest(t *testing.T) { }, }, }, - // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Pools, Status, Completed - expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", "-", "-", "-", "-", int32(0), "Failed", ""}}}, + // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Errors, Pools, Status, Completed + expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", "-", "-", "-", "-", "-", int32(0), "Failed", ""}}}, }, { name: "Complete with validation error pool", @@ -8472,9 +8472,9 @@ func TestPrintResourcePoolStatusRequest(t *testing.T) { }, }, }, - // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Pools, Status, Completed + // Columns: Name, Driver, Total, Available, Allocated, Unavailable, Errors, Pools, Status, Completed // Only the healthy pool's device counts are summed; the error pool has nil counts. - expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", int32(10), int32(5), int32(3), int32(2), int32(2), "Complete", "5m"}}}, + expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", int32(10), int32(5), int32(3), int32(2), int32(1), int32(2), "Complete", "5m"}}}, }, } diff --git a/pkg/registry/resource/resourcepoolstatusrequest/declarative_validation_test.go b/pkg/registry/resource/resourcepoolstatusrequest/declarative_validation_test.go index 02fc09e8d0d..6085bc0c2a3 100644 --- a/pkg/registry/resource/resourcepoolstatusrequest/declarative_validation_test.go +++ b/pkg/registry/resource/resourcepoolstatusrequest/declarative_validation_test.go @@ -239,7 +239,7 @@ func TestDeclarativeValidateStatusUpdate(t *testing.T) { expectedErrs: field.ErrorList{field.Invalid(field.NewPath("status", "poolCount"), nil, "").WithOrigin("minimum")}, }, "pool validationError too long": { - // +k8s:maxLength=256 + // +k8s:maxBytes=256 oldObj: mkValidRPSRForUpdate(), updateObj: mkValidRPSRForUpdate(withStatus(func(s *resource.ResourcePoolStatusRequestStatus) { pool := mkValidPoolStatus() @@ -247,7 +247,7 @@ func TestDeclarativeValidateStatusUpdate(t *testing.T) { pool.ValidationError = &longErr s.Pools = []resource.PoolStatus{pool} })), - expectedErrs: field.ErrorList{field.TooLongMaxLength(field.NewPath("status", "pools").Index(0).Child("validationError"), nil, 256).WithOrigin("maxLength")}, + expectedErrs: field.ErrorList{field.TooLong(field.NewPath("status", "pools").Index(0).Child("validationError"), "", 256).WithOrigin("maxBytes")}, }, "poolCount zero": { // +k8s:minimum=0 boundary — zero should be valid diff --git a/staging/src/k8s.io/api/resource/v1alpha3/generated.proto b/staging/src/k8s.io/api/resource/v1alpha3/generated.proto index 63c2f27fec1..228eaa091aa 100644 --- a/staging/src/k8s.io/api/resource/v1alpha3/generated.proto +++ b/staging/src/k8s.io/api/resource/v1alpha3/generated.proto @@ -337,21 +337,18 @@ message PoolStatus { // // +optional // +k8s:optional - // +k8s:maxLength=256 + // +k8s:maxBytes=256 optional string validationError = 10; } // ResourcePoolStatusRequest triggers a one-time calculation of resource pool status -// based on the provided filters. The request follows a request/response pattern similar -// to CertificateSigningRequest - create a request, and the controller populates the status. -// -// Once status is set, the request is considered complete and will not -// be reprocessed. Users should delete and recreate requests to get updated information. +// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. +// Users should delete and recreate requests to get updated information. // // +k8s:validation-gen-nolint message ResourcePoolStatusRequest { // Standard object metadata - // +optional + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines the filters for which pools to include in the status. diff --git a/staging/src/k8s.io/api/resource/v1alpha3/types.go b/staging/src/k8s.io/api/resource/v1alpha3/types.go index dbbf6d39fcf..426900083fc 100644 --- a/staging/src/k8s.io/api/resource/v1alpha3/types.go +++ b/staging/src/k8s.io/api/resource/v1alpha3/types.go @@ -352,17 +352,14 @@ type DeviceTaintRuleList struct { // +k8s:supportsSubresource="/status" // ResourcePoolStatusRequest triggers a one-time calculation of resource pool status -// based on the provided filters. The request follows a request/response pattern similar -// to CertificateSigningRequest - create a request, and the controller populates the status. -// -// Once status is set, the request is considered complete and will not -// be reprocessed. Users should delete and recreate requests to get updated information. +// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. +// Users should delete and recreate requests to get updated information. // // +k8s:validation-gen-nolint type ResourcePoolStatusRequest struct { metav1.TypeMeta `json:",inline"` // Standard object metadata - // +optional + // +required metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines the filters for which pools to include in the status. @@ -556,7 +553,7 @@ type PoolStatus struct { // // +optional // +k8s:optional - // +k8s:maxLength=256 + // +k8s:maxBytes=256 ValidationError *string `json:"validationError,omitempty" protobuf:"bytes,10,opt,name=validationError"` } diff --git a/staging/src/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go b/staging/src/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go index ea2d8be3044..49ff642fea9 100644 --- a/staging/src/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go @@ -127,7 +127,7 @@ func (PoolStatus) SwaggerDoc() map[string]string { } var map_ResourcePoolStatusRequest = map[string]string{ - "": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. The request follows a request/response pattern similar to CertificateSigningRequest - create a request, and the controller populates the status.\n\nOnce status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", + "": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", "metadata": "Standard object metadata", "spec": "Spec defines the filters for which pools to include in the status. The spec is immutable once created.", "status": "Status is populated by the controller with the calculated pool status. When status is non-nil, the request is considered complete and the entire object becomes immutable.", diff --git a/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go b/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go index 4ccbabc975e..aee4d0ed902 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go @@ -31,11 +31,8 @@ import ( // with apply. // // ResourcePoolStatusRequest triggers a one-time calculation of resource pool status -// based on the provided filters. The request follows a request/response pattern similar -// to CertificateSigningRequest - create a request, and the controller populates the status. -// -// Once status is set, the request is considered complete and will not -// be reprocessed. Users should delete and recreate requests to get updated information. +// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. +// Users should delete and recreate requests to get updated information. type ResourcePoolStatusRequestApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` // Standard object metadata