mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 11:28:58 +00:00
Drop CSR analogy, mark ObjectMeta +required,reduce limits (maxItems=500, maxLength=128) for etcd safety, add Errors printer column
Signed-off-by: Nour <nurmn3m@gmail.com>
This commit is contained in:
15
api/openapi-spec/swagger.json
generated
15
api/openapi-spec/swagger.json
generated
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)...)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
4
pkg/generated/openapi/zz_generated.openapi.go
generated
4
pkg/generated/openapi/zz_generated.openapi.go
generated
@@ -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{
|
||||
|
||||
@@ -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 := "<none>"
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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", "<none>"}}},
|
||||
// Columns: Name, Driver, Total, Available, Allocated, Unavailable, Errors, Pools, Status, Completed
|
||||
expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", "-", "-", "-", "-", "-", int32(0), "Pending", "<none>"}}},
|
||||
},
|
||||
{
|
||||
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", "<none>"}}},
|
||||
// Columns: Name, Driver, Total, Available, Allocated, Unavailable, Errors, Pools, Status, Completed
|
||||
expected: []metav1.TableRow{{Cells: []interface{}{"test-request", "driver.example.com", "-", "-", "-", "-", "-", int32(0), "Failed", "<none>"}}},
|
||||
},
|
||||
{
|
||||
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"}}},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user