dra: add "named resources" structured parameter model
Like the current device plugin interface, a DRA driver using this model announces a list of resource instances. In contrast to device plugins, this list is made available to the scheduler together with attributes that can be used to select suitable instances when they are not all alike. Because this is the first structured parameter model, some checks that previously were not possible, in particular "is one structured parameter field set", now gets enabled. Adding another structured parameter model will be similar. The applyconfigs code generator assumes that all types in an API are defined in a single package. If it wasn't for that, it would be possible to place the "named resources" types in separate packages, which makes their names in the Go code more natural and provides an indication of their stability level because the package name could include a version.
This commit is contained in:
@@ -51,6 +51,12 @@ API rule violation: names_match,k8s.io/api/core/v1,RBDVolumeSource,RadosUser
|
|||||||
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,CephFS
|
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,CephFS
|
||||||
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,StorageOS
|
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,StorageOS
|
||||||
API rule violation: names_match,k8s.io/api/networking/v1alpha1,ServiceCIDRSpec,CIDRs
|
API rule violation: names_match,k8s.io/api/networking/v1alpha1,ServiceCIDRSpec,CIDRs
|
||||||
|
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,BoolValue
|
||||||
|
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,IntSliceValue
|
||||||
|
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,IntValue
|
||||||
|
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,QuantityValue
|
||||||
|
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,StringSliceValue
|
||||||
|
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,StringValue
|
||||||
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,Ref
|
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,Ref
|
||||||
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,Schema
|
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,Schema
|
||||||
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XEmbeddedResource
|
API rule violation: names_match,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,JSONSchemaProps,XEmbeddedResource
|
||||||
|
166
api/openapi-spec/swagger.json
generated
166
api/openapi-spec/swagger.json
generated
@@ -14823,6 +14823,10 @@
|
|||||||
"io.k8s.api.resource.v1alpha2.DriverAllocationResult": {
|
"io.k8s.api.resource.v1alpha2.DriverAllocationResult": {
|
||||||
"description": "DriverAllocationResult contains vendor parameters and the allocation result for one request.",
|
"description": "DriverAllocationResult contains vendor parameters and the allocation result for one request.",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"namedResources": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult",
|
||||||
|
"description": "NamedResources describes the allocation result when using the named resources model."
|
||||||
|
},
|
||||||
"vendorRequestParameters": {
|
"vendorRequestParameters": {
|
||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension",
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension",
|
||||||
"description": "VendorRequestParameters are the per-request configuration parameters from the time that the claim was allocated."
|
"description": "VendorRequestParameters are the per-request configuration parameters from the time that the claim was allocated."
|
||||||
@@ -14852,6 +14856,156 @@
|
|||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult": {
|
||||||
|
"description": "NamedResourcesAllocationResult is used in AllocationResultModel.",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"description": "Name is the name of the selected resource instance.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesAttribute": {
|
||||||
|
"description": "NamedResourcesAttribute is a combination of an attribute name and its value.",
|
||||||
|
"properties": {
|
||||||
|
"bool": {
|
||||||
|
"description": "BoolValue is a true/false value.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
"description": "IntValue is a 64-bit integer.",
|
||||||
|
"format": "int64",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"intSlice": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice",
|
||||||
|
"description": "IntSliceValue is an array of 64-bit integers."
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity",
|
||||||
|
"description": "QuantityValue is a quantity."
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
"description": "StringValue is a string.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"stringSlice": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice",
|
||||||
|
"description": "StringSliceValue is an array of strings."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesFilter": {
|
||||||
|
"description": "NamedResourcesFilter is used in ResourceFilterModel.",
|
||||||
|
"properties": {
|
||||||
|
"selector": {
|
||||||
|
"description": "Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"selector"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesInstance": {
|
||||||
|
"description": "NamedResourcesInstance represents one individual hardware instance that can be selected based on its attributes.",
|
||||||
|
"properties": {
|
||||||
|
"attributes": {
|
||||||
|
"description": "Attributes defines the attributes of this resource instance. The name of each attribute must be unique.",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesAttribute"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"description": "Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice": {
|
||||||
|
"description": "NamedResourcesIntSlice contains a slice of 64-bit integers.",
|
||||||
|
"properties": {
|
||||||
|
"ints": {
|
||||||
|
"description": "Ints is the slice of 64-bit integers.",
|
||||||
|
"items": {
|
||||||
|
"format": "int64",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"ints"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesRequest": {
|
||||||
|
"description": "NamedResourcesRequest is used in ResourceRequestModel.",
|
||||||
|
"properties": {
|
||||||
|
"selector": {
|
||||||
|
"description": "Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"selector"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesResources": {
|
||||||
|
"description": "NamedResourcesResources is used in NodeResourceModel.",
|
||||||
|
"properties": {
|
||||||
|
"instances": {
|
||||||
|
"description": "The list of all individual resources instances currently available.",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesInstance"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"instances"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice": {
|
||||||
|
"description": "NamedResourcesStringSlice contains a slice of strings.",
|
||||||
|
"properties": {
|
||||||
|
"strings": {
|
||||||
|
"description": "Strings is the slice of strings.",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"strings"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"io.k8s.api.resource.v1alpha2.NodeResourceSlice": {
|
"io.k8s.api.resource.v1alpha2.NodeResourceSlice": {
|
||||||
"description": "NodeResourceSlice provides information about available resources on individual nodes.",
|
"description": "NodeResourceSlice provides information about available resources on individual nodes.",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -14871,6 +15025,10 @@
|
|||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
||||||
"description": "Standard object metadata"
|
"description": "Standard object metadata"
|
||||||
},
|
},
|
||||||
|
"namedResources": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesResources",
|
||||||
|
"description": "NamedResources describes available resources using the named resources model."
|
||||||
|
},
|
||||||
"nodeName": {
|
"nodeName": {
|
||||||
"description": "NodeName identifies the node where the capacity is available. A field selector can be used to list only NodeResourceSlice objects with a certain node name.",
|
"description": "NodeName identifies the node where the capacity is available. A field selector can be used to list only NodeResourceSlice objects with a certain node name.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -15571,6 +15729,10 @@
|
|||||||
"driverName": {
|
"driverName": {
|
||||||
"description": "DriverName is the name used by the DRA driver kubelet plugin.",
|
"description": "DriverName is the name used by the DRA driver kubelet plugin.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"namedResources": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesFilter",
|
||||||
|
"description": "NamedResources describes a resource filter using the named resources model."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@@ -15596,6 +15758,10 @@
|
|||||||
"io.k8s.api.resource.v1alpha2.ResourceRequest": {
|
"io.k8s.api.resource.v1alpha2.ResourceRequest": {
|
||||||
"description": "ResourceRequest is a request for resources from one particular driver.",
|
"description": "ResourceRequest is a request for resources from one particular driver.",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"namedResources": {
|
||||||
|
"$ref": "#/definitions/io.k8s.api.resource.v1alpha2.NamedResourcesRequest",
|
||||||
|
"description": "NamedResources describes a request for resources with the named resources model."
|
||||||
|
},
|
||||||
"vendorParameters": {
|
"vendorParameters": {
|
||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension",
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.runtime.RawExtension",
|
||||||
"description": "VendorParameters are arbitrary setup parameters for the requested resource. They are ignored while allocating a claim."
|
"description": "VendorParameters are arbitrary setup parameters for the requested resource. They are ignored while allocating a claim."
|
||||||
|
@@ -120,6 +120,14 @@
|
|||||||
"io.k8s.api.resource.v1alpha2.DriverAllocationResult": {
|
"io.k8s.api.resource.v1alpha2.DriverAllocationResult": {
|
||||||
"description": "DriverAllocationResult contains vendor parameters and the allocation result for one request.",
|
"description": "DriverAllocationResult contains vendor parameters and the allocation result for one request.",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"namedResources": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "NamedResources describes the allocation result when using the named resources model."
|
||||||
|
},
|
||||||
"vendorRequestParameters": {
|
"vendorRequestParameters": {
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
@@ -162,6 +170,185 @@
|
|||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult": {
|
||||||
|
"description": "NamedResourcesAllocationResult is used in AllocationResultModel.",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"default": "",
|
||||||
|
"description": "Name is the name of the selected resource instance.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesAttribute": {
|
||||||
|
"description": "NamedResourcesAttribute is a combination of an attribute name and its value.",
|
||||||
|
"properties": {
|
||||||
|
"bool": {
|
||||||
|
"description": "BoolValue is a true/false value.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
"description": "IntValue is a 64-bit integer.",
|
||||||
|
"format": "int64",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"intSlice": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "IntSliceValue is an array of 64-bit integers."
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"default": "",
|
||||||
|
"description": "Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.api.resource.Quantity"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "QuantityValue is a quantity."
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
"description": "StringValue is a string.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"stringSlice": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "StringSliceValue is an array of strings."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesFilter": {
|
||||||
|
"description": "NamedResourcesFilter is used in ResourceFilterModel.",
|
||||||
|
"properties": {
|
||||||
|
"selector": {
|
||||||
|
"default": "",
|
||||||
|
"description": "Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"selector"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesInstance": {
|
||||||
|
"description": "NamedResourcesInstance represents one individual hardware instance that can be selected based on its attributes.",
|
||||||
|
"properties": {
|
||||||
|
"attributes": {
|
||||||
|
"description": "Attributes defines the attributes of this resource instance. The name of each attribute must be unique.",
|
||||||
|
"items": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesAttribute"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": {}
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"default": "",
|
||||||
|
"description": "Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice": {
|
||||||
|
"description": "NamedResourcesIntSlice contains a slice of 64-bit integers.",
|
||||||
|
"properties": {
|
||||||
|
"ints": {
|
||||||
|
"description": "Ints is the slice of 64-bit integers.",
|
||||||
|
"items": {
|
||||||
|
"default": 0,
|
||||||
|
"format": "int64",
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"ints"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesRequest": {
|
||||||
|
"description": "NamedResourcesRequest is used in ResourceRequestModel.",
|
||||||
|
"properties": {
|
||||||
|
"selector": {
|
||||||
|
"default": "",
|
||||||
|
"description": "Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"selector"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesResources": {
|
||||||
|
"description": "NamedResourcesResources is used in NodeResourceModel.",
|
||||||
|
"properties": {
|
||||||
|
"instances": {
|
||||||
|
"description": "The list of all individual resources instances currently available.",
|
||||||
|
"items": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesInstance"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": {}
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"instances"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice": {
|
||||||
|
"description": "NamedResourcesStringSlice contains a slice of strings.",
|
||||||
|
"properties": {
|
||||||
|
"strings": {
|
||||||
|
"description": "Strings is the slice of strings.",
|
||||||
|
"items": {
|
||||||
|
"default": "",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
"x-kubernetes-list-type": "atomic"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"strings"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"io.k8s.api.resource.v1alpha2.NodeResourceSlice": {
|
"io.k8s.api.resource.v1alpha2.NodeResourceSlice": {
|
||||||
"description": "NodeResourceSlice provides information about available resources on individual nodes.",
|
"description": "NodeResourceSlice provides information about available resources on individual nodes.",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -187,6 +374,14 @@
|
|||||||
"default": {},
|
"default": {},
|
||||||
"description": "Standard object metadata"
|
"description": "Standard object metadata"
|
||||||
},
|
},
|
||||||
|
"namedResources": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesResources"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "NamedResources describes available resources using the named resources model."
|
||||||
|
},
|
||||||
"nodeName": {
|
"nodeName": {
|
||||||
"default": "",
|
"default": "",
|
||||||
"description": "NodeName identifies the node where the capacity is available. A field selector can be used to list only NodeResourceSlice objects with a certain node name.",
|
"description": "NodeName identifies the node where the capacity is available. A field selector can be used to list only NodeResourceSlice objects with a certain node name.",
|
||||||
@@ -1083,6 +1278,14 @@
|
|||||||
"driverName": {
|
"driverName": {
|
||||||
"description": "DriverName is the name used by the DRA driver kubelet plugin.",
|
"description": "DriverName is the name used by the DRA driver kubelet plugin.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"namedResources": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesFilter"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "NamedResources describes a resource filter using the named resources model."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@@ -1112,6 +1315,14 @@
|
|||||||
"io.k8s.api.resource.v1alpha2.ResourceRequest": {
|
"io.k8s.api.resource.v1alpha2.ResourceRequest": {
|
||||||
"description": "ResourceRequest is a request for resources from one particular driver.",
|
"description": "ResourceRequest is a request for resources from one particular driver.",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"namedResources": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/io.k8s.api.resource.v1alpha2.NamedResourcesRequest"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "NamedResources describes a request for resources with the named resources model."
|
||||||
|
},
|
||||||
"vendorParameters": {
|
"vendorParameters": {
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
@@ -1185,6 +1396,17 @@
|
|||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"io.k8s.apimachinery.pkg.api.resource.Quantity": {
|
||||||
|
"description": "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n``` <quantity> ::= <signedNumber><suffix>\n\n\t(Note that <suffix> may be empty, from the \"\" case in <decimalSI>.)\n\n<digit> ::= 0 | 1 | ... | 9 <digits> ::= <digit> | <digit><digits> <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits> <sign> ::= \"+\" | \"-\" <signedNumber> ::= <number> | <sign><number> <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI> <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei\n\n\t(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n\n<decimalSI> ::= m | \"\" | k | M | G | T | P | E\n\n\t(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n\n<decimalExponent> ::= \"e\" <signedNumber> | \"E\" <signedNumber> ```\n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n\n- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.\n\nThe sign will be omitted unless the number is negative.\n\nExamples:\n\n- 1.5 will be serialized as \"1500m\" - 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"io.k8s.apimachinery.pkg.apis.meta.v1.APIResource": {
|
"io.k8s.apimachinery.pkg.apis.meta.v1.APIResource": {
|
||||||
"description": "APIResource specifies the name of a resource and whether it is namespaced.",
|
"description": "APIResource specifies the name of a resource and whether it is namespaced.",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
114
pkg/apis/resource/namedresources.go
Normal file
114
pkg/apis/resource/namedresources.go
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package resource
|
||||||
|
|
||||||
|
import "k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
|
||||||
|
// NamedResourcesResources is used in NodeResourceModel.
|
||||||
|
type NamedResourcesResources struct {
|
||||||
|
// The list of all individual resources instances currently available.
|
||||||
|
Instances []NamedResourcesInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesInstance represents one individual hardware instance that can be selected based
|
||||||
|
// on its attributes.
|
||||||
|
type NamedResourcesInstance struct {
|
||||||
|
// Name is unique identifier among all resource instances managed by
|
||||||
|
// the driver on the node. It must be a DNS subdomain.
|
||||||
|
Name string
|
||||||
|
|
||||||
|
// Attributes defines the attributes of this resource instance.
|
||||||
|
// The name of each attribute must be unique.
|
||||||
|
Attributes []NamedResourcesAttribute
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAttribute is a combination of an attribute name and its value.
|
||||||
|
type NamedResourcesAttribute struct {
|
||||||
|
// Name is unique identifier among all resource instances managed by
|
||||||
|
// the driver on the node. It must be a DNS subdomain.
|
||||||
|
Name string
|
||||||
|
|
||||||
|
NamedResourcesAttributeValue
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAttributeValue must have one and only one field set.
|
||||||
|
type NamedResourcesAttributeValue struct {
|
||||||
|
// QuantityValue is a quantity.
|
||||||
|
QuantityValue *resource.Quantity
|
||||||
|
// BoolValue is a true/false value.
|
||||||
|
BoolValue *bool
|
||||||
|
// IntValue is a 64-bit integer.
|
||||||
|
IntValue *int64
|
||||||
|
// IntSliceValue is an array of 64-bit integers.
|
||||||
|
IntSliceValue *NamedResourcesIntSlice
|
||||||
|
// StringValue is a string.
|
||||||
|
StringValue *string
|
||||||
|
// StringSliceValue is an array of strings.
|
||||||
|
StringSliceValue *NamedResourcesStringSlice
|
||||||
|
// TODO: VersionValue *SemVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesIntSlice contains a slice of 64-bit integers.
|
||||||
|
type NamedResourcesIntSlice struct {
|
||||||
|
// Ints is the slice of 64-bit integers.
|
||||||
|
Ints []int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesStringSlice contains a slice of strings.
|
||||||
|
type NamedResourcesStringSlice struct {
|
||||||
|
// Strings is the slice of strings.
|
||||||
|
Strings []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//
|
||||||
|
// A wrapper around https://pkg.go.dev/github.com/blang/semver/v4#Version which
|
||||||
|
// is encoded as a string. During decoding, it validates that the string
|
||||||
|
// can be parsed using tolerant parsing (currently trims spaces, removes a "v" prefix,
|
||||||
|
// adds a 0 patch number to versions with only major and minor components specified,
|
||||||
|
// and removes leading 0s).
|
||||||
|
// type SemVersion struct {
|
||||||
|
// semver.Version
|
||||||
|
//}
|
||||||
|
|
||||||
|
// NamedResourcesRequest is used in ResourceRequestModel.
|
||||||
|
type NamedResourcesRequest struct {
|
||||||
|
// Selector is a CEL expression which must evaluate to true if a
|
||||||
|
// resource instance is suitable. The language is as defined in
|
||||||
|
// https://kubernetes.io/docs/reference/using-api/cel/
|
||||||
|
//
|
||||||
|
// In addition, for each type NamedResourcesin AttributeValue there is a map that
|
||||||
|
// resolves to the corresponding value of the instance under evaluation.
|
||||||
|
// For example:
|
||||||
|
//
|
||||||
|
// attributes.quantity["a"].isGreaterThan(quantity("0")) &&
|
||||||
|
// attributes.stringslice["b"].isSorted()
|
||||||
|
Selector string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesFilter is used in ResourceFilterModel.
|
||||||
|
type NamedResourcesFilter struct {
|
||||||
|
// Selector is a selector like the one in Request. It must be true for
|
||||||
|
// a resource instance to be suitable for a claim using the class.
|
||||||
|
Selector string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAllocationResult is used in AllocationResultModel.
|
||||||
|
type NamedResourcesAllocationResult struct {
|
||||||
|
// Name is the name of the selected resource instance.
|
||||||
|
Name string
|
||||||
|
}
|
@@ -0,0 +1,157 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2022 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package validation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
|
"k8s.io/apiserver/pkg/cel"
|
||||||
|
"k8s.io/apiserver/pkg/cel/environment"
|
||||||
|
namedresourcescel "k8s.io/dynamic-resource-allocation/structured/namedresources/cel"
|
||||||
|
corevalidation "k8s.io/kubernetes/pkg/apis/core/validation"
|
||||||
|
"k8s.io/kubernetes/pkg/apis/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
validateInstanceName = corevalidation.ValidateDNS1123Subdomain
|
||||||
|
validateAttributeName = corevalidation.ValidateDNS1123Subdomain
|
||||||
|
)
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
// StoredExpressions must be true if and only if validating CEL
|
||||||
|
// expressions that were already stored persistently. This makes
|
||||||
|
// validation more permissive by enabling CEL definitions that are not
|
||||||
|
// valid yet for new expressions.
|
||||||
|
StoredExpressions bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateResources(resources *resource.NamedResourcesResources, fldPath *field.Path) field.ErrorList {
|
||||||
|
allErrs := validateInstances(resources.Instances, fldPath.Child("instances"))
|
||||||
|
return allErrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateInstances(instances []resource.NamedResourcesInstance, fldPath *field.Path) field.ErrorList {
|
||||||
|
var allErrs field.ErrorList
|
||||||
|
instanceNames := sets.New[string]()
|
||||||
|
for i, instance := range instances {
|
||||||
|
idxPath := fldPath.Index(i)
|
||||||
|
instanceName := instance.Name
|
||||||
|
allErrs = append(allErrs, validateInstanceName(instanceName, idxPath.Child("name"))...)
|
||||||
|
if instanceNames.Has(instanceName) {
|
||||||
|
allErrs = append(allErrs, field.Duplicate(idxPath.Child("name"), instanceName))
|
||||||
|
} else {
|
||||||
|
instanceNames.Insert(instanceName)
|
||||||
|
}
|
||||||
|
allErrs = append(allErrs, validateAttributes(instance.Attributes, idxPath.Child("attributes"))...)
|
||||||
|
}
|
||||||
|
return allErrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateAttributes(attributes []resource.NamedResourcesAttribute, fldPath *field.Path) field.ErrorList {
|
||||||
|
var allErrs field.ErrorList
|
||||||
|
attributeNames := sets.New[string]()
|
||||||
|
for i, attribute := range attributes {
|
||||||
|
idxPath := fldPath.Index(i)
|
||||||
|
attributeName := attribute.Name
|
||||||
|
allErrs = append(allErrs, validateAttributeName(attributeName, idxPath.Child("name"))...)
|
||||||
|
if attributeNames.Has(attributeName) {
|
||||||
|
allErrs = append(allErrs, field.Duplicate(idxPath.Child("name"), attributeName))
|
||||||
|
} else {
|
||||||
|
attributeNames.Insert(attributeName)
|
||||||
|
}
|
||||||
|
|
||||||
|
entries := sets.New[string]()
|
||||||
|
if attribute.QuantityValue != nil {
|
||||||
|
entries.Insert("quantity")
|
||||||
|
}
|
||||||
|
if attribute.BoolValue != nil {
|
||||||
|
entries.Insert("bool")
|
||||||
|
}
|
||||||
|
if attribute.IntValue != nil {
|
||||||
|
entries.Insert("int")
|
||||||
|
}
|
||||||
|
if attribute.IntSliceValue != nil {
|
||||||
|
entries.Insert("intSlice")
|
||||||
|
}
|
||||||
|
if attribute.StringValue != nil {
|
||||||
|
entries.Insert("string")
|
||||||
|
}
|
||||||
|
if attribute.StringSliceValue != nil {
|
||||||
|
entries.Insert("stringSlice")
|
||||||
|
}
|
||||||
|
// TODO: VersionValue
|
||||||
|
|
||||||
|
switch len(entries) {
|
||||||
|
case 0:
|
||||||
|
allErrs = append(allErrs, field.Required(idxPath, "exactly one value must be set"))
|
||||||
|
case 1:
|
||||||
|
// Okay.
|
||||||
|
default:
|
||||||
|
allErrs = append(allErrs, field.Invalid(idxPath, sets.List(entries), "exactly one field must be set, not several"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allErrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateRequest(opts Options, request *resource.NamedResourcesRequest, fldPath *field.Path) field.ErrorList {
|
||||||
|
return validateSelector(opts, request.Selector, fldPath.Child("selector"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateFilter(opts Options, filter *resource.NamedResourcesFilter, fldPath *field.Path) field.ErrorList {
|
||||||
|
return validateSelector(opts, filter.Selector, fldPath.Child("selector"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateSelector(opts Options, selector string, fldPath *field.Path) field.ErrorList {
|
||||||
|
var allErrs field.ErrorList
|
||||||
|
if selector == "" {
|
||||||
|
allErrs = append(allErrs, field.Required(fldPath, ""))
|
||||||
|
} else {
|
||||||
|
// TODO (https://github.com/kubernetes/kubernetes/issues/123687):
|
||||||
|
// when this API gets promoted to beta, we have to
|
||||||
|
// validate new and stored expressions differently.
|
||||||
|
// While it is alpha, new expressions are allowed to
|
||||||
|
// use everything that is currently available.
|
||||||
|
// envType := environment.NewExpressions
|
||||||
|
// if opts.StoredExpressions {
|
||||||
|
// envType = environment.StoredExpressions
|
||||||
|
// }
|
||||||
|
envType := environment.StoredExpressions
|
||||||
|
result := namedresourcescel.Compiler.CompileCELExpression(selector, envType)
|
||||||
|
if result.Error != nil {
|
||||||
|
allErrs = append(allErrs, convertCELErrorToValidationError(fldPath, selector, result.Error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allErrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func convertCELErrorToValidationError(fldPath *field.Path, expression string, err *cel.Error) *field.Error {
|
||||||
|
switch err.Type {
|
||||||
|
case cel.ErrorTypeRequired:
|
||||||
|
return field.Required(fldPath, err.Detail)
|
||||||
|
case cel.ErrorTypeInvalid:
|
||||||
|
return field.Invalid(fldPath, expression, err.Detail)
|
||||||
|
case cel.ErrorTypeInternal:
|
||||||
|
return field.InternalError(fldPath, err)
|
||||||
|
}
|
||||||
|
return field.InternalError(fldPath, fmt.Errorf("unsupported error type: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateAllocationResult(result *resource.NamedResourcesAllocationResult, fldPath *field.Path) field.ErrorList {
|
||||||
|
return validateInstanceName(result.Name, fldPath.Child("name"))
|
||||||
|
}
|
@@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2022 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package validation
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
|
resourceapi "k8s.io/kubernetes/pkg/apis/resource"
|
||||||
|
"k8s.io/utils/ptr"
|
||||||
|
)
|
||||||
|
|
||||||
|
func testResources(instances []resourceapi.NamedResourcesInstance) *resourceapi.NamedResourcesResources {
|
||||||
|
resources := &resourceapi.NamedResourcesResources{
|
||||||
|
Instances: instances,
|
||||||
|
}
|
||||||
|
return resources
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestValidateResources(t *testing.T) {
|
||||||
|
goodName := "foo"
|
||||||
|
badName := "!@#$%^"
|
||||||
|
quantity := resource.MustParse("1")
|
||||||
|
|
||||||
|
scenarios := map[string]struct {
|
||||||
|
resources *resourceapi.NamedResourcesResources
|
||||||
|
wantFailures field.ErrorList
|
||||||
|
}{
|
||||||
|
"empty": {
|
||||||
|
resources: testResources(nil),
|
||||||
|
},
|
||||||
|
"good": {
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName}}),
|
||||||
|
},
|
||||||
|
"bad-name": {
|
||||||
|
wantFailures: field.ErrorList{field.Invalid(field.NewPath("instances").Index(0).Child("name"), badName, "a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')")},
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: badName}}),
|
||||||
|
},
|
||||||
|
"duplicate-name": {
|
||||||
|
wantFailures: field.ErrorList{field.Duplicate(field.NewPath("instances").Index(1).Child("name"), goodName)},
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName}, {Name: goodName}}),
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName, NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{QuantityValue: &quantity}}}}}),
|
||||||
|
},
|
||||||
|
"bool": {
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName, NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{BoolValue: ptr.To(true)}}}}}),
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName, NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{IntValue: ptr.To(int64(1))}}}}}),
|
||||||
|
},
|
||||||
|
"int-slice": {
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName, NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{IntSliceValue: &resourceapi.NamedResourcesIntSlice{Ints: []int64{1, 2, 3}}}}}}}),
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName, NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{StringValue: ptr.To("hello")}}}}}),
|
||||||
|
},
|
||||||
|
"string-slice": {
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName, NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{StringSliceValue: &resourceapi.NamedResourcesStringSlice{Strings: []string{"hello"}}}}}}}),
|
||||||
|
},
|
||||||
|
// TODO: semver
|
||||||
|
"empty-attribute": {
|
||||||
|
wantFailures: field.ErrorList{field.Required(field.NewPath("instances").Index(0).Child("attributes").Index(0), "exactly one value must be set")},
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName}}}}),
|
||||||
|
},
|
||||||
|
"duplicate-value": {
|
||||||
|
wantFailures: field.ErrorList{field.Invalid(field.NewPath("instances").Index(0).Child("attributes").Index(0), []string{"bool", "int"}, "exactly one field must be set, not several")},
|
||||||
|
resources: testResources([]resourceapi.NamedResourcesInstance{{Name: goodName, Attributes: []resourceapi.NamedResourcesAttribute{{Name: goodName, NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{BoolValue: ptr.To(true), IntValue: ptr.To(int64(1))}}}}}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, scenario := range scenarios {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
errs := ValidateResources(scenario.resources, nil)
|
||||||
|
assert.Equal(t, scenario.wantFailures, errs)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestValidateSelector(t *testing.T) {
|
||||||
|
scenarios := map[string]struct {
|
||||||
|
selector string
|
||||||
|
wantFailures field.ErrorList
|
||||||
|
}{
|
||||||
|
"okay": {
|
||||||
|
selector: "true",
|
||||||
|
},
|
||||||
|
"empty": {
|
||||||
|
selector: "",
|
||||||
|
wantFailures: field.ErrorList{field.Required(nil, "")},
|
||||||
|
},
|
||||||
|
"undefined": {
|
||||||
|
selector: "nosuchvar",
|
||||||
|
wantFailures: field.ErrorList{field.Invalid(nil, "nosuchvar", "compilation failed: ERROR: <input>:1:1: undeclared reference to 'nosuchvar' (in container '')\n | nosuchvar\n | ^")},
|
||||||
|
},
|
||||||
|
"wrong-type": {
|
||||||
|
selector: "1",
|
||||||
|
wantFailures: field.ErrorList{field.Invalid(nil, "1", "must evaluate to bool")},
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
selector: `attributes.quantity["name"].isGreaterThan(quantity("0"))`,
|
||||||
|
},
|
||||||
|
"bool": {
|
||||||
|
selector: `attributes.bool["name"]`,
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
selector: `attributes.int["name"] > 0`,
|
||||||
|
},
|
||||||
|
"intslice": {
|
||||||
|
selector: `attributes.intslice["name"].isSorted()`,
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
selector: `attributes.string["name"] == "fish"`,
|
||||||
|
},
|
||||||
|
"stringslice": {
|
||||||
|
selector: `attributes.stringslice["name"].isSorted()`,
|
||||||
|
},
|
||||||
|
// TODO: semver
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, scenario := range scenarios {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
// At the moment, there's no difference between stored and new expressions.
|
||||||
|
// This uses the stricter validation.
|
||||||
|
opts := Options{
|
||||||
|
StoredExpressions: false,
|
||||||
|
}
|
||||||
|
errs := validateSelector(opts, scenario.selector, nil)
|
||||||
|
assert.Equal(t, scenario.wantFailures, errs)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@@ -224,7 +224,8 @@ type DriverAllocationResult struct {
|
|||||||
|
|
||||||
// AllocationResultModel must have one and only one field set.
|
// AllocationResultModel must have one and only one field set.
|
||||||
type AllocationResultModel struct {
|
type AllocationResultModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes the allocation result when using the named resources model.
|
||||||
|
NamedResources *NamedResourcesAllocationResult
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@@ -500,7 +501,8 @@ type NodeResourceSlice struct {
|
|||||||
|
|
||||||
// NodeResourceModel must have one and only one field set.
|
// NodeResourceModel must have one and only one field set.
|
||||||
type NodeResourceModel struct {
|
type NodeResourceModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes available resources using the named resources model.
|
||||||
|
NamedResources *NamedResourcesResources
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@@ -567,7 +569,8 @@ type ResourceRequest struct {
|
|||||||
|
|
||||||
// ResourceRequestModel must have one and only one field set.
|
// ResourceRequestModel must have one and only one field set.
|
||||||
type ResourceRequestModel struct {
|
type ResourceRequestModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes a request for resources with the named resources model.
|
||||||
|
NamedResources *NamedResourcesRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@@ -616,7 +619,8 @@ type ResourceFilter struct {
|
|||||||
|
|
||||||
// ResourceFilterModel must have one and only one field set.
|
// ResourceFilterModel must have one and only one field set.
|
||||||
type ResourceFilterModel struct {
|
type ResourceFilterModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes a resource filter using the named resources model.
|
||||||
|
NamedResources *NamedResourcesFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
297
pkg/apis/resource/v1alpha2/zz_generated.conversion.go
generated
297
pkg/apis/resource/v1alpha2/zz_generated.conversion.go
generated
@@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
v1alpha2 "k8s.io/api/resource/v1alpha2"
|
v1alpha2 "k8s.io/api/resource/v1alpha2"
|
||||||
|
apiresource "k8s.io/apimachinery/pkg/api/resource"
|
||||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -80,6 +81,96 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesAllocationResult)(nil), (*resource.NamedResourcesAllocationResult)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesAllocationResult_To_resource_NamedResourcesAllocationResult(a.(*v1alpha2.NamedResourcesAllocationResult), b.(*resource.NamedResourcesAllocationResult), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesAllocationResult)(nil), (*v1alpha2.NamedResourcesAllocationResult)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesAllocationResult_To_v1alpha2_NamedResourcesAllocationResult(a.(*resource.NamedResourcesAllocationResult), b.(*v1alpha2.NamedResourcesAllocationResult), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesAttribute)(nil), (*resource.NamedResourcesAttribute)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesAttribute_To_resource_NamedResourcesAttribute(a.(*v1alpha2.NamedResourcesAttribute), b.(*resource.NamedResourcesAttribute), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesAttribute)(nil), (*v1alpha2.NamedResourcesAttribute)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesAttribute_To_v1alpha2_NamedResourcesAttribute(a.(*resource.NamedResourcesAttribute), b.(*v1alpha2.NamedResourcesAttribute), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesAttributeValue)(nil), (*resource.NamedResourcesAttributeValue)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesAttributeValue_To_resource_NamedResourcesAttributeValue(a.(*v1alpha2.NamedResourcesAttributeValue), b.(*resource.NamedResourcesAttributeValue), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesAttributeValue)(nil), (*v1alpha2.NamedResourcesAttributeValue)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesAttributeValue_To_v1alpha2_NamedResourcesAttributeValue(a.(*resource.NamedResourcesAttributeValue), b.(*v1alpha2.NamedResourcesAttributeValue), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesFilter)(nil), (*resource.NamedResourcesFilter)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesFilter_To_resource_NamedResourcesFilter(a.(*v1alpha2.NamedResourcesFilter), b.(*resource.NamedResourcesFilter), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesFilter)(nil), (*v1alpha2.NamedResourcesFilter)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesFilter_To_v1alpha2_NamedResourcesFilter(a.(*resource.NamedResourcesFilter), b.(*v1alpha2.NamedResourcesFilter), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesInstance)(nil), (*resource.NamedResourcesInstance)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesInstance_To_resource_NamedResourcesInstance(a.(*v1alpha2.NamedResourcesInstance), b.(*resource.NamedResourcesInstance), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesInstance)(nil), (*v1alpha2.NamedResourcesInstance)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesInstance_To_v1alpha2_NamedResourcesInstance(a.(*resource.NamedResourcesInstance), b.(*v1alpha2.NamedResourcesInstance), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesIntSlice)(nil), (*resource.NamedResourcesIntSlice)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesIntSlice_To_resource_NamedResourcesIntSlice(a.(*v1alpha2.NamedResourcesIntSlice), b.(*resource.NamedResourcesIntSlice), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesIntSlice)(nil), (*v1alpha2.NamedResourcesIntSlice)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesIntSlice_To_v1alpha2_NamedResourcesIntSlice(a.(*resource.NamedResourcesIntSlice), b.(*v1alpha2.NamedResourcesIntSlice), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesRequest)(nil), (*resource.NamedResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesRequest_To_resource_NamedResourcesRequest(a.(*v1alpha2.NamedResourcesRequest), b.(*resource.NamedResourcesRequest), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesRequest)(nil), (*v1alpha2.NamedResourcesRequest)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesRequest_To_v1alpha2_NamedResourcesRequest(a.(*resource.NamedResourcesRequest), b.(*v1alpha2.NamedResourcesRequest), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesResources)(nil), (*resource.NamedResourcesResources)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesResources_To_resource_NamedResourcesResources(a.(*v1alpha2.NamedResourcesResources), b.(*resource.NamedResourcesResources), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesResources)(nil), (*v1alpha2.NamedResourcesResources)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesResources_To_v1alpha2_NamedResourcesResources(a.(*resource.NamedResourcesResources), b.(*v1alpha2.NamedResourcesResources), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NamedResourcesStringSlice)(nil), (*resource.NamedResourcesStringSlice)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha2_NamedResourcesStringSlice_To_resource_NamedResourcesStringSlice(a.(*v1alpha2.NamedResourcesStringSlice), b.(*resource.NamedResourcesStringSlice), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*resource.NamedResourcesStringSlice)(nil), (*v1alpha2.NamedResourcesStringSlice)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_resource_NamedResourcesStringSlice_To_v1alpha2_NamedResourcesStringSlice(a.(*resource.NamedResourcesStringSlice), b.(*v1alpha2.NamedResourcesStringSlice), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.AddGeneratedConversionFunc((*v1alpha2.NodeResourceModel)(nil), (*resource.NodeResourceModel)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddGeneratedConversionFunc((*v1alpha2.NodeResourceModel)(nil), (*resource.NodeResourceModel)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_v1alpha2_NodeResourceModel_To_resource_NodeResourceModel(a.(*v1alpha2.NodeResourceModel), b.(*resource.NodeResourceModel), scope)
|
return Convert_v1alpha2_NodeResourceModel_To_resource_NodeResourceModel(a.(*v1alpha2.NodeResourceModel), b.(*resource.NodeResourceModel), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@@ -438,6 +529,7 @@ func Convert_resource_AllocationResult_To_v1alpha2_AllocationResult(in *resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha2_AllocationResultModel_To_resource_AllocationResultModel(in *v1alpha2.AllocationResultModel, out *resource.AllocationResultModel, s conversion.Scope) error {
|
func autoConvert_v1alpha2_AllocationResultModel_To_resource_AllocationResultModel(in *v1alpha2.AllocationResultModel, out *resource.AllocationResultModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*resource.NamedResourcesAllocationResult)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,6 +539,7 @@ func Convert_v1alpha2_AllocationResultModel_To_resource_AllocationResultModel(in
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_resource_AllocationResultModel_To_v1alpha2_AllocationResultModel(in *resource.AllocationResultModel, out *v1alpha2.AllocationResultModel, s conversion.Scope) error {
|
func autoConvert_resource_AllocationResultModel_To_v1alpha2_AllocationResultModel(in *resource.AllocationResultModel, out *v1alpha2.AllocationResultModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*v1alpha2.NamedResourcesAllocationResult)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,7 +626,206 @@ func Convert_resource_DriverRequests_To_v1alpha2_DriverRequests(in *resource.Dri
|
|||||||
return autoConvert_resource_DriverRequests_To_v1alpha2_DriverRequests(in, out, s)
|
return autoConvert_resource_DriverRequests_To_v1alpha2_DriverRequests(in, out, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesAllocationResult_To_resource_NamedResourcesAllocationResult(in *v1alpha2.NamedResourcesAllocationResult, out *resource.NamedResourcesAllocationResult, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesAllocationResult_To_resource_NamedResourcesAllocationResult is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesAllocationResult_To_resource_NamedResourcesAllocationResult(in *v1alpha2.NamedResourcesAllocationResult, out *resource.NamedResourcesAllocationResult, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesAllocationResult_To_resource_NamedResourcesAllocationResult(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesAllocationResult_To_v1alpha2_NamedResourcesAllocationResult(in *resource.NamedResourcesAllocationResult, out *v1alpha2.NamedResourcesAllocationResult, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesAllocationResult_To_v1alpha2_NamedResourcesAllocationResult is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesAllocationResult_To_v1alpha2_NamedResourcesAllocationResult(in *resource.NamedResourcesAllocationResult, out *v1alpha2.NamedResourcesAllocationResult, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesAllocationResult_To_v1alpha2_NamedResourcesAllocationResult(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesAttribute_To_resource_NamedResourcesAttribute(in *v1alpha2.NamedResourcesAttribute, out *resource.NamedResourcesAttribute, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
if err := Convert_v1alpha2_NamedResourcesAttributeValue_To_resource_NamedResourcesAttributeValue(&in.NamedResourcesAttributeValue, &out.NamedResourcesAttributeValue, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesAttribute_To_resource_NamedResourcesAttribute is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesAttribute_To_resource_NamedResourcesAttribute(in *v1alpha2.NamedResourcesAttribute, out *resource.NamedResourcesAttribute, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesAttribute_To_resource_NamedResourcesAttribute(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesAttribute_To_v1alpha2_NamedResourcesAttribute(in *resource.NamedResourcesAttribute, out *v1alpha2.NamedResourcesAttribute, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
if err := Convert_resource_NamedResourcesAttributeValue_To_v1alpha2_NamedResourcesAttributeValue(&in.NamedResourcesAttributeValue, &out.NamedResourcesAttributeValue, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesAttribute_To_v1alpha2_NamedResourcesAttribute is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesAttribute_To_v1alpha2_NamedResourcesAttribute(in *resource.NamedResourcesAttribute, out *v1alpha2.NamedResourcesAttribute, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesAttribute_To_v1alpha2_NamedResourcesAttribute(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesAttributeValue_To_resource_NamedResourcesAttributeValue(in *v1alpha2.NamedResourcesAttributeValue, out *resource.NamedResourcesAttributeValue, s conversion.Scope) error {
|
||||||
|
out.QuantityValue = (*apiresource.Quantity)(unsafe.Pointer(in.QuantityValue))
|
||||||
|
out.BoolValue = (*bool)(unsafe.Pointer(in.BoolValue))
|
||||||
|
out.IntValue = (*int64)(unsafe.Pointer(in.IntValue))
|
||||||
|
out.IntSliceValue = (*resource.NamedResourcesIntSlice)(unsafe.Pointer(in.IntSliceValue))
|
||||||
|
out.StringValue = (*string)(unsafe.Pointer(in.StringValue))
|
||||||
|
out.StringSliceValue = (*resource.NamedResourcesStringSlice)(unsafe.Pointer(in.StringSliceValue))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesAttributeValue_To_resource_NamedResourcesAttributeValue is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesAttributeValue_To_resource_NamedResourcesAttributeValue(in *v1alpha2.NamedResourcesAttributeValue, out *resource.NamedResourcesAttributeValue, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesAttributeValue_To_resource_NamedResourcesAttributeValue(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesAttributeValue_To_v1alpha2_NamedResourcesAttributeValue(in *resource.NamedResourcesAttributeValue, out *v1alpha2.NamedResourcesAttributeValue, s conversion.Scope) error {
|
||||||
|
out.QuantityValue = (*apiresource.Quantity)(unsafe.Pointer(in.QuantityValue))
|
||||||
|
out.BoolValue = (*bool)(unsafe.Pointer(in.BoolValue))
|
||||||
|
out.IntValue = (*int64)(unsafe.Pointer(in.IntValue))
|
||||||
|
out.IntSliceValue = (*v1alpha2.NamedResourcesIntSlice)(unsafe.Pointer(in.IntSliceValue))
|
||||||
|
out.StringValue = (*string)(unsafe.Pointer(in.StringValue))
|
||||||
|
out.StringSliceValue = (*v1alpha2.NamedResourcesStringSlice)(unsafe.Pointer(in.StringSliceValue))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesAttributeValue_To_v1alpha2_NamedResourcesAttributeValue is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesAttributeValue_To_v1alpha2_NamedResourcesAttributeValue(in *resource.NamedResourcesAttributeValue, out *v1alpha2.NamedResourcesAttributeValue, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesAttributeValue_To_v1alpha2_NamedResourcesAttributeValue(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesFilter_To_resource_NamedResourcesFilter(in *v1alpha2.NamedResourcesFilter, out *resource.NamedResourcesFilter, s conversion.Scope) error {
|
||||||
|
out.Selector = in.Selector
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesFilter_To_resource_NamedResourcesFilter is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesFilter_To_resource_NamedResourcesFilter(in *v1alpha2.NamedResourcesFilter, out *resource.NamedResourcesFilter, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesFilter_To_resource_NamedResourcesFilter(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesFilter_To_v1alpha2_NamedResourcesFilter(in *resource.NamedResourcesFilter, out *v1alpha2.NamedResourcesFilter, s conversion.Scope) error {
|
||||||
|
out.Selector = in.Selector
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesFilter_To_v1alpha2_NamedResourcesFilter is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesFilter_To_v1alpha2_NamedResourcesFilter(in *resource.NamedResourcesFilter, out *v1alpha2.NamedResourcesFilter, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesFilter_To_v1alpha2_NamedResourcesFilter(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesInstance_To_resource_NamedResourcesInstance(in *v1alpha2.NamedResourcesInstance, out *resource.NamedResourcesInstance, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
out.Attributes = *(*[]resource.NamedResourcesAttribute)(unsafe.Pointer(&in.Attributes))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesInstance_To_resource_NamedResourcesInstance is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesInstance_To_resource_NamedResourcesInstance(in *v1alpha2.NamedResourcesInstance, out *resource.NamedResourcesInstance, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesInstance_To_resource_NamedResourcesInstance(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesInstance_To_v1alpha2_NamedResourcesInstance(in *resource.NamedResourcesInstance, out *v1alpha2.NamedResourcesInstance, s conversion.Scope) error {
|
||||||
|
out.Name = in.Name
|
||||||
|
out.Attributes = *(*[]v1alpha2.NamedResourcesAttribute)(unsafe.Pointer(&in.Attributes))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesInstance_To_v1alpha2_NamedResourcesInstance is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesInstance_To_v1alpha2_NamedResourcesInstance(in *resource.NamedResourcesInstance, out *v1alpha2.NamedResourcesInstance, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesInstance_To_v1alpha2_NamedResourcesInstance(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesIntSlice_To_resource_NamedResourcesIntSlice(in *v1alpha2.NamedResourcesIntSlice, out *resource.NamedResourcesIntSlice, s conversion.Scope) error {
|
||||||
|
out.Ints = *(*[]int64)(unsafe.Pointer(&in.Ints))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesIntSlice_To_resource_NamedResourcesIntSlice is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesIntSlice_To_resource_NamedResourcesIntSlice(in *v1alpha2.NamedResourcesIntSlice, out *resource.NamedResourcesIntSlice, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesIntSlice_To_resource_NamedResourcesIntSlice(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesIntSlice_To_v1alpha2_NamedResourcesIntSlice(in *resource.NamedResourcesIntSlice, out *v1alpha2.NamedResourcesIntSlice, s conversion.Scope) error {
|
||||||
|
out.Ints = *(*[]int64)(unsafe.Pointer(&in.Ints))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesIntSlice_To_v1alpha2_NamedResourcesIntSlice is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesIntSlice_To_v1alpha2_NamedResourcesIntSlice(in *resource.NamedResourcesIntSlice, out *v1alpha2.NamedResourcesIntSlice, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesIntSlice_To_v1alpha2_NamedResourcesIntSlice(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesRequest_To_resource_NamedResourcesRequest(in *v1alpha2.NamedResourcesRequest, out *resource.NamedResourcesRequest, s conversion.Scope) error {
|
||||||
|
out.Selector = in.Selector
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesRequest_To_resource_NamedResourcesRequest is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesRequest_To_resource_NamedResourcesRequest(in *v1alpha2.NamedResourcesRequest, out *resource.NamedResourcesRequest, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesRequest_To_resource_NamedResourcesRequest(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesRequest_To_v1alpha2_NamedResourcesRequest(in *resource.NamedResourcesRequest, out *v1alpha2.NamedResourcesRequest, s conversion.Scope) error {
|
||||||
|
out.Selector = in.Selector
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesRequest_To_v1alpha2_NamedResourcesRequest is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesRequest_To_v1alpha2_NamedResourcesRequest(in *resource.NamedResourcesRequest, out *v1alpha2.NamedResourcesRequest, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesRequest_To_v1alpha2_NamedResourcesRequest(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesResources_To_resource_NamedResourcesResources(in *v1alpha2.NamedResourcesResources, out *resource.NamedResourcesResources, s conversion.Scope) error {
|
||||||
|
out.Instances = *(*[]resource.NamedResourcesInstance)(unsafe.Pointer(&in.Instances))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesResources_To_resource_NamedResourcesResources is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesResources_To_resource_NamedResourcesResources(in *v1alpha2.NamedResourcesResources, out *resource.NamedResourcesResources, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesResources_To_resource_NamedResourcesResources(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesResources_To_v1alpha2_NamedResourcesResources(in *resource.NamedResourcesResources, out *v1alpha2.NamedResourcesResources, s conversion.Scope) error {
|
||||||
|
out.Instances = *(*[]v1alpha2.NamedResourcesInstance)(unsafe.Pointer(&in.Instances))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesResources_To_v1alpha2_NamedResourcesResources is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesResources_To_v1alpha2_NamedResourcesResources(in *resource.NamedResourcesResources, out *v1alpha2.NamedResourcesResources, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesResources_To_v1alpha2_NamedResourcesResources(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1alpha2_NamedResourcesStringSlice_To_resource_NamedResourcesStringSlice(in *v1alpha2.NamedResourcesStringSlice, out *resource.NamedResourcesStringSlice, s conversion.Scope) error {
|
||||||
|
out.Strings = *(*[]string)(unsafe.Pointer(&in.Strings))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha2_NamedResourcesStringSlice_To_resource_NamedResourcesStringSlice is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha2_NamedResourcesStringSlice_To_resource_NamedResourcesStringSlice(in *v1alpha2.NamedResourcesStringSlice, out *resource.NamedResourcesStringSlice, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha2_NamedResourcesStringSlice_To_resource_NamedResourcesStringSlice(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_resource_NamedResourcesStringSlice_To_v1alpha2_NamedResourcesStringSlice(in *resource.NamedResourcesStringSlice, out *v1alpha2.NamedResourcesStringSlice, s conversion.Scope) error {
|
||||||
|
out.Strings = *(*[]string)(unsafe.Pointer(&in.Strings))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_resource_NamedResourcesStringSlice_To_v1alpha2_NamedResourcesStringSlice is an autogenerated conversion function.
|
||||||
|
func Convert_resource_NamedResourcesStringSlice_To_v1alpha2_NamedResourcesStringSlice(in *resource.NamedResourcesStringSlice, out *v1alpha2.NamedResourcesStringSlice, s conversion.Scope) error {
|
||||||
|
return autoConvert_resource_NamedResourcesStringSlice_To_v1alpha2_NamedResourcesStringSlice(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha2_NodeResourceModel_To_resource_NodeResourceModel(in *v1alpha2.NodeResourceModel, out *resource.NodeResourceModel, s conversion.Scope) error {
|
func autoConvert_v1alpha2_NodeResourceModel_To_resource_NodeResourceModel(in *v1alpha2.NodeResourceModel, out *resource.NodeResourceModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*resource.NamedResourcesResources)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,6 +835,7 @@ func Convert_v1alpha2_NodeResourceModel_To_resource_NodeResourceModel(in *v1alph
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_resource_NodeResourceModel_To_v1alpha2_NodeResourceModel(in *resource.NodeResourceModel, out *v1alpha2.NodeResourceModel, s conversion.Scope) error {
|
func autoConvert_resource_NodeResourceModel_To_v1alpha2_NodeResourceModel(in *resource.NodeResourceModel, out *v1alpha2.NodeResourceModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*v1alpha2.NamedResourcesResources)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1264,6 +1557,7 @@ func Convert_resource_ResourceFilter_To_v1alpha2_ResourceFilter(in *resource.Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha2_ResourceFilterModel_To_resource_ResourceFilterModel(in *v1alpha2.ResourceFilterModel, out *resource.ResourceFilterModel, s conversion.Scope) error {
|
func autoConvert_v1alpha2_ResourceFilterModel_To_resource_ResourceFilterModel(in *v1alpha2.ResourceFilterModel, out *resource.ResourceFilterModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*resource.NamedResourcesFilter)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1273,6 +1567,7 @@ func Convert_v1alpha2_ResourceFilterModel_To_resource_ResourceFilterModel(in *v1
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_resource_ResourceFilterModel_To_v1alpha2_ResourceFilterModel(in *resource.ResourceFilterModel, out *v1alpha2.ResourceFilterModel, s conversion.Scope) error {
|
func autoConvert_resource_ResourceFilterModel_To_v1alpha2_ResourceFilterModel(in *resource.ResourceFilterModel, out *v1alpha2.ResourceFilterModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*v1alpha2.NamedResourcesFilter)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,6 +1647,7 @@ func Convert_resource_ResourceRequest_To_v1alpha2_ResourceRequest(in *resource.R
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha2_ResourceRequestModel_To_resource_ResourceRequestModel(in *v1alpha2.ResourceRequestModel, out *resource.ResourceRequestModel, s conversion.Scope) error {
|
func autoConvert_v1alpha2_ResourceRequestModel_To_resource_ResourceRequestModel(in *v1alpha2.ResourceRequestModel, out *resource.ResourceRequestModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*resource.NamedResourcesRequest)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1361,6 +1657,7 @@ func Convert_v1alpha2_ResourceRequestModel_To_resource_ResourceRequestModel(in *
|
|||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_resource_ResourceRequestModel_To_v1alpha2_ResourceRequestModel(in *resource.ResourceRequestModel, out *v1alpha2.ResourceRequestModel, s conversion.Scope) error {
|
func autoConvert_resource_ResourceRequestModel_To_v1alpha2_ResourceRequestModel(in *resource.ResourceRequestModel, out *v1alpha2.ResourceRequestModel, s conversion.Scope) error {
|
||||||
|
out.NamedResources = (*v1alpha2.NamedResourcesRequest)(unsafe.Pointer(in.NamedResources))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
corevalidation "k8s.io/kubernetes/pkg/apis/core/validation"
|
corevalidation "k8s.io/kubernetes/pkg/apis/core/validation"
|
||||||
"k8s.io/kubernetes/pkg/apis/resource"
|
"k8s.io/kubernetes/pkg/apis/resource"
|
||||||
|
namedresourcesvalidation "k8s.io/kubernetes/pkg/apis/resource/structured/namedresources/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
// validateResourceDriverName reuses the validation of a CSI driver because
|
// validateResourceDriverName reuses the validation of a CSI driver because
|
||||||
@@ -236,10 +237,13 @@ func validateDriverAllocationResults(results []resource.DriverAllocationResult,
|
|||||||
func validateAllocationResultModel(model *resource.AllocationResultModel, fldPath *field.Path) field.ErrorList {
|
func validateAllocationResultModel(model *resource.AllocationResultModel, fldPath *field.Path) field.ErrorList {
|
||||||
var allErrs field.ErrorList
|
var allErrs field.ErrorList
|
||||||
entries := sets.New[string]()
|
entries := sets.New[string]()
|
||||||
// TODO: implement one structured parameter model
|
if model.NamedResources != nil {
|
||||||
|
entries.Insert("namedResources")
|
||||||
|
allErrs = append(allErrs, namedresourcesvalidation.ValidateAllocationResult(model.NamedResources, fldPath.Child("namedResources"))...)
|
||||||
|
}
|
||||||
switch len(entries) {
|
switch len(entries) {
|
||||||
case 0:
|
case 0:
|
||||||
// allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
||||||
case 1:
|
case 1:
|
||||||
// Okay.
|
// Okay.
|
||||||
default:
|
default:
|
||||||
@@ -396,10 +400,13 @@ func ValidateNodeResourceSlice(nodeResourceSlice *resource.NodeResourceSlice) fi
|
|||||||
func validateNodeResourceModel(model *resource.NodeResourceModel, fldPath *field.Path) field.ErrorList {
|
func validateNodeResourceModel(model *resource.NodeResourceModel, fldPath *field.Path) field.ErrorList {
|
||||||
var allErrs field.ErrorList
|
var allErrs field.ErrorList
|
||||||
entries := sets.New[string]()
|
entries := sets.New[string]()
|
||||||
// TODO: implement one structured parameter model
|
if model.NamedResources != nil {
|
||||||
|
entries.Insert("namedResources")
|
||||||
|
allErrs = append(allErrs, namedresourcesvalidation.ValidateResources(model.NamedResources, fldPath.Child("namedResources"))...)
|
||||||
|
}
|
||||||
switch len(entries) {
|
switch len(entries) {
|
||||||
case 0:
|
case 0:
|
||||||
// allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
||||||
case 1:
|
case 1:
|
||||||
// Okay.
|
// Okay.
|
||||||
default:
|
default:
|
||||||
@@ -463,10 +470,13 @@ func validateResourceRequests(requests []resource.ResourceRequest, fldPath *fiel
|
|||||||
func validateResourceRequestModel(model *resource.ResourceRequestModel, fldPath *field.Path, requestStored bool) field.ErrorList {
|
func validateResourceRequestModel(model *resource.ResourceRequestModel, fldPath *field.Path, requestStored bool) field.ErrorList {
|
||||||
var allErrs field.ErrorList
|
var allErrs field.ErrorList
|
||||||
entries := sets.New[string]()
|
entries := sets.New[string]()
|
||||||
// TODO: implement one structured parameter model
|
if model.NamedResources != nil {
|
||||||
|
entries.Insert("namedResources")
|
||||||
|
allErrs = append(allErrs, namedresourcesvalidation.ValidateRequest(namedresourcesvalidation.Options{StoredExpressions: requestStored}, model.NamedResources, fldPath.Child("namedResources"))...)
|
||||||
|
}
|
||||||
switch len(entries) {
|
switch len(entries) {
|
||||||
case 0:
|
case 0:
|
||||||
// allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
||||||
case 1:
|
case 1:
|
||||||
// Okay.
|
// Okay.
|
||||||
default:
|
default:
|
||||||
@@ -516,10 +526,13 @@ func validateResourceFilters(filters []resource.ResourceFilter, fldPath *field.P
|
|||||||
func validateResourceFilterModel(model *resource.ResourceFilterModel, fldPath *field.Path, filtersStored bool) field.ErrorList {
|
func validateResourceFilterModel(model *resource.ResourceFilterModel, fldPath *field.Path, filtersStored bool) field.ErrorList {
|
||||||
var allErrs field.ErrorList
|
var allErrs field.ErrorList
|
||||||
entries := sets.New[string]()
|
entries := sets.New[string]()
|
||||||
// TODO: implement one structured parameter model
|
if model.NamedResources != nil {
|
||||||
|
entries.Insert("namedResources")
|
||||||
|
allErrs = append(allErrs, namedresourcesvalidation.ValidateFilter(namedresourcesvalidation.Options{StoredExpressions: filtersStored}, model.NamedResources, fldPath.Child("namedResources"))...)
|
||||||
|
}
|
||||||
switch len(entries) {
|
switch len(entries) {
|
||||||
case 0:
|
case 0:
|
||||||
// allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
allErrs = append(allErrs, field.Required(fldPath, "exactly one structured model field must be set"))
|
||||||
case 1:
|
case 1:
|
||||||
// Okay.
|
// Okay.
|
||||||
default:
|
default:
|
||||||
|
@@ -32,10 +32,10 @@ func testNodeResourceSlice(name, nodeName, driverName string) *resource.NodeReso
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
},
|
},
|
||||||
NodeName: nodeName,
|
NodeName: nodeName,
|
||||||
DriverName: driverName,
|
DriverName: driverName,
|
||||||
NodeResourceModel: resource.NodeResourceModel{
|
NodeResourceModel: resource.NodeResourceModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesResources{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,15 +188,14 @@ func TestValidateNodeResourceSlice(t *testing.T) {
|
|||||||
slice: testNodeResourceSlice(goodName, goodName, badName),
|
slice: testNodeResourceSlice(goodName, goodName, badName),
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: implement one structured parameter model
|
"empty-model": {
|
||||||
// "empty-model": {
|
wantFailures: field.ErrorList{field.Required(nil, "exactly one structured model field must be set")},
|
||||||
// wantFailures: field.ErrorList{field.Required(nil, "exactly one structured model field must be set")},
|
slice: func() *resource.NodeResourceSlice {
|
||||||
// slice: func() *resource.NodeResourceSlice {
|
slice := testNodeResourceSlice(goodName, goodName, driverName)
|
||||||
// slice := testNodeResourceSlice(goodName, goodName, driverName)
|
slice.NodeResourceModel = resource.NodeResourceModel{}
|
||||||
// slice.NodeResourceModel = resource.NodeResourceModel{}
|
return slice
|
||||||
// return slice
|
}(),
|
||||||
// }(),
|
},
|
||||||
// },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, scenario := range scenarios {
|
for name, scenario := range scenarios {
|
||||||
|
@@ -400,6 +400,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
|||||||
"invalid-add-allocation-structured": {
|
"invalid-add-allocation-structured": {
|
||||||
wantFailures: field.ErrorList{
|
wantFailures: field.ErrorList{
|
||||||
field.Invalid(field.NewPath("status", "allocation", "resourceHandles").Index(0).Child("structuredData", "nodeName"), "", "a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')"),
|
field.Invalid(field.NewPath("status", "allocation", "resourceHandles").Index(0).Child("structuredData", "nodeName"), "", "a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')"),
|
||||||
|
field.Required(field.NewPath("status", "allocation", "resourceHandles").Index(0).Child("structuredData", "results").Index(1), "exactly one structured model field must be set"),
|
||||||
},
|
},
|
||||||
oldClaim: validClaim,
|
oldClaim: validClaim,
|
||||||
update: func(claim *resource.ResourceClaim) *resource.ResourceClaim {
|
update: func(claim *resource.ResourceClaim) *resource.ResourceClaim {
|
||||||
@@ -410,7 +411,16 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
|||||||
DriverName: "valid",
|
DriverName: "valid",
|
||||||
StructuredData: &resource.StructuredResourceHandle{
|
StructuredData: &resource.StructuredResourceHandle{
|
||||||
Results: []resource.DriverAllocationResult{
|
Results: []resource.DriverAllocationResult{
|
||||||
// TODO: empty AllocationResultMode
|
{
|
||||||
|
AllocationResultModel: resource.AllocationResultModel{
|
||||||
|
NamedResources: &resource.NamedResourcesAllocationResult{
|
||||||
|
Name: "some-resource-instance",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
AllocationResultModel: resource.AllocationResultModel{}, // invalid
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -186,15 +186,14 @@ func TestValidateResourceClaimParameters(t *testing.T) {
|
|||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: implement one structured parameter model
|
"empty-model": {
|
||||||
// "empty-model": {
|
wantFailures: field.ErrorList{field.Required(field.NewPath("driverRequests").Index(0).Child("requests").Index(0), "exactly one structured model field must be set")},
|
||||||
// wantFailures: field.ErrorList{field.Required(field.NewPath("driverRequests").Index(0).Child("requests").Index(0), "exactly one structured model field must be set")},
|
parameters: func() *resource.ResourceClaimParameters {
|
||||||
// parameters: func() *resource.ResourceClaimParameters {
|
parameters := testResourceClaimParameters(goodName, goodName, goodRequests)
|
||||||
// parameters := testResourceClaimParameters(goodName, goodName, goodRequests)
|
parameters.DriverRequests = []resource.DriverRequests{{DriverName: goodName, Requests: []resource.ResourceRequest{{}}}}
|
||||||
// parameters.DriverRequests = []resource.DriverRequests{{DriverName: goodName, Requests: []resource.ResourceRequest{{}}}}
|
return parameters
|
||||||
// return parameters
|
}(),
|
||||||
// }(),
|
},
|
||||||
// },
|
|
||||||
|
|
||||||
"empty-requests": {
|
"empty-requests": {
|
||||||
wantFailures: field.ErrorList{field.Required(field.NewPath("driverRequests").Index(0).Child("requests"), "empty entries with no requests are not allowed")},
|
wantFailures: field.ErrorList{field.Required(field.NewPath("driverRequests").Index(0).Child("requests"), "empty entries with no requests are not allowed")},
|
||||||
@@ -215,7 +214,7 @@ func TestValidateResourceClaimParameters(t *testing.T) {
|
|||||||
Requests: []resource.ResourceRequest{
|
Requests: []resource.ResourceRequest{
|
||||||
{
|
{
|
||||||
ResourceRequestModel: resource.ResourceRequestModel{
|
ResourceRequestModel: resource.ResourceRequestModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesRequest{Selector: "true"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -225,7 +224,7 @@ func TestValidateResourceClaimParameters(t *testing.T) {
|
|||||||
Requests: []resource.ResourceRequest{
|
Requests: []resource.ResourceRequest{
|
||||||
{
|
{
|
||||||
ResourceRequestModel: resource.ResourceRequestModel{
|
ResourceRequestModel: resource.ResourceRequestModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesRequest{Selector: "true"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -245,8 +244,7 @@ func TestValidateResourceClaimParameters(t *testing.T) {
|
|||||||
Requests: []resource.ResourceRequest{
|
Requests: []resource.ResourceRequest{
|
||||||
{
|
{
|
||||||
ResourceRequestModel: resource.ResourceRequestModel{
|
ResourceRequestModel: resource.ResourceRequestModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesRequest{Selector: "true"},
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -256,7 +254,7 @@ func TestValidateResourceClaimParameters(t *testing.T) {
|
|||||||
Requests: []resource.ResourceRequest{
|
Requests: []resource.ResourceRequest{
|
||||||
{
|
{
|
||||||
ResourceRequestModel: resource.ResourceRequestModel{
|
ResourceRequestModel: resource.ResourceRequestModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesRequest{Selector: "true"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -186,15 +186,14 @@ func TestValidateResourceClassParameters(t *testing.T) {
|
|||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: implement one structured parameter model
|
"empty-model": {
|
||||||
// "empty-model": {
|
wantFailures: field.ErrorList{field.Required(field.NewPath("filters").Index(0), "exactly one structured model field must be set")},
|
||||||
// wantFailures: field.ErrorList{field.Required(field.NewPath("filters").Index(0), "exactly one structured model field must be set")},
|
parameters: func() *resource.ResourceClassParameters {
|
||||||
// parameters: func() *resource.ResourceClassParameters {
|
parameters := testResourceClassParameters(goodName, goodName, goodFilters)
|
||||||
// parameters := testResourceClassParameters(goodName, goodName, goodFilters)
|
parameters.Filters = []resource.ResourceFilter{{DriverName: goodName}}
|
||||||
// parameters.Filters = []resource.ResourceFilter{{DriverName: goodName}}
|
return parameters
|
||||||
// return parameters
|
}(),
|
||||||
// }(),
|
},
|
||||||
// },
|
|
||||||
|
|
||||||
"filters-invalid-driver": {
|
"filters-invalid-driver": {
|
||||||
wantFailures: field.ErrorList{field.Invalid(field.NewPath("filters").Index(1).Child("driverName"), badName, "a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')")},
|
wantFailures: field.ErrorList{field.Invalid(field.NewPath("filters").Index(1).Child("driverName"), badName, "a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')")},
|
||||||
@@ -202,15 +201,15 @@ func TestValidateResourceClassParameters(t *testing.T) {
|
|||||||
parameters := testResourceClassParameters(goodName, goodName, goodFilters)
|
parameters := testResourceClassParameters(goodName, goodName, goodFilters)
|
||||||
parameters.Filters = []resource.ResourceFilter{
|
parameters.Filters = []resource.ResourceFilter{
|
||||||
{
|
{
|
||||||
DriverName: goodName,
|
DriverName: goodName,
|
||||||
ResourceFilterModel: resource.ResourceFilterModel{
|
ResourceFilterModel: resource.ResourceFilterModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesFilter{Selector: "true"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
DriverName: badName,
|
DriverName: badName,
|
||||||
ResourceFilterModel: resource.ResourceFilterModel{
|
ResourceFilterModel: resource.ResourceFilterModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesFilter{Selector: "true"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -224,14 +223,16 @@ func TestValidateResourceClassParameters(t *testing.T) {
|
|||||||
parameters := testResourceClassParameters(goodName, goodName, goodFilters)
|
parameters := testResourceClassParameters(goodName, goodName, goodFilters)
|
||||||
parameters.Filters = []resource.ResourceFilter{
|
parameters.Filters = []resource.ResourceFilter{
|
||||||
{
|
{
|
||||||
DriverName: goodName,
|
DriverName: goodName,
|
||||||
ResourceFilterModel: resource.ResourceFilterModel{
|
ResourceFilterModel: resource.ResourceFilterModel{
|
||||||
// TODO: implement one structured parameter model
|
NamedResources: &resource.NamedResourcesFilter{Selector: "true"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
DriverName: goodName,
|
DriverName: goodName,
|
||||||
ResourceFilterModel: resource.ResourceFilterModel{},
|
ResourceFilterModel: resource.ResourceFilterModel{
|
||||||
|
NamedResources: &resource.NamedResourcesFilter{Selector: "true"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return parameters
|
return parameters
|
||||||
|
231
pkg/apis/resource/zz_generated.deepcopy.go
generated
231
pkg/apis/resource/zz_generated.deepcopy.go
generated
@@ -57,6 +57,11 @@ func (in *AllocationResult) DeepCopy() *AllocationResult {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *AllocationResultModel) DeepCopyInto(out *AllocationResultModel) {
|
func (in *AllocationResultModel) DeepCopyInto(out *AllocationResultModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesAllocationResult)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +81,7 @@ func (in *DriverAllocationResult) DeepCopyInto(out *DriverAllocationResult) {
|
|||||||
if in.VendorRequestParameters != nil {
|
if in.VendorRequestParameters != nil {
|
||||||
out.VendorRequestParameters = in.VendorRequestParameters.DeepCopyObject()
|
out.VendorRequestParameters = in.VendorRequestParameters.DeepCopyObject()
|
||||||
}
|
}
|
||||||
out.AllocationResultModel = in.AllocationResultModel
|
in.AllocationResultModel.DeepCopyInto(&out.AllocationResultModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,9 +121,213 @@ func (in *DriverRequests) DeepCopy() *DriverRequests {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesAllocationResult) DeepCopyInto(out *NamedResourcesAllocationResult) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesAllocationResult.
|
||||||
|
func (in *NamedResourcesAllocationResult) DeepCopy() *NamedResourcesAllocationResult {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesAllocationResult)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesAttribute) DeepCopyInto(out *NamedResourcesAttribute) {
|
||||||
|
*out = *in
|
||||||
|
in.NamedResourcesAttributeValue.DeepCopyInto(&out.NamedResourcesAttributeValue)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesAttribute.
|
||||||
|
func (in *NamedResourcesAttribute) DeepCopy() *NamedResourcesAttribute {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesAttribute)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesAttributeValue) DeepCopyInto(out *NamedResourcesAttributeValue) {
|
||||||
|
*out = *in
|
||||||
|
if in.QuantityValue != nil {
|
||||||
|
in, out := &in.QuantityValue, &out.QuantityValue
|
||||||
|
x := (*in).DeepCopy()
|
||||||
|
*out = &x
|
||||||
|
}
|
||||||
|
if in.BoolValue != nil {
|
||||||
|
in, out := &in.BoolValue, &out.BoolValue
|
||||||
|
*out = new(bool)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.IntValue != nil {
|
||||||
|
in, out := &in.IntValue, &out.IntValue
|
||||||
|
*out = new(int64)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.IntSliceValue != nil {
|
||||||
|
in, out := &in.IntSliceValue, &out.IntSliceValue
|
||||||
|
*out = new(NamedResourcesIntSlice)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
if in.StringValue != nil {
|
||||||
|
in, out := &in.StringValue, &out.StringValue
|
||||||
|
*out = new(string)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.StringSliceValue != nil {
|
||||||
|
in, out := &in.StringSliceValue, &out.StringSliceValue
|
||||||
|
*out = new(NamedResourcesStringSlice)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesAttributeValue.
|
||||||
|
func (in *NamedResourcesAttributeValue) DeepCopy() *NamedResourcesAttributeValue {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesAttributeValue)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesFilter) DeepCopyInto(out *NamedResourcesFilter) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesFilter.
|
||||||
|
func (in *NamedResourcesFilter) DeepCopy() *NamedResourcesFilter {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesFilter)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesInstance) DeepCopyInto(out *NamedResourcesInstance) {
|
||||||
|
*out = *in
|
||||||
|
if in.Attributes != nil {
|
||||||
|
in, out := &in.Attributes, &out.Attributes
|
||||||
|
*out = make([]NamedResourcesAttribute, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesInstance.
|
||||||
|
func (in *NamedResourcesInstance) DeepCopy() *NamedResourcesInstance {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesInstance)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesIntSlice) DeepCopyInto(out *NamedResourcesIntSlice) {
|
||||||
|
*out = *in
|
||||||
|
if in.Ints != nil {
|
||||||
|
in, out := &in.Ints, &out.Ints
|
||||||
|
*out = make([]int64, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesIntSlice.
|
||||||
|
func (in *NamedResourcesIntSlice) DeepCopy() *NamedResourcesIntSlice {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesIntSlice)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesRequest) DeepCopyInto(out *NamedResourcesRequest) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesRequest.
|
||||||
|
func (in *NamedResourcesRequest) DeepCopy() *NamedResourcesRequest {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesRequest)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesResources) DeepCopyInto(out *NamedResourcesResources) {
|
||||||
|
*out = *in
|
||||||
|
if in.Instances != nil {
|
||||||
|
in, out := &in.Instances, &out.Instances
|
||||||
|
*out = make([]NamedResourcesInstance, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesResources.
|
||||||
|
func (in *NamedResourcesResources) DeepCopy() *NamedResourcesResources {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesResources)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesStringSlice) DeepCopyInto(out *NamedResourcesStringSlice) {
|
||||||
|
*out = *in
|
||||||
|
if in.Strings != nil {
|
||||||
|
in, out := &in.Strings, &out.Strings
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesStringSlice.
|
||||||
|
func (in *NamedResourcesStringSlice) DeepCopy() *NamedResourcesStringSlice {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesStringSlice)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *NodeResourceModel) DeepCopyInto(out *NodeResourceModel) {
|
func (in *NodeResourceModel) DeepCopyInto(out *NodeResourceModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesResources)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +346,7 @@ func (in *NodeResourceSlice) DeepCopyInto(out *NodeResourceSlice) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
out.NodeResourceModel = in.NodeResourceModel
|
in.NodeResourceModel.DeepCopyInto(&out.NodeResourceModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,7 +910,9 @@ func (in *ResourceClassParameters) DeepCopyInto(out *ResourceClassParameters) {
|
|||||||
if in.Filters != nil {
|
if in.Filters != nil {
|
||||||
in, out := &in.Filters, &out.Filters
|
in, out := &in.Filters, &out.Filters
|
||||||
*out = make([]ResourceFilter, len(*in))
|
*out = make([]ResourceFilter, len(*in))
|
||||||
copy(*out, *in)
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -776,7 +987,7 @@ func (in *ResourceClassParametersReference) DeepCopy() *ResourceClassParametersR
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter) {
|
func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter) {
|
||||||
*out = *in
|
*out = *in
|
||||||
out.ResourceFilterModel = in.ResourceFilterModel
|
in.ResourceFilterModel.DeepCopyInto(&out.ResourceFilterModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -793,6 +1004,11 @@ func (in *ResourceFilter) DeepCopy() *ResourceFilter {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ResourceFilterModel) DeepCopyInto(out *ResourceFilterModel) {
|
func (in *ResourceFilterModel) DeepCopyInto(out *ResourceFilterModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesFilter)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -833,7 +1049,7 @@ func (in *ResourceRequest) DeepCopyInto(out *ResourceRequest) {
|
|||||||
if in.VendorParameters != nil {
|
if in.VendorParameters != nil {
|
||||||
out.VendorParameters = in.VendorParameters.DeepCopyObject()
|
out.VendorParameters = in.VendorParameters.DeepCopyObject()
|
||||||
}
|
}
|
||||||
out.ResourceRequestModel = in.ResourceRequestModel
|
in.ResourceRequestModel.DeepCopyInto(&out.ResourceRequestModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,6 +1066,11 @@ func (in *ResourceRequest) DeepCopy() *ResourceRequest {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ResourceRequestModel) DeepCopyInto(out *ResourceRequestModel) {
|
func (in *ResourceRequestModel) DeepCopyInto(out *ResourceRequestModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesRequest)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
410
pkg/generated/openapi/zz_generated.openapi.go
generated
410
pkg/generated/openapi/zz_generated.openapi.go
generated
@@ -871,6 +871,15 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
|||||||
"k8s.io/api/resource/v1alpha2.AllocationResultModel": schema_k8sio_api_resource_v1alpha2_AllocationResultModel(ref),
|
"k8s.io/api/resource/v1alpha2.AllocationResultModel": schema_k8sio_api_resource_v1alpha2_AllocationResultModel(ref),
|
||||||
"k8s.io/api/resource/v1alpha2.DriverAllocationResult": schema_k8sio_api_resource_v1alpha2_DriverAllocationResult(ref),
|
"k8s.io/api/resource/v1alpha2.DriverAllocationResult": schema_k8sio_api_resource_v1alpha2_DriverAllocationResult(ref),
|
||||||
"k8s.io/api/resource/v1alpha2.DriverRequests": schema_k8sio_api_resource_v1alpha2_DriverRequests(ref),
|
"k8s.io/api/resource/v1alpha2.DriverRequests": schema_k8sio_api_resource_v1alpha2_DriverRequests(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesAllocationResult": schema_k8sio_api_resource_v1alpha2_NamedResourcesAllocationResult(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesAttribute": schema_k8sio_api_resource_v1alpha2_NamedResourcesAttribute(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesAttributeValue": schema_k8sio_api_resource_v1alpha2_NamedResourcesAttributeValue(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesFilter": schema_k8sio_api_resource_v1alpha2_NamedResourcesFilter(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesInstance": schema_k8sio_api_resource_v1alpha2_NamedResourcesInstance(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesIntSlice": schema_k8sio_api_resource_v1alpha2_NamedResourcesIntSlice(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesRequest": schema_k8sio_api_resource_v1alpha2_NamedResourcesRequest(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesResources": schema_k8sio_api_resource_v1alpha2_NamedResourcesResources(ref),
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesStringSlice": schema_k8sio_api_resource_v1alpha2_NamedResourcesStringSlice(ref),
|
||||||
"k8s.io/api/resource/v1alpha2.NodeResourceModel": schema_k8sio_api_resource_v1alpha2_NodeResourceModel(ref),
|
"k8s.io/api/resource/v1alpha2.NodeResourceModel": schema_k8sio_api_resource_v1alpha2_NodeResourceModel(ref),
|
||||||
"k8s.io/api/resource/v1alpha2.NodeResourceSlice": schema_k8sio_api_resource_v1alpha2_NodeResourceSlice(ref),
|
"k8s.io/api/resource/v1alpha2.NodeResourceSlice": schema_k8sio_api_resource_v1alpha2_NodeResourceSlice(ref),
|
||||||
"k8s.io/api/resource/v1alpha2.NodeResourceSliceList": schema_k8sio_api_resource_v1alpha2_NodeResourceSliceList(ref),
|
"k8s.io/api/resource/v1alpha2.NodeResourceSliceList": schema_k8sio_api_resource_v1alpha2_NodeResourceSliceList(ref),
|
||||||
@@ -44733,8 +44742,18 @@ func schema_k8sio_api_resource_v1alpha2_AllocationResultModel(ref common.Referen
|
|||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "AllocationResultModel must have one and only one field set.",
|
Description: "AllocationResultModel must have one and only one field set.",
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes the allocation result when using the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesAllocationResult"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesAllocationResult"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44751,11 +44770,17 @@ func schema_k8sio_api_resource_v1alpha2_DriverAllocationResult(ref common.Refere
|
|||||||
Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"),
|
Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes the allocation result when using the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesAllocationResult"),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Dependencies: []string{
|
Dependencies: []string{
|
||||||
"k8s.io/apimachinery/pkg/runtime.RawExtension"},
|
"k8s.io/api/resource/v1alpha2.NamedResourcesAllocationResult", "k8s.io/apimachinery/pkg/runtime.RawExtension"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44806,14 +44831,353 @@ func schema_k8sio_api_resource_v1alpha2_DriverRequests(ref common.ReferenceCallb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesAllocationResult(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesAllocationResult is used in AllocationResultModel.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"name": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Name is the name of the selected resource instance.",
|
||||||
|
Default: "",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"name"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesAttribute(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesAttribute is a combination of an attribute name and its value.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"name": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.",
|
||||||
|
Default: "",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "QuantityValue is a quantity.",
|
||||||
|
Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"bool": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "BoolValue is a true/false value.",
|
||||||
|
Type: []string{"boolean"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "IntValue is a 64-bit integer.",
|
||||||
|
Type: []string{"integer"},
|
||||||
|
Format: "int64",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"intSlice": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "IntSliceValue is an array of 64-bit integers.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesIntSlice"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "StringValue is a string.",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"stringSlice": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "StringSliceValue is an array of strings.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesStringSlice"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"name"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesIntSlice", "k8s.io/api/resource/v1alpha2.NamedResourcesStringSlice", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesAttributeValue(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesAttributeValue must have one and only one field set.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"quantity": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "QuantityValue is a quantity.",
|
||||||
|
Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"bool": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "BoolValue is a true/false value.",
|
||||||
|
Type: []string{"boolean"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "IntValue is a 64-bit integer.",
|
||||||
|
Type: []string{"integer"},
|
||||||
|
Format: "int64",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"intSlice": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "IntSliceValue is an array of 64-bit integers.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesIntSlice"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "StringValue is a string.",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"stringSlice": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "StringSliceValue is an array of strings.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesStringSlice"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesIntSlice", "k8s.io/api/resource/v1alpha2.NamedResourcesStringSlice", "k8s.io/apimachinery/pkg/api/resource.Quantity"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesFilter(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesFilter is used in ResourceFilterModel.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"selector": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()",
|
||||||
|
Default: "",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"selector"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesInstance(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesInstance represents one individual hardware instance that can be selected based on its attributes.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"name": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Name is unique identifier among all resource instances managed by the driver on the node. It must be a DNS subdomain.",
|
||||||
|
Default: "",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
VendorExtensible: spec.VendorExtensible{
|
||||||
|
Extensions: spec.Extensions{
|
||||||
|
"x-kubernetes-list-type": "atomic",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Attributes defines the attributes of this resource instance. The name of each attribute must be unique.",
|
||||||
|
Type: []string{"array"},
|
||||||
|
Items: &spec.SchemaOrArray{
|
||||||
|
Schema: &spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: map[string]interface{}{},
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesAttribute"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"name"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesAttribute"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesIntSlice(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesIntSlice contains a slice of 64-bit integers.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"ints": {
|
||||||
|
VendorExtensible: spec.VendorExtensible{
|
||||||
|
Extensions: spec.Extensions{
|
||||||
|
"x-kubernetes-list-type": "atomic",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Ints is the slice of 64-bit integers.",
|
||||||
|
Type: []string{"array"},
|
||||||
|
Items: &spec.SchemaOrArray{
|
||||||
|
Schema: &spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: 0,
|
||||||
|
Type: []string{"integer"},
|
||||||
|
Format: "int64",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"ints"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesRequest(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesRequest is used in ResourceRequestModel.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"selector": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Selector is a CEL expression which must evaluate to true if a resource instance is suitable. The language is as defined in https://kubernetes.io/docs/reference/using-api/cel/\n\nIn addition, for each type NamedResourcesin AttributeValue there is a map that resolves to the corresponding value of the instance under evaluation. For example:\n\n attributes.quantity[\"a\"].isGreaterThan(quantity(\"0\")) &&\n attributes.stringslice[\"b\"].isSorted()",
|
||||||
|
Default: "",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"selector"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesResources(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesResources is used in NodeResourceModel.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"instances": {
|
||||||
|
VendorExtensible: spec.VendorExtensible{
|
||||||
|
Extensions: spec.Extensions{
|
||||||
|
"x-kubernetes-list-type": "atomic",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "The list of all individual resources instances currently available.",
|
||||||
|
Type: []string{"array"},
|
||||||
|
Items: &spec.SchemaOrArray{
|
||||||
|
Schema: &spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: map[string]interface{}{},
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesInstance"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"instances"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesInstance"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func schema_k8sio_api_resource_v1alpha2_NamedResourcesStringSlice(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
|
return common.OpenAPIDefinition{
|
||||||
|
Schema: spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResourcesStringSlice contains a slice of strings.",
|
||||||
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"strings": {
|
||||||
|
VendorExtensible: spec.VendorExtensible{
|
||||||
|
Extensions: spec.Extensions{
|
||||||
|
"x-kubernetes-list-type": "atomic",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "Strings is the slice of strings.",
|
||||||
|
Type: []string{"array"},
|
||||||
|
Items: &spec.SchemaOrArray{
|
||||||
|
Schema: &spec.Schema{
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Default: "",
|
||||||
|
Type: []string{"string"},
|
||||||
|
Format: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Required: []string{"strings"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func schema_k8sio_api_resource_v1alpha2_NodeResourceModel(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
func schema_k8sio_api_resource_v1alpha2_NodeResourceModel(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||||
return common.OpenAPIDefinition{
|
return common.OpenAPIDefinition{
|
||||||
Schema: spec.Schema{
|
Schema: spec.Schema{
|
||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "NodeResourceModel must have one and only one field set.",
|
Description: "NodeResourceModel must have one and only one field set.",
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes available resources using the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesResources"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesResources"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44861,12 +45225,18 @@ func schema_k8sio_api_resource_v1alpha2_NodeResourceSlice(ref common.ReferenceCa
|
|||||||
Format: "",
|
Format: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes available resources using the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesResources"),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Required: []string{"nodeName", "driverName"},
|
Required: []string{"nodeName", "driverName"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Dependencies: []string{
|
Dependencies: []string{
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
"k8s.io/api/resource/v1alpha2.NamedResourcesResources", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45968,9 +46338,17 @@ func schema_k8sio_api_resource_v1alpha2_ResourceFilter(ref common.ReferenceCallb
|
|||||||
Format: "",
|
Format: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes a resource filter using the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesFilter"),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesFilter"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45980,8 +46358,18 @@ func schema_k8sio_api_resource_v1alpha2_ResourceFilterModel(ref common.Reference
|
|||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "ResourceFilterModel must have one and only one field set.",
|
Description: "ResourceFilterModel must have one and only one field set.",
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes a resource filter using the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesFilter"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesFilter"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46033,11 +46421,17 @@ func schema_k8sio_api_resource_v1alpha2_ResourceRequest(ref common.ReferenceCall
|
|||||||
Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"),
|
Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes a request for resources with the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesRequest"),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Dependencies: []string{
|
Dependencies: []string{
|
||||||
"k8s.io/apimachinery/pkg/runtime.RawExtension"},
|
"k8s.io/api/resource/v1alpha2.NamedResourcesRequest", "k8s.io/apimachinery/pkg/runtime.RawExtension"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46047,8 +46441,18 @@ func schema_k8sio_api_resource_v1alpha2_ResourceRequestModel(ref common.Referenc
|
|||||||
SchemaProps: spec.SchemaProps{
|
SchemaProps: spec.SchemaProps{
|
||||||
Description: "ResourceRequestModel must have one and only one field set.",
|
Description: "ResourceRequestModel must have one and only one field set.",
|
||||||
Type: []string{"object"},
|
Type: []string{"object"},
|
||||||
|
Properties: map[string]spec.Schema{
|
||||||
|
"namedResources": {
|
||||||
|
SchemaProps: spec.SchemaProps{
|
||||||
|
Description: "NamedResources describes a request for resources with the named resources model.",
|
||||||
|
Ref: ref("k8s.io/api/resource/v1alpha2.NamedResourcesRequest"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Dependencies: []string{
|
||||||
|
"k8s.io/api/resource/v1alpha2.NamedResourcesRequest"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,6 +53,9 @@ func validNewNodeResourceSlice(name string) *resource.NodeResourceSlice {
|
|||||||
},
|
},
|
||||||
NodeName: name,
|
NodeName: name,
|
||||||
DriverName: "cdi.example.com",
|
DriverName: "cdi.example.com",
|
||||||
|
NodeResourceModel: resource.NodeResourceModel{
|
||||||
|
NamedResources: &resource.NamedResourcesResources{},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,6 +30,9 @@ var slice = &resource.NodeResourceSlice{
|
|||||||
},
|
},
|
||||||
NodeName: "valid-node-name",
|
NodeName: "valid-node-name",
|
||||||
DriverName: "testdriver.example.com",
|
DriverName: "testdriver.example.com",
|
||||||
|
NodeResourceModel: resource.NodeResourceModel{
|
||||||
|
NamedResources: &resource.NamedResourcesResources{},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClassStrategy(t *testing.T) {
|
func TestClassStrategy(t *testing.T) {
|
||||||
|
@@ -46,8 +46,8 @@ func newStorage(t *testing.T) (*REST, *etcd3testing.EtcdTestServer) {
|
|||||||
return resourceClassStorage, server
|
return resourceClassStorage, server
|
||||||
}
|
}
|
||||||
|
|
||||||
func validNewResourceClaimParameters(name string) *resource.ResourceClaimParameters {
|
func validNewResourceClassParameters(name string) *resource.ResourceClassParameters {
|
||||||
return &resource.ResourceClaimParameters{
|
return &resource.ResourceClassParameters{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: metav1.NamespaceDefault,
|
Namespace: metav1.NamespaceDefault,
|
||||||
@@ -60,13 +60,13 @@ func TestCreate(t *testing.T) {
|
|||||||
defer server.Terminate(t)
|
defer server.Terminate(t)
|
||||||
defer storage.Store.DestroyFunc()
|
defer storage.Store.DestroyFunc()
|
||||||
test := genericregistrytest.New(t, storage.Store)
|
test := genericregistrytest.New(t, storage.Store)
|
||||||
resourceClass := validNewResourceClaimParameters("foo")
|
resourceClass := validNewResourceClassParameters("foo")
|
||||||
resourceClass.ObjectMeta = metav1.ObjectMeta{}
|
resourceClass.ObjectMeta = metav1.ObjectMeta{}
|
||||||
test.TestCreate(
|
test.TestCreate(
|
||||||
// valid
|
// valid
|
||||||
resourceClass,
|
resourceClass,
|
||||||
// invalid
|
// invalid
|
||||||
&resource.ResourceClaimParameters{
|
&resource.ResourceClassParameters{
|
||||||
ObjectMeta: metav1.ObjectMeta{Name: "*BadName!"},
|
ObjectMeta: metav1.ObjectMeta{Name: "*BadName!"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -79,16 +79,16 @@ func TestUpdate(t *testing.T) {
|
|||||||
test := genericregistrytest.New(t, storage.Store)
|
test := genericregistrytest.New(t, storage.Store)
|
||||||
test.TestUpdate(
|
test.TestUpdate(
|
||||||
// valid
|
// valid
|
||||||
validNewResourceClaimParameters("foo"),
|
validNewResourceClassParameters("foo"),
|
||||||
// updateFunc
|
// updateFunc
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*resource.ResourceClaimParameters)
|
object := obj.(*resource.ResourceClassParameters)
|
||||||
object.Labels = map[string]string{"foo": "bar"}
|
object.Labels = map[string]string{"foo": "bar"}
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
// invalid update
|
// invalid update
|
||||||
func(obj runtime.Object) runtime.Object {
|
func(obj runtime.Object) runtime.Object {
|
||||||
object := obj.(*resource.ResourceClaimParameters)
|
object := obj.(*resource.ResourceClassParameters)
|
||||||
object.Labels = map[string]string{"&$^^#%@": "1"}
|
object.Labels = map[string]string{"&$^^#%@": "1"}
|
||||||
return object
|
return object
|
||||||
},
|
},
|
||||||
@@ -101,7 +101,7 @@ func TestDelete(t *testing.T) {
|
|||||||
defer server.Terminate(t)
|
defer server.Terminate(t)
|
||||||
defer storage.Store.DestroyFunc()
|
defer storage.Store.DestroyFunc()
|
||||||
test := genericregistrytest.New(t, storage.Store).ReturnDeletedObject()
|
test := genericregistrytest.New(t, storage.Store).ReturnDeletedObject()
|
||||||
test.TestDelete(validNewResourceClaimParameters("foo"))
|
test.TestDelete(validNewResourceClassParameters("foo"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGet(t *testing.T) {
|
func TestGet(t *testing.T) {
|
||||||
@@ -109,7 +109,7 @@ func TestGet(t *testing.T) {
|
|||||||
defer server.Terminate(t)
|
defer server.Terminate(t)
|
||||||
defer storage.Store.DestroyFunc()
|
defer storage.Store.DestroyFunc()
|
||||||
test := genericregistrytest.New(t, storage.Store)
|
test := genericregistrytest.New(t, storage.Store)
|
||||||
test.TestGet(validNewResourceClaimParameters("foo"))
|
test.TestGet(validNewResourceClassParameters("foo"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestList(t *testing.T) {
|
func TestList(t *testing.T) {
|
||||||
@@ -117,7 +117,7 @@ func TestList(t *testing.T) {
|
|||||||
defer server.Terminate(t)
|
defer server.Terminate(t)
|
||||||
defer storage.Store.DestroyFunc()
|
defer storage.Store.DestroyFunc()
|
||||||
test := genericregistrytest.New(t, storage.Store)
|
test := genericregistrytest.New(t, storage.Store)
|
||||||
test.TestList(validNewResourceClaimParameters("foo"))
|
test.TestList(validNewResourceClassParameters("foo"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWatch(t *testing.T) {
|
func TestWatch(t *testing.T) {
|
||||||
@@ -126,7 +126,7 @@ func TestWatch(t *testing.T) {
|
|||||||
defer storage.Store.DestroyFunc()
|
defer storage.Store.DestroyFunc()
|
||||||
test := genericregistrytest.New(t, storage.Store)
|
test := genericregistrytest.New(t, storage.Store)
|
||||||
test.TestWatch(
|
test.TestWatch(
|
||||||
validNewResourceClaimParameters("foo"),
|
validNewResourceClassParameters("foo"),
|
||||||
// matching labels
|
// matching labels
|
||||||
[]labels.Set{},
|
[]labels.Set{},
|
||||||
// not matching labels
|
// not matching labels
|
||||||
|
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package namedresources
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"slices"
|
||||||
|
|
||||||
|
resourceapi "k8s.io/api/resource/v1alpha2"
|
||||||
|
"k8s.io/apiserver/pkg/cel/environment"
|
||||||
|
"k8s.io/dynamic-resource-allocation/structured/namedresources/cel"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Model struct {
|
||||||
|
instances []instanceAllocation
|
||||||
|
}
|
||||||
|
|
||||||
|
type instanceAllocation struct {
|
||||||
|
allocated bool
|
||||||
|
instance *resourceapi.NamedResourcesInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddResources must be called first to create entries for all existing
|
||||||
|
// resource instances. The resources parameter may be nil.
|
||||||
|
func AddResources(m *Model, resources *resourceapi.NamedResourcesResources) {
|
||||||
|
if resources == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range resources.Instances {
|
||||||
|
m.instances = append(m.instances, instanceAllocation{instance: &resources.Instances[i]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddAllocation may get called after AddResources to mark some resource
|
||||||
|
// instances as allocated. The result parameter may be nil.
|
||||||
|
func AddAllocation(m *Model, result *resourceapi.NamedResourcesAllocationResult) {
|
||||||
|
if result == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i := range m.instances {
|
||||||
|
if m.instances[i].instance.Name == result.Name {
|
||||||
|
m.instances[i].allocated = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClaimController(filter *resourceapi.NamedResourcesFilter, requests []*resourceapi.NamedResourcesRequest) (*Controller, error) {
|
||||||
|
c := &Controller{}
|
||||||
|
if filter != nil {
|
||||||
|
compilation := cel.Compiler.CompileCELExpression(filter.Selector, environment.StoredExpressions)
|
||||||
|
if compilation.Error != nil {
|
||||||
|
// Shouldn't happen because of validation.
|
||||||
|
return nil, fmt.Errorf("compile class filter CEL expression: %w", compilation.Error)
|
||||||
|
}
|
||||||
|
c.filter = &compilation
|
||||||
|
}
|
||||||
|
for _, request := range requests {
|
||||||
|
compilation := cel.Compiler.CompileCELExpression(request.Selector, environment.StoredExpressions)
|
||||||
|
if compilation.Error != nil {
|
||||||
|
// Shouldn't happen because of validation.
|
||||||
|
return nil, fmt.Errorf("compile request CEL expression: %w", compilation.Error)
|
||||||
|
}
|
||||||
|
c.requests = append(c.requests, compilation)
|
||||||
|
}
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Controller struct {
|
||||||
|
filter *cel.CompilationResult
|
||||||
|
requests []cel.CompilationResult
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) NodeIsSuitable(ctx context.Context, model Model) (bool, error) {
|
||||||
|
indices, err := c.allocate(ctx, model)
|
||||||
|
return len(indices) == len(c.requests), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) Allocate(ctx context.Context, model Model) ([]*resourceapi.NamedResourcesAllocationResult, error) {
|
||||||
|
indices, err := c.allocate(ctx, model)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(indices) != len(c.requests) {
|
||||||
|
return nil, errors.New("insufficient resources")
|
||||||
|
}
|
||||||
|
results := make([]*resourceapi.NamedResourcesAllocationResult, len(c.requests))
|
||||||
|
for i := range c.requests {
|
||||||
|
results[i] = &resourceapi.NamedResourcesAllocationResult{Name: model.instances[indices[i]].instance.Name}
|
||||||
|
}
|
||||||
|
return results, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Controller) allocate(ctx context.Context, model Model) ([]int, error) {
|
||||||
|
// Shallow copy, we need to modify the allocated boolean.
|
||||||
|
instances := slices.Clone(model.instances)
|
||||||
|
indices := make([]int, 0, len(c.requests))
|
||||||
|
|
||||||
|
for _, request := range c.requests {
|
||||||
|
for i, instance := range instances {
|
||||||
|
if instance.allocated {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if c.filter != nil {
|
||||||
|
okay, err := c.filter.Evaluate(ctx, instance.instance.Attributes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("evaluate filter CEL expression: %w", err)
|
||||||
|
}
|
||||||
|
if !okay {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
okay, err := request.Evaluate(ctx, instance.instance.Attributes)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("evaluate request CEL expression: %w", err)
|
||||||
|
}
|
||||||
|
if !okay {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// Found a matching, unallocated instance. Let's use it.
|
||||||
|
//
|
||||||
|
// A more thorough search would include backtracking because
|
||||||
|
// allocating one "large" instances for a "small" request may
|
||||||
|
// make a following "large" request impossible to satisfy when
|
||||||
|
// only "small" instances are left.
|
||||||
|
instances[i].allocated = true
|
||||||
|
indices = append(indices, i)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indices, nil
|
||||||
|
|
||||||
|
}
|
@@ -23,8 +23,10 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
resourcev1alpha2 "k8s.io/api/resource/v1alpha2"
|
resourcev1alpha2 "k8s.io/api/resource/v1alpha2"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
resourcev1alpha2listers "k8s.io/client-go/listers/resource/v1alpha2"
|
resourcev1alpha2listers "k8s.io/client-go/listers/resource/v1alpha2"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
namedresourcesmodel "k8s.io/kubernetes/pkg/scheduler/framework/plugins/dynamicresources/structured/namedresources"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
|
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,7 +37,7 @@ type resources map[string]map[string]resourceModels
|
|||||||
// resourceModels may have more than one entry because it is valid for a driver to
|
// resourceModels may have more than one entry because it is valid for a driver to
|
||||||
// use more than one structured parameter model.
|
// use more than one structured parameter model.
|
||||||
type resourceModels struct {
|
type resourceModels struct {
|
||||||
// TODO: add some structured parameter model
|
namedresources namedresourcesmodel.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
// newResourceModel parses the available information about resources. Objects
|
// newResourceModel parses the available information about resources. Objects
|
||||||
@@ -54,7 +56,7 @@ func newResourceModel(logger klog.Logger, nodeResourceSliceLister resourcev1alph
|
|||||||
model[slice.NodeName] = make(map[string]resourceModels)
|
model[slice.NodeName] = make(map[string]resourceModels)
|
||||||
}
|
}
|
||||||
resource := model[slice.NodeName][slice.DriverName]
|
resource := model[slice.NodeName][slice.DriverName]
|
||||||
// TODO: add some structured parameter model
|
namedresourcesmodel.AddResources(&resource.namedresources, slice.NamedResources)
|
||||||
model[slice.NodeName][slice.DriverName] = resource
|
model[slice.NodeName][slice.DriverName] = resource
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,11 +77,11 @@ func newResourceModel(logger klog.Logger, nodeResourceSliceLister resourcev1alph
|
|||||||
if model[structured.NodeName] == nil {
|
if model[structured.NodeName] == nil {
|
||||||
model[structured.NodeName] = make(map[string]resourceModels)
|
model[structured.NodeName] = make(map[string]resourceModels)
|
||||||
}
|
}
|
||||||
// resource := model[structured.NodeName][handle.DriverName]
|
resource := model[structured.NodeName][handle.DriverName]
|
||||||
// TODO: add some structured parameter model
|
for _, result := range structured.Results {
|
||||||
// for _, result := range structured.Results {
|
// Call AddAllocation for each known model. Each call itself needs to check for nil.
|
||||||
// // Call AddAllocation for each known model. Each call itself needs to check for nil.
|
namedresourcesmodel.AddAllocation(&resource.namedresources, result.NamedResources)
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,12 +92,52 @@ func newClaimController(logger klog.Logger, class *resourcev1alpha2.ResourceClas
|
|||||||
// Each node driver is separate from the others. Each driver may have
|
// Each node driver is separate from the others. Each driver may have
|
||||||
// multiple requests which need to be allocated together, so here
|
// multiple requests which need to be allocated together, so here
|
||||||
// we have to collect them per model.
|
// we have to collect them per model.
|
||||||
// TODO: implement some structured parameters model
|
type perDriverRequests struct {
|
||||||
|
parameters []runtime.RawExtension
|
||||||
|
requests []*resourcev1alpha2.NamedResourcesRequest
|
||||||
|
}
|
||||||
|
namedresourcesRequests := make(map[string]perDriverRequests)
|
||||||
|
for i, request := range claimParameters.DriverRequests {
|
||||||
|
driverName := request.DriverName
|
||||||
|
p := namedresourcesRequests[driverName]
|
||||||
|
for e, request := range request.Requests {
|
||||||
|
switch {
|
||||||
|
case request.ResourceRequestModel.NamedResources != nil:
|
||||||
|
p.parameters = append(p.parameters, request.VendorParameters)
|
||||||
|
p.requests = append(p.requests, request.ResourceRequestModel.NamedResources)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("claim parameters %s: driverRequersts[%d].requests[%d]: no supported structured parameters found", klog.KObj(claimParameters), i, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(p.requests) > 0 {
|
||||||
|
namedresourcesRequests[driverName] = p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c := &claimController{
|
c := &claimController{
|
||||||
class: class,
|
class: class,
|
||||||
classParameters: classParameters,
|
classParameters: classParameters,
|
||||||
claimParameters: claimParameters,
|
claimParameters: claimParameters,
|
||||||
|
namedresources: make(map[string]perDriverController, len(namedresourcesRequests)),
|
||||||
|
}
|
||||||
|
for driverName, perDriver := range namedresourcesRequests {
|
||||||
|
var filter *resourcev1alpha2.NamedResourcesFilter
|
||||||
|
if classParameters != nil {
|
||||||
|
for _, f := range classParameters.Filters {
|
||||||
|
if f.DriverName == driverName && f.ResourceFilterModel.NamedResources != nil {
|
||||||
|
filter = f.ResourceFilterModel.NamedResources
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
controller, err := namedresourcesmodel.NewClaimController(filter, perDriver.requests)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("creating claim controller for named resources structured model: %w", err)
|
||||||
|
}
|
||||||
|
c.namedresources[driverName] = perDriverController{
|
||||||
|
parameters: perDriver.parameters,
|
||||||
|
controller: controller,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
@@ -106,11 +148,28 @@ type claimController struct {
|
|||||||
class *resourcev1alpha2.ResourceClass
|
class *resourcev1alpha2.ResourceClass
|
||||||
classParameters *resourcev1alpha2.ResourceClassParameters
|
classParameters *resourcev1alpha2.ResourceClassParameters
|
||||||
claimParameters *resourcev1alpha2.ResourceClaimParameters
|
claimParameters *resourcev1alpha2.ResourceClaimParameters
|
||||||
// TODO: implement some structured parameters model
|
namedresources map[string]perDriverController
|
||||||
|
}
|
||||||
|
|
||||||
|
type perDriverController struct {
|
||||||
|
parameters []runtime.RawExtension
|
||||||
|
controller *namedresourcesmodel.Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c claimController) nodeIsSuitable(ctx context.Context, nodeName string, resources resources) (bool, error) {
|
func (c claimController) nodeIsSuitable(ctx context.Context, nodeName string, resources resources) (bool, error) {
|
||||||
// TODO: implement some structured parameters model
|
nodeResources := resources[nodeName]
|
||||||
|
for driverName, perDriver := range c.namedresources {
|
||||||
|
okay, err := perDriver.controller.NodeIsSuitable(ctx, nodeResources[driverName].namedresources)
|
||||||
|
if err != nil {
|
||||||
|
// This is an error in the CEL expression which needs
|
||||||
|
// to be fixed. Better fail very visibly instead of
|
||||||
|
// ignoring the node.
|
||||||
|
return false, fmt.Errorf("checking node %q and resources of driver %q: %w", nodeName, driverName, err)
|
||||||
|
}
|
||||||
|
if !okay {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +187,49 @@ func (c claimController) allocate(ctx context.Context, nodeName string, resource
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: implement some structured parameters model
|
nodeResources := resources[nodeName]
|
||||||
|
for driverName, perDriver := range c.namedresources {
|
||||||
|
// Must return one entry for each request. The entry may be nil. This way,
|
||||||
|
// the result can be correlated with the per-request parameters.
|
||||||
|
results, err := perDriver.controller.Allocate(ctx, nodeResources[driverName].namedresources)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, fmt.Errorf("allocating via named resources structured model: %w", err)
|
||||||
|
}
|
||||||
|
handle := resourcev1alpha2.ResourceHandle{
|
||||||
|
DriverName: driverName,
|
||||||
|
StructuredData: &resourcev1alpha2.StructuredResourceHandle{
|
||||||
|
NodeName: nodeName,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for i, result := range results {
|
||||||
|
if result == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
handle.StructuredData.Results = append(handle.StructuredData.Results,
|
||||||
|
resourcev1alpha2.DriverAllocationResult{
|
||||||
|
VendorRequestParameters: perDriver.parameters[i],
|
||||||
|
AllocationResultModel: resourcev1alpha2.AllocationResultModel{
|
||||||
|
NamedResources: result,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if c.classParameters != nil {
|
||||||
|
for _, p := range c.classParameters.VendorParameters {
|
||||||
|
if p.DriverName == driverName {
|
||||||
|
handle.StructuredData.VendorClassParameters = p.Parameters
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, request := range c.claimParameters.DriverRequests {
|
||||||
|
if request.DriverName == driverName {
|
||||||
|
handle.StructuredData.VendorClaimParameters = request.VendorParameters
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allocation.ResourceHandles = append(allocation.ResourceHandles, handle)
|
||||||
|
}
|
||||||
|
|
||||||
return c.class.DriverName, allocation, nil
|
return c.class.DriverName, allocation, nil
|
||||||
}
|
}
|
||||||
|
@@ -250,6 +250,9 @@
|
|||||||
allowedImports:
|
allowedImports:
|
||||||
- k8s.io/api
|
- k8s.io/api
|
||||||
- k8s.io/apimachinery
|
- k8s.io/apimachinery
|
||||||
|
- k8s.io/apiserver/pkg/apis/cel
|
||||||
|
- k8s.io/apiserver/pkg/cel
|
||||||
|
- k8s.io/apiserver/pkg/cel/environment
|
||||||
- k8s.io/client-go
|
- k8s.io/client-go
|
||||||
- k8s.io/dynamic-resource-allocation
|
- k8s.io/dynamic-resource-allocation
|
||||||
- k8s.io/klog
|
- k8s.io/klog
|
||||||
|
@@ -2265,6 +2265,8 @@ rules:
|
|||||||
branch: master
|
branch: master
|
||||||
- repository: component-base
|
- repository: component-base
|
||||||
branch: master
|
branch: master
|
||||||
|
- repository: kms
|
||||||
|
branch: master
|
||||||
- repository: kubelet
|
- repository: kubelet
|
||||||
branch: master
|
branch: master
|
||||||
source:
|
source:
|
||||||
|
2382
staging/src/k8s.io/api/resource/v1alpha2/generated.pb.go
generated
2382
staging/src/k8s.io/api/resource/v1alpha2/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,7 @@ syntax = "proto2";
|
|||||||
package k8s.io.api.resource.v1alpha2;
|
package k8s.io.api.resource.v1alpha2;
|
||||||
|
|
||||||
import "k8s.io/api/core/v1/generated.proto";
|
import "k8s.io/api/core/v1/generated.proto";
|
||||||
|
import "k8s.io/apimachinery/pkg/api/resource/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||||
@@ -65,6 +66,10 @@ message AllocationResult {
|
|||||||
|
|
||||||
// AllocationResultModel must have one and only one field set.
|
// AllocationResultModel must have one and only one field set.
|
||||||
message AllocationResultModel {
|
message AllocationResultModel {
|
||||||
|
// NamedResources describes the allocation result when using the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
optional NamedResourcesAllocationResult namedResources = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DriverAllocationResult contains vendor parameters and the allocation result for
|
// DriverAllocationResult contains vendor parameters and the allocation result for
|
||||||
@@ -95,8 +100,117 @@ message DriverRequests {
|
|||||||
repeated ResourceRequest requests = 3;
|
repeated ResourceRequest requests = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAllocationResult is used in AllocationResultModel.
|
||||||
|
message NamedResourcesAllocationResult {
|
||||||
|
// Name is the name of the selected resource instance.
|
||||||
|
optional string name = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAttribute is a combination of an attribute name and its value.
|
||||||
|
message NamedResourcesAttribute {
|
||||||
|
// Name is unique identifier among all resource instances managed by
|
||||||
|
// the driver on the node. It must be a DNS subdomain.
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
optional NamedResourcesAttributeValue attributeValue = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAttributeValue must have one and only one field set.
|
||||||
|
message NamedResourcesAttributeValue {
|
||||||
|
// QuantityValue is a quantity.
|
||||||
|
optional k8s.io.apimachinery.pkg.api.resource.Quantity quantity = 6;
|
||||||
|
|
||||||
|
// BoolValue is a true/false value.
|
||||||
|
optional bool bool = 2;
|
||||||
|
|
||||||
|
// IntValue is a 64-bit integer.
|
||||||
|
optional int64 int = 7;
|
||||||
|
|
||||||
|
// IntSliceValue is an array of 64-bit integers.
|
||||||
|
optional NamedResourcesIntSlice intSlice = 8;
|
||||||
|
|
||||||
|
// StringValue is a string.
|
||||||
|
optional string string = 5;
|
||||||
|
|
||||||
|
// StringSliceValue is an array of strings.
|
||||||
|
optional NamedResourcesStringSlice stringSlice = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesFilter is used in ResourceFilterModel.
|
||||||
|
message NamedResourcesFilter {
|
||||||
|
// Selector is a CEL expression which must evaluate to true if a
|
||||||
|
// resource instance is suitable. The language is as defined in
|
||||||
|
// https://kubernetes.io/docs/reference/using-api/cel/
|
||||||
|
//
|
||||||
|
// In addition, for each type NamedResourcesin AttributeValue there is a map that
|
||||||
|
// resolves to the corresponding value of the instance under evaluation.
|
||||||
|
// For example:
|
||||||
|
//
|
||||||
|
// attributes.quantity["a"].isGreaterThan(quantity("0")) &&
|
||||||
|
// attributes.stringslice["b"].isSorted()
|
||||||
|
optional string selector = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesInstance represents one individual hardware instance that can be selected based
|
||||||
|
// on its attributes.
|
||||||
|
message NamedResourcesInstance {
|
||||||
|
// Name is unique identifier among all resource instances managed by
|
||||||
|
// the driver on the node. It must be a DNS subdomain.
|
||||||
|
optional string name = 1;
|
||||||
|
|
||||||
|
// Attributes defines the attributes of this resource instance.
|
||||||
|
// The name of each attribute must be unique.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
// +optional
|
||||||
|
repeated NamedResourcesAttribute attributes = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesIntSlice contains a slice of 64-bit integers.
|
||||||
|
message NamedResourcesIntSlice {
|
||||||
|
// Ints is the slice of 64-bit integers.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
repeated int64 ints = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesRequest is used in ResourceRequestModel.
|
||||||
|
message NamedResourcesRequest {
|
||||||
|
// Selector is a CEL expression which must evaluate to true if a
|
||||||
|
// resource instance is suitable. The language is as defined in
|
||||||
|
// https://kubernetes.io/docs/reference/using-api/cel/
|
||||||
|
//
|
||||||
|
// In addition, for each type NamedResourcesin AttributeValue there is a map that
|
||||||
|
// resolves to the corresponding value of the instance under evaluation.
|
||||||
|
// For example:
|
||||||
|
//
|
||||||
|
// attributes.quantity["a"].isGreaterThan(quantity("0")) &&
|
||||||
|
// attributes.stringslice["b"].isSorted()
|
||||||
|
optional string selector = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesResources is used in NodeResourceModel.
|
||||||
|
message NamedResourcesResources {
|
||||||
|
// The list of all individual resources instances currently available.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
repeated NamedResourcesInstance instances = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesStringSlice contains a slice of strings.
|
||||||
|
message NamedResourcesStringSlice {
|
||||||
|
// Strings is the slice of strings.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
repeated string strings = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// NodeResourceModel must have one and only one field set.
|
// NodeResourceModel must have one and only one field set.
|
||||||
message NodeResourceModel {
|
message NodeResourceModel {
|
||||||
|
// NamedResources describes available resources using the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
optional NamedResourcesResources namedResources = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeResourceSlice provides information about available
|
// NodeResourceSlice provides information about available
|
||||||
@@ -536,6 +650,10 @@ message ResourceFilter {
|
|||||||
|
|
||||||
// ResourceFilterModel must have one and only one field set.
|
// ResourceFilterModel must have one and only one field set.
|
||||||
message ResourceFilterModel {
|
message ResourceFilterModel {
|
||||||
|
// NamedResources describes a resource filter using the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
optional NamedResourcesFilter namedResources = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceHandle holds opaque resource data for processing by a specific kubelet plugin.
|
// ResourceHandle holds opaque resource data for processing by a specific kubelet plugin.
|
||||||
@@ -577,6 +695,10 @@ message ResourceRequest {
|
|||||||
|
|
||||||
// ResourceRequestModel must have one and only one field set.
|
// ResourceRequestModel must have one and only one field set.
|
||||||
message ResourceRequestModel {
|
message ResourceRequestModel {
|
||||||
|
// NamedResources describes a request for resources with the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
optional NamedResourcesRequest namedResources = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// StructuredResourceHandle is the in-tree representation of the allocation result.
|
// StructuredResourceHandle is the in-tree representation of the allocation result.
|
||||||
|
137
staging/src/k8s.io/api/resource/v1alpha2/namedresources.go
Normal file
137
staging/src/k8s.io/api/resource/v1alpha2/namedresources.go
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2023 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NamedResourcesResources is used in NodeResourceModel.
|
||||||
|
type NamedResourcesResources struct {
|
||||||
|
// The list of all individual resources instances currently available.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
Instances []NamedResourcesInstance `json:"instances" protobuf:"bytes,1,name=instances"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesInstance represents one individual hardware instance that can be selected based
|
||||||
|
// on its attributes.
|
||||||
|
type NamedResourcesInstance struct {
|
||||||
|
// Name is unique identifier among all resource instances managed by
|
||||||
|
// the driver on the node. It must be a DNS subdomain.
|
||||||
|
Name string `json:"name" protobuf:"bytes,1,name=name"`
|
||||||
|
|
||||||
|
// Attributes defines the attributes of this resource instance.
|
||||||
|
// The name of each attribute must be unique.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
// +optional
|
||||||
|
Attributes []NamedResourcesAttribute `json:"attributes,omitempty" protobuf:"bytes,2,opt,name=attributes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAttribute is a combination of an attribute name and its value.
|
||||||
|
type NamedResourcesAttribute struct {
|
||||||
|
// Name is unique identifier among all resource instances managed by
|
||||||
|
// the driver on the node. It must be a DNS subdomain.
|
||||||
|
Name string `json:"name" protobuf:"bytes,1,name=name"`
|
||||||
|
|
||||||
|
NamedResourcesAttributeValue `json:",inline" protobuf:"bytes,2,opt,name=attributeValue"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Go field names below have a Value suffix to avoid a conflict between the
|
||||||
|
// field "String" and the corresponding method. That method is required.
|
||||||
|
// The Kubernetes API is defined without that suffix to keep it more natural.
|
||||||
|
|
||||||
|
// NamedResourcesAttributeValue must have one and only one field set.
|
||||||
|
type NamedResourcesAttributeValue struct {
|
||||||
|
// QuantityValue is a quantity.
|
||||||
|
QuantityValue *resource.Quantity `json:"quantity,omitempty" protobuf:"bytes,6,opt,name=quantity"`
|
||||||
|
// BoolValue is a true/false value.
|
||||||
|
BoolValue *bool `json:"bool,omitempty" protobuf:"bytes,2,opt,name=bool"`
|
||||||
|
// IntValue is a 64-bit integer.
|
||||||
|
IntValue *int64 `json:"int,omitempty" protobuf:"varint,7,opt,name=int"`
|
||||||
|
// IntSliceValue is an array of 64-bit integers.
|
||||||
|
IntSliceValue *NamedResourcesIntSlice `json:"intSlice,omitempty" protobuf:"varint,8,rep,name=intSlice"`
|
||||||
|
// StringValue is a string.
|
||||||
|
StringValue *string `json:"string,omitempty" protobuf:"bytes,5,opt,name=string"`
|
||||||
|
// StringSliceValue is an array of strings.
|
||||||
|
StringSliceValue *NamedResourcesStringSlice `json:"stringSlice,omitempty" protobuf:"bytes,9,rep,name=stringSlice"`
|
||||||
|
// TODO: VersionValue *SemVersion `json:"version,omitempty" protobuf:"bytes,7,opt,name=version"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesIntSlice contains a slice of 64-bit integers.
|
||||||
|
type NamedResourcesIntSlice struct {
|
||||||
|
// Ints is the slice of 64-bit integers.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
Ints []int64 `json:"ints" protobuf:"bytes,1,opt,name=ints"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesStringSlice contains a slice of strings.
|
||||||
|
type NamedResourcesStringSlice struct {
|
||||||
|
// Strings is the slice of strings.
|
||||||
|
//
|
||||||
|
// +listType=atomic
|
||||||
|
Strings []string `json:"strings" protobuf:"bytes,1,opt,name=strings"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//
|
||||||
|
// A wrapper around https://pkg.go.dev/github.com/blang/semver/v4#Version which
|
||||||
|
// is encoded as a string. During decoding, it validates that the string
|
||||||
|
// can be parsed using tolerant parsing (currently trims spaces, removes a "v" prefix,
|
||||||
|
// adds a 0 patch number to versions with only major and minor components specified,
|
||||||
|
// and removes leading 0s).
|
||||||
|
// type NamedResourcesSemVersion struct {
|
||||||
|
// semver.Version
|
||||||
|
//}
|
||||||
|
|
||||||
|
// NamedResourcesRequest is used in ResourceRequestModel.
|
||||||
|
type NamedResourcesRequest struct {
|
||||||
|
// Selector is a CEL expression which must evaluate to true if a
|
||||||
|
// resource instance is suitable. The language is as defined in
|
||||||
|
// https://kubernetes.io/docs/reference/using-api/cel/
|
||||||
|
//
|
||||||
|
// In addition, for each type NamedResourcesin AttributeValue there is a map that
|
||||||
|
// resolves to the corresponding value of the instance under evaluation.
|
||||||
|
// For example:
|
||||||
|
//
|
||||||
|
// attributes.quantity["a"].isGreaterThan(quantity("0")) &&
|
||||||
|
// attributes.stringslice["b"].isSorted()
|
||||||
|
Selector string `json:"selector" protobuf:"bytes,1,name=selector"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesFilter is used in ResourceFilterModel.
|
||||||
|
type NamedResourcesFilter struct {
|
||||||
|
// Selector is a CEL expression which must evaluate to true if a
|
||||||
|
// resource instance is suitable. The language is as defined in
|
||||||
|
// https://kubernetes.io/docs/reference/using-api/cel/
|
||||||
|
//
|
||||||
|
// In addition, for each type NamedResourcesin AttributeValue there is a map that
|
||||||
|
// resolves to the corresponding value of the instance under evaluation.
|
||||||
|
// For example:
|
||||||
|
//
|
||||||
|
// attributes.quantity["a"].isGreaterThan(quantity("0")) &&
|
||||||
|
// attributes.stringslice["b"].isSorted()
|
||||||
|
Selector string `json:"selector" protobuf:"bytes,1,name=selector"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAllocationResult is used in AllocationResultModel.
|
||||||
|
type NamedResourcesAllocationResult struct {
|
||||||
|
// Name is the name of the selected resource instance.
|
||||||
|
Name string `json:"name" protobuf:"bytes,1,name=name"`
|
||||||
|
}
|
@@ -247,7 +247,10 @@ type DriverAllocationResult struct {
|
|||||||
|
|
||||||
// AllocationResultModel must have one and only one field set.
|
// AllocationResultModel must have one and only one field set.
|
||||||
type AllocationResultModel struct {
|
type AllocationResultModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes the allocation result when using the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
NamedResources *NamedResourcesAllocationResult `json:"namedResources,omitempty" protobuf:"bytes,1,opt,name=namedResources"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@@ -549,7 +552,10 @@ type NodeResourceSlice struct {
|
|||||||
|
|
||||||
// NodeResourceModel must have one and only one field set.
|
// NodeResourceModel must have one and only one field set.
|
||||||
type NodeResourceModel struct {
|
type NodeResourceModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes available resources using the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
NamedResources *NamedResourcesResources `json:"namedResources,omitempty" protobuf:"bytes,1,opt,name=namedResources"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@@ -629,7 +635,10 @@ type ResourceRequest struct {
|
|||||||
|
|
||||||
// ResourceRequestModel must have one and only one field set.
|
// ResourceRequestModel must have one and only one field set.
|
||||||
type ResourceRequestModel struct {
|
type ResourceRequestModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes a request for resources with the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
NamedResources *NamedResourcesRequest `json:"namedResources,omitempty" protobuf:"bytes,1,opt,name=namedResources"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@@ -688,7 +697,10 @@ type ResourceFilter struct {
|
|||||||
|
|
||||||
// ResourceFilterModel must have one and only one field set.
|
// ResourceFilterModel must have one and only one field set.
|
||||||
type ResourceFilterModel struct {
|
type ResourceFilterModel struct {
|
||||||
// TODO: implement one structured parameter model
|
// NamedResources describes a resource filter using the named resources model.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
NamedResources *NamedResourcesFilter `json:"namedResources,omitempty" protobuf:"bytes,1,opt,name=namedResources"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
@@ -39,7 +39,8 @@ func (AllocationResult) SwaggerDoc() map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map_AllocationResultModel = map[string]string{
|
var map_AllocationResultModel = map[string]string{
|
||||||
"": "AllocationResultModel must have one and only one field set.",
|
"": "AllocationResultModel must have one and only one field set.",
|
||||||
|
"namedResources": "NamedResources describes the allocation result when using the named resources model.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (AllocationResultModel) SwaggerDoc() map[string]string {
|
func (AllocationResultModel) SwaggerDoc() map[string]string {
|
||||||
@@ -67,7 +68,8 @@ func (DriverRequests) SwaggerDoc() map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map_NodeResourceModel = map[string]string{
|
var map_NodeResourceModel = map[string]string{
|
||||||
"": "NodeResourceModel must have one and only one field set.",
|
"": "NodeResourceModel must have one and only one field set.",
|
||||||
|
"namedResources": "NamedResources describes available resources using the named resources model.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (NodeResourceModel) SwaggerDoc() map[string]string {
|
func (NodeResourceModel) SwaggerDoc() map[string]string {
|
||||||
@@ -331,7 +333,8 @@ func (ResourceFilter) SwaggerDoc() map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map_ResourceFilterModel = map[string]string{
|
var map_ResourceFilterModel = map[string]string{
|
||||||
"": "ResourceFilterModel must have one and only one field set.",
|
"": "ResourceFilterModel must have one and only one field set.",
|
||||||
|
"namedResources": "NamedResources describes a resource filter using the named resources model.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ResourceFilterModel) SwaggerDoc() map[string]string {
|
func (ResourceFilterModel) SwaggerDoc() map[string]string {
|
||||||
@@ -359,7 +362,8 @@ func (ResourceRequest) SwaggerDoc() map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map_ResourceRequestModel = map[string]string{
|
var map_ResourceRequestModel = map[string]string{
|
||||||
"": "ResourceRequestModel must have one and only one field set.",
|
"": "ResourceRequestModel must have one and only one field set.",
|
||||||
|
"namedResources": "NamedResources describes a request for resources with the named resources model.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ResourceRequestModel) SwaggerDoc() map[string]string {
|
func (ResourceRequestModel) SwaggerDoc() map[string]string {
|
||||||
|
@@ -57,6 +57,11 @@ func (in *AllocationResult) DeepCopy() *AllocationResult {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *AllocationResultModel) DeepCopyInto(out *AllocationResultModel) {
|
func (in *AllocationResultModel) DeepCopyInto(out *AllocationResultModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesAllocationResult)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +79,7 @@ func (in *AllocationResultModel) DeepCopy() *AllocationResultModel {
|
|||||||
func (in *DriverAllocationResult) DeepCopyInto(out *DriverAllocationResult) {
|
func (in *DriverAllocationResult) DeepCopyInto(out *DriverAllocationResult) {
|
||||||
*out = *in
|
*out = *in
|
||||||
in.VendorRequestParameters.DeepCopyInto(&out.VendorRequestParameters)
|
in.VendorRequestParameters.DeepCopyInto(&out.VendorRequestParameters)
|
||||||
out.AllocationResultModel = in.AllocationResultModel
|
in.AllocationResultModel.DeepCopyInto(&out.AllocationResultModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,9 +117,213 @@ func (in *DriverRequests) DeepCopy() *DriverRequests {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesAllocationResult) DeepCopyInto(out *NamedResourcesAllocationResult) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesAllocationResult.
|
||||||
|
func (in *NamedResourcesAllocationResult) DeepCopy() *NamedResourcesAllocationResult {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesAllocationResult)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesAttribute) DeepCopyInto(out *NamedResourcesAttribute) {
|
||||||
|
*out = *in
|
||||||
|
in.NamedResourcesAttributeValue.DeepCopyInto(&out.NamedResourcesAttributeValue)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesAttribute.
|
||||||
|
func (in *NamedResourcesAttribute) DeepCopy() *NamedResourcesAttribute {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesAttribute)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesAttributeValue) DeepCopyInto(out *NamedResourcesAttributeValue) {
|
||||||
|
*out = *in
|
||||||
|
if in.QuantityValue != nil {
|
||||||
|
in, out := &in.QuantityValue, &out.QuantityValue
|
||||||
|
x := (*in).DeepCopy()
|
||||||
|
*out = &x
|
||||||
|
}
|
||||||
|
if in.BoolValue != nil {
|
||||||
|
in, out := &in.BoolValue, &out.BoolValue
|
||||||
|
*out = new(bool)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.IntValue != nil {
|
||||||
|
in, out := &in.IntValue, &out.IntValue
|
||||||
|
*out = new(int64)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.IntSliceValue != nil {
|
||||||
|
in, out := &in.IntSliceValue, &out.IntSliceValue
|
||||||
|
*out = new(NamedResourcesIntSlice)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
if in.StringValue != nil {
|
||||||
|
in, out := &in.StringValue, &out.StringValue
|
||||||
|
*out = new(string)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.StringSliceValue != nil {
|
||||||
|
in, out := &in.StringSliceValue, &out.StringSliceValue
|
||||||
|
*out = new(NamedResourcesStringSlice)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesAttributeValue.
|
||||||
|
func (in *NamedResourcesAttributeValue) DeepCopy() *NamedResourcesAttributeValue {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesAttributeValue)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesFilter) DeepCopyInto(out *NamedResourcesFilter) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesFilter.
|
||||||
|
func (in *NamedResourcesFilter) DeepCopy() *NamedResourcesFilter {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesFilter)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesInstance) DeepCopyInto(out *NamedResourcesInstance) {
|
||||||
|
*out = *in
|
||||||
|
if in.Attributes != nil {
|
||||||
|
in, out := &in.Attributes, &out.Attributes
|
||||||
|
*out = make([]NamedResourcesAttribute, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesInstance.
|
||||||
|
func (in *NamedResourcesInstance) DeepCopy() *NamedResourcesInstance {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesInstance)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesIntSlice) DeepCopyInto(out *NamedResourcesIntSlice) {
|
||||||
|
*out = *in
|
||||||
|
if in.Ints != nil {
|
||||||
|
in, out := &in.Ints, &out.Ints
|
||||||
|
*out = make([]int64, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesIntSlice.
|
||||||
|
func (in *NamedResourcesIntSlice) DeepCopy() *NamedResourcesIntSlice {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesIntSlice)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesRequest) DeepCopyInto(out *NamedResourcesRequest) {
|
||||||
|
*out = *in
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesRequest.
|
||||||
|
func (in *NamedResourcesRequest) DeepCopy() *NamedResourcesRequest {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesRequest)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesResources) DeepCopyInto(out *NamedResourcesResources) {
|
||||||
|
*out = *in
|
||||||
|
if in.Instances != nil {
|
||||||
|
in, out := &in.Instances, &out.Instances
|
||||||
|
*out = make([]NamedResourcesInstance, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesResources.
|
||||||
|
func (in *NamedResourcesResources) DeepCopy() *NamedResourcesResources {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesResources)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *NamedResourcesStringSlice) DeepCopyInto(out *NamedResourcesStringSlice) {
|
||||||
|
*out = *in
|
||||||
|
if in.Strings != nil {
|
||||||
|
in, out := &in.Strings, &out.Strings
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedResourcesStringSlice.
|
||||||
|
func (in *NamedResourcesStringSlice) DeepCopy() *NamedResourcesStringSlice {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(NamedResourcesStringSlice)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *NodeResourceModel) DeepCopyInto(out *NodeResourceModel) {
|
func (in *NodeResourceModel) DeepCopyInto(out *NodeResourceModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesResources)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +342,7 @@ func (in *NodeResourceSlice) DeepCopyInto(out *NodeResourceSlice) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
out.NodeResourceModel = in.NodeResourceModel
|
in.NodeResourceModel.DeepCopyInto(&out.NodeResourceModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,7 +906,9 @@ func (in *ResourceClassParameters) DeepCopyInto(out *ResourceClassParameters) {
|
|||||||
if in.Filters != nil {
|
if in.Filters != nil {
|
||||||
in, out := &in.Filters, &out.Filters
|
in, out := &in.Filters, &out.Filters
|
||||||
*out = make([]ResourceFilter, len(*in))
|
*out = make([]ResourceFilter, len(*in))
|
||||||
copy(*out, *in)
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -772,7 +983,7 @@ func (in *ResourceClassParametersReference) DeepCopy() *ResourceClassParametersR
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter) {
|
func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter) {
|
||||||
*out = *in
|
*out = *in
|
||||||
out.ResourceFilterModel = in.ResourceFilterModel
|
in.ResourceFilterModel.DeepCopyInto(&out.ResourceFilterModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -789,6 +1000,11 @@ func (in *ResourceFilter) DeepCopy() *ResourceFilter {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ResourceFilterModel) DeepCopyInto(out *ResourceFilterModel) {
|
func (in *ResourceFilterModel) DeepCopyInto(out *ResourceFilterModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesFilter)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +1043,7 @@ func (in *ResourceHandle) DeepCopy() *ResourceHandle {
|
|||||||
func (in *ResourceRequest) DeepCopyInto(out *ResourceRequest) {
|
func (in *ResourceRequest) DeepCopyInto(out *ResourceRequest) {
|
||||||
*out = *in
|
*out = *in
|
||||||
in.VendorParameters.DeepCopyInto(&out.VendorParameters)
|
in.VendorParameters.DeepCopyInto(&out.VendorParameters)
|
||||||
out.ResourceRequestModel = in.ResourceRequestModel
|
in.ResourceRequestModel.DeepCopyInto(&out.ResourceRequestModel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -844,6 +1060,11 @@ func (in *ResourceRequest) DeepCopy() *ResourceRequest {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *ResourceRequestModel) DeepCopyInto(out *ResourceRequestModel) {
|
func (in *ResourceRequestModel) DeepCopyInto(out *ResourceRequestModel) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.NamedResources != nil {
|
||||||
|
in, out := &in.NamedResources, &out.NamedResources
|
||||||
|
*out = new(NamedResourcesRequest)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,5 +44,31 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"nodeName": "nodeNameValue",
|
"nodeName": "nodeNameValue",
|
||||||
"driverName": "driverNameValue"
|
"driverName": "driverNameValue",
|
||||||
|
"namedResources": {
|
||||||
|
"instances": [
|
||||||
|
{
|
||||||
|
"name": "nameValue",
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"name": "nameValue",
|
||||||
|
"quantity": "0",
|
||||||
|
"bool": true,
|
||||||
|
"int": 7,
|
||||||
|
"intSlice": {
|
||||||
|
"ints": [
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"string": "stringValue",
|
||||||
|
"stringSlice": {
|
||||||
|
"strings": [
|
||||||
|
"stringsValue"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
Binary file not shown.
@@ -33,4 +33,19 @@ metadata:
|
|||||||
resourceVersion: resourceVersionValue
|
resourceVersion: resourceVersionValue
|
||||||
selfLink: selfLinkValue
|
selfLink: selfLinkValue
|
||||||
uid: uidValue
|
uid: uidValue
|
||||||
|
namedResources:
|
||||||
|
instances:
|
||||||
|
- attributes:
|
||||||
|
- bool: true
|
||||||
|
int: 7
|
||||||
|
intSlice:
|
||||||
|
ints:
|
||||||
|
- 1
|
||||||
|
name: nameValue
|
||||||
|
quantity: "0"
|
||||||
|
string: stringValue
|
||||||
|
stringSlice:
|
||||||
|
strings:
|
||||||
|
- stringsValue
|
||||||
|
name: nameValue
|
||||||
nodeName: nodeNameValue
|
nodeName: nodeNameValue
|
||||||
|
@@ -92,6 +92,9 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"available": 1
|
"available": 1
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"namedResources": {
|
||||||
|
"name": "nameValue"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Binary file not shown.
@@ -59,7 +59,9 @@ status:
|
|||||||
structuredData:
|
structuredData:
|
||||||
nodeName: nodeNameValue
|
nodeName: nodeNameValue
|
||||||
results:
|
results:
|
||||||
- vendorRequestParameters:
|
- namedResources:
|
||||||
|
name: nameValue
|
||||||
|
vendorRequestParameters:
|
||||||
apiVersion: example.com/v1
|
apiVersion: example.com/v1
|
||||||
kind: CustomType
|
kind: CustomType
|
||||||
spec:
|
spec:
|
||||||
|
@@ -73,6 +73,9 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"available": 1
|
"available": 1
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"namedResources": {
|
||||||
|
"selector": "selectorValue"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Binary file not shown.
@@ -2,7 +2,9 @@ apiVersion: resource.k8s.io/v1alpha2
|
|||||||
driverRequests:
|
driverRequests:
|
||||||
- driverName: driverNameValue
|
- driverName: driverNameValue
|
||||||
requests:
|
requests:
|
||||||
- vendorParameters:
|
- namedResources:
|
||||||
|
selector: selectorValue
|
||||||
|
vendorParameters:
|
||||||
apiVersion: example.com/v1
|
apiVersion: example.com/v1
|
||||||
kind: CustomType
|
kind: CustomType
|
||||||
spec:
|
spec:
|
||||||
|
@@ -66,7 +66,10 @@
|
|||||||
],
|
],
|
||||||
"filters": [
|
"filters": [
|
||||||
{
|
{
|
||||||
"driverName": "driverNameValue"
|
"driverName": "driverNameValue",
|
||||||
|
"namedResources": {
|
||||||
|
"selector": "selectorValue"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
apiVersion: resource.k8s.io/v1alpha2
|
apiVersion: resource.k8s.io/v1alpha2
|
||||||
filters:
|
filters:
|
||||||
- driverName: driverNameValue
|
- driverName: driverNameValue
|
||||||
|
namedResources:
|
||||||
|
selector: selectorValue
|
||||||
generatedFrom:
|
generatedFrom:
|
||||||
apiGroup: apiGroupValue
|
apiGroup: apiGroupValue
|
||||||
kind: kindValue
|
kind: kindValue
|
||||||
|
Binary file not shown.
Binary file not shown.
@@ -11948,6 +11948,9 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||||||
- name: io.k8s.api.resource.v1alpha2.DriverAllocationResult
|
- name: io.k8s.api.resource.v1alpha2.DriverAllocationResult
|
||||||
map:
|
map:
|
||||||
fields:
|
fields:
|
||||||
|
- name: namedResources
|
||||||
|
type:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult
|
||||||
- name: vendorRequestParameters
|
- name: vendorRequestParameters
|
||||||
type:
|
type:
|
||||||
namedType: __untyped_atomic_
|
namedType: __untyped_atomic_
|
||||||
@@ -11966,6 +11969,92 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||||||
- name: vendorParameters
|
- name: vendorParameters
|
||||||
type:
|
type:
|
||||||
namedType: __untyped_atomic_
|
namedType: __untyped_atomic_
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: name
|
||||||
|
type:
|
||||||
|
scalar: string
|
||||||
|
default: ""
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesAttribute
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: bool
|
||||||
|
type:
|
||||||
|
scalar: boolean
|
||||||
|
- name: int
|
||||||
|
type:
|
||||||
|
scalar: numeric
|
||||||
|
- name: intSlice
|
||||||
|
type:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice
|
||||||
|
- name: name
|
||||||
|
type:
|
||||||
|
scalar: string
|
||||||
|
default: ""
|
||||||
|
- name: quantity
|
||||||
|
type:
|
||||||
|
namedType: io.k8s.apimachinery.pkg.api.resource.Quantity
|
||||||
|
- name: string
|
||||||
|
type:
|
||||||
|
scalar: string
|
||||||
|
- name: stringSlice
|
||||||
|
type:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesFilter
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: selector
|
||||||
|
type:
|
||||||
|
scalar: string
|
||||||
|
default: ""
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesInstance
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: attributes
|
||||||
|
type:
|
||||||
|
list:
|
||||||
|
elementType:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesAttribute
|
||||||
|
elementRelationship: atomic
|
||||||
|
- name: name
|
||||||
|
type:
|
||||||
|
scalar: string
|
||||||
|
default: ""
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: ints
|
||||||
|
type:
|
||||||
|
list:
|
||||||
|
elementType:
|
||||||
|
scalar: numeric
|
||||||
|
elementRelationship: atomic
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesRequest
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: selector
|
||||||
|
type:
|
||||||
|
scalar: string
|
||||||
|
default: ""
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesResources
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: instances
|
||||||
|
type:
|
||||||
|
list:
|
||||||
|
elementType:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesInstance
|
||||||
|
elementRelationship: atomic
|
||||||
|
- name: io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice
|
||||||
|
map:
|
||||||
|
fields:
|
||||||
|
- name: strings
|
||||||
|
type:
|
||||||
|
list:
|
||||||
|
elementType:
|
||||||
|
scalar: string
|
||||||
|
elementRelationship: atomic
|
||||||
- name: io.k8s.api.resource.v1alpha2.NodeResourceSlice
|
- name: io.k8s.api.resource.v1alpha2.NodeResourceSlice
|
||||||
map:
|
map:
|
||||||
fields:
|
fields:
|
||||||
@@ -11983,6 +12072,9 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||||||
type:
|
type:
|
||||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
|
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
|
||||||
default: {}
|
default: {}
|
||||||
|
- name: namedResources
|
||||||
|
type:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesResources
|
||||||
- name: nodeName
|
- name: nodeName
|
||||||
type:
|
type:
|
||||||
scalar: string
|
scalar: string
|
||||||
@@ -12259,6 +12351,9 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||||||
- name: driverName
|
- name: driverName
|
||||||
type:
|
type:
|
||||||
scalar: string
|
scalar: string
|
||||||
|
- name: namedResources
|
||||||
|
type:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesFilter
|
||||||
- name: io.k8s.api.resource.v1alpha2.ResourceHandle
|
- name: io.k8s.api.resource.v1alpha2.ResourceHandle
|
||||||
map:
|
map:
|
||||||
fields:
|
fields:
|
||||||
@@ -12274,6 +12369,9 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||||||
- name: io.k8s.api.resource.v1alpha2.ResourceRequest
|
- name: io.k8s.api.resource.v1alpha2.ResourceRequest
|
||||||
map:
|
map:
|
||||||
fields:
|
fields:
|
||||||
|
- name: namedResources
|
||||||
|
type:
|
||||||
|
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesRequest
|
||||||
- name: vendorParameters
|
- name: vendorParameters
|
||||||
type:
|
type:
|
||||||
namedType: __untyped_atomic_
|
namedType: __untyped_atomic_
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// AllocationResultModelApplyConfiguration represents an declarative configuration of the AllocationResultModel type for use
|
||||||
|
// with apply.
|
||||||
|
type AllocationResultModelApplyConfiguration struct {
|
||||||
|
NamedResources *NamedResourcesAllocationResultApplyConfiguration `json:"namedResources,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllocationResultModelApplyConfiguration constructs an declarative configuration of the AllocationResultModel type for use with
|
||||||
|
// apply.
|
||||||
|
func AllocationResultModel() *AllocationResultModelApplyConfiguration {
|
||||||
|
return &AllocationResultModelApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *AllocationResultModelApplyConfiguration) WithNamedResources(value *NamedResourcesAllocationResultApplyConfiguration) *AllocationResultModelApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -19,15 +19,14 @@ limitations under the License.
|
|||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1alpha2 "k8s.io/api/resource/v1alpha2"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DriverAllocationResultApplyConfiguration represents an declarative configuration of the DriverAllocationResult type for use
|
// DriverAllocationResultApplyConfiguration represents an declarative configuration of the DriverAllocationResult type for use
|
||||||
// with apply.
|
// with apply.
|
||||||
type DriverAllocationResultApplyConfiguration struct {
|
type DriverAllocationResultApplyConfiguration struct {
|
||||||
VendorRequestParameters *runtime.RawExtension `json:"vendorRequestParameters,omitempty"`
|
VendorRequestParameters *runtime.RawExtension `json:"vendorRequestParameters,omitempty"`
|
||||||
v1alpha2.AllocationResultModel `json:",inline"`
|
AllocationResultModelApplyConfiguration `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DriverAllocationResultApplyConfiguration constructs an declarative configuration of the DriverAllocationResult type for use with
|
// DriverAllocationResultApplyConfiguration constructs an declarative configuration of the DriverAllocationResult type for use with
|
||||||
@@ -43,3 +42,11 @@ func (b *DriverAllocationResultApplyConfiguration) WithVendorRequestParameters(v
|
|||||||
b.VendorRequestParameters = &value
|
b.VendorRequestParameters = &value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *DriverAllocationResultApplyConfiguration) WithNamedResources(value *NamedResourcesAllocationResultApplyConfiguration) *DriverAllocationResultApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NamedResourcesAllocationResultApplyConfiguration represents an declarative configuration of the NamedResourcesAllocationResult type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesAllocationResultApplyConfiguration struct {
|
||||||
|
Name *string `json:"name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAllocationResultApplyConfiguration constructs an declarative configuration of the NamedResourcesAllocationResult type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesAllocationResult() *NamedResourcesAllocationResultApplyConfiguration {
|
||||||
|
return &NamedResourcesAllocationResultApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName sets the Name field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Name field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAllocationResultApplyConfiguration) WithName(value string) *NamedResourcesAllocationResultApplyConfiguration {
|
||||||
|
b.Name = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
import (
|
||||||
|
resource "k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NamedResourcesAttributeApplyConfiguration represents an declarative configuration of the NamedResourcesAttribute type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesAttributeApplyConfiguration struct {
|
||||||
|
Name *string `json:"name,omitempty"`
|
||||||
|
NamedResourcesAttributeValueApplyConfiguration `json:",inline"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAttributeApplyConfiguration constructs an declarative configuration of the NamedResourcesAttribute type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesAttribute() *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
return &NamedResourcesAttributeApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName sets the Name field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Name field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeApplyConfiguration) WithName(value string) *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
b.Name = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithQuantityValue sets the QuantityValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the QuantityValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeApplyConfiguration) WithQuantityValue(value resource.Quantity) *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
b.QuantityValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBoolValue sets the BoolValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the BoolValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeApplyConfiguration) WithBoolValue(value bool) *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
b.BoolValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIntValue sets the IntValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the IntValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeApplyConfiguration) WithIntValue(value int64) *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
b.IntValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIntSliceValue sets the IntSliceValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the IntSliceValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeApplyConfiguration) WithIntSliceValue(value *NamedResourcesIntSliceApplyConfiguration) *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
b.IntSliceValue = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStringValue sets the StringValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the StringValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeApplyConfiguration) WithStringValue(value string) *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
b.StringValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStringSliceValue sets the StringSliceValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the StringSliceValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeApplyConfiguration) WithStringSliceValue(value *NamedResourcesStringSliceApplyConfiguration) *NamedResourcesAttributeApplyConfiguration {
|
||||||
|
b.StringSliceValue = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
import (
|
||||||
|
resource "k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NamedResourcesAttributeValueApplyConfiguration represents an declarative configuration of the NamedResourcesAttributeValue type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesAttributeValueApplyConfiguration struct {
|
||||||
|
QuantityValue *resource.Quantity `json:"quantity,omitempty"`
|
||||||
|
BoolValue *bool `json:"bool,omitempty"`
|
||||||
|
IntValue *int64 `json:"int,omitempty"`
|
||||||
|
IntSliceValue *NamedResourcesIntSliceApplyConfiguration `json:"intSlice,omitempty"`
|
||||||
|
StringValue *string `json:"string,omitempty"`
|
||||||
|
StringSliceValue *NamedResourcesStringSliceApplyConfiguration `json:"stringSlice,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesAttributeValueApplyConfiguration constructs an declarative configuration of the NamedResourcesAttributeValue type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesAttributeValue() *NamedResourcesAttributeValueApplyConfiguration {
|
||||||
|
return &NamedResourcesAttributeValueApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithQuantityValue sets the QuantityValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the QuantityValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeValueApplyConfiguration) WithQuantityValue(value resource.Quantity) *NamedResourcesAttributeValueApplyConfiguration {
|
||||||
|
b.QuantityValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithBoolValue sets the BoolValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the BoolValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeValueApplyConfiguration) WithBoolValue(value bool) *NamedResourcesAttributeValueApplyConfiguration {
|
||||||
|
b.BoolValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIntValue sets the IntValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the IntValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeValueApplyConfiguration) WithIntValue(value int64) *NamedResourcesAttributeValueApplyConfiguration {
|
||||||
|
b.IntValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithIntSliceValue sets the IntSliceValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the IntSliceValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeValueApplyConfiguration) WithIntSliceValue(value *NamedResourcesIntSliceApplyConfiguration) *NamedResourcesAttributeValueApplyConfiguration {
|
||||||
|
b.IntSliceValue = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStringValue sets the StringValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the StringValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeValueApplyConfiguration) WithStringValue(value string) *NamedResourcesAttributeValueApplyConfiguration {
|
||||||
|
b.StringValue = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStringSliceValue sets the StringSliceValue field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the StringSliceValue field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesAttributeValueApplyConfiguration) WithStringSliceValue(value *NamedResourcesStringSliceApplyConfiguration) *NamedResourcesAttributeValueApplyConfiguration {
|
||||||
|
b.StringSliceValue = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NamedResourcesFilterApplyConfiguration represents an declarative configuration of the NamedResourcesFilter type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesFilterApplyConfiguration struct {
|
||||||
|
Selector *string `json:"selector,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesFilterApplyConfiguration constructs an declarative configuration of the NamedResourcesFilter type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesFilter() *NamedResourcesFilterApplyConfiguration {
|
||||||
|
return &NamedResourcesFilterApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSelector sets the Selector field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Selector field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesFilterApplyConfiguration) WithSelector(value string) *NamedResourcesFilterApplyConfiguration {
|
||||||
|
b.Selector = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NamedResourcesInstanceApplyConfiguration represents an declarative configuration of the NamedResourcesInstance type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesInstanceApplyConfiguration struct {
|
||||||
|
Name *string `json:"name,omitempty"`
|
||||||
|
Attributes []NamedResourcesAttributeApplyConfiguration `json:"attributes,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesInstanceApplyConfiguration constructs an declarative configuration of the NamedResourcesInstance type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesInstance() *NamedResourcesInstanceApplyConfiguration {
|
||||||
|
return &NamedResourcesInstanceApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithName sets the Name field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Name field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesInstanceApplyConfiguration) WithName(value string) *NamedResourcesInstanceApplyConfiguration {
|
||||||
|
b.Name = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithAttributes adds the given value to the Attributes field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Attributes field.
|
||||||
|
func (b *NamedResourcesInstanceApplyConfiguration) WithAttributes(values ...*NamedResourcesAttributeApplyConfiguration) *NamedResourcesInstanceApplyConfiguration {
|
||||||
|
for i := range values {
|
||||||
|
if values[i] == nil {
|
||||||
|
panic("nil value passed to WithAttributes")
|
||||||
|
}
|
||||||
|
b.Attributes = append(b.Attributes, *values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NamedResourcesIntSliceApplyConfiguration represents an declarative configuration of the NamedResourcesIntSlice type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesIntSliceApplyConfiguration struct {
|
||||||
|
Ints []int64 `json:"ints,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesIntSliceApplyConfiguration constructs an declarative configuration of the NamedResourcesIntSlice type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesIntSlice() *NamedResourcesIntSliceApplyConfiguration {
|
||||||
|
return &NamedResourcesIntSliceApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithInts adds the given value to the Ints field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Ints field.
|
||||||
|
func (b *NamedResourcesIntSliceApplyConfiguration) WithInts(values ...int64) *NamedResourcesIntSliceApplyConfiguration {
|
||||||
|
for i := range values {
|
||||||
|
b.Ints = append(b.Ints, values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NamedResourcesRequestApplyConfiguration represents an declarative configuration of the NamedResourcesRequest type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesRequestApplyConfiguration struct {
|
||||||
|
Selector *string `json:"selector,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesRequestApplyConfiguration constructs an declarative configuration of the NamedResourcesRequest type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesRequest() *NamedResourcesRequestApplyConfiguration {
|
||||||
|
return &NamedResourcesRequestApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSelector sets the Selector field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Selector field is set to the value of the last call.
|
||||||
|
func (b *NamedResourcesRequestApplyConfiguration) WithSelector(value string) *NamedResourcesRequestApplyConfiguration {
|
||||||
|
b.Selector = &value
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NamedResourcesResourcesApplyConfiguration represents an declarative configuration of the NamedResourcesResources type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesResourcesApplyConfiguration struct {
|
||||||
|
Instances []NamedResourcesInstanceApplyConfiguration `json:"instances,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesResourcesApplyConfiguration constructs an declarative configuration of the NamedResourcesResources type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesResources() *NamedResourcesResourcesApplyConfiguration {
|
||||||
|
return &NamedResourcesResourcesApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithInstances adds the given value to the Instances field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Instances field.
|
||||||
|
func (b *NamedResourcesResourcesApplyConfiguration) WithInstances(values ...*NamedResourcesInstanceApplyConfiguration) *NamedResourcesResourcesApplyConfiguration {
|
||||||
|
for i := range values {
|
||||||
|
if values[i] == nil {
|
||||||
|
panic("nil value passed to WithInstances")
|
||||||
|
}
|
||||||
|
b.Instances = append(b.Instances, *values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NamedResourcesStringSliceApplyConfiguration represents an declarative configuration of the NamedResourcesStringSlice type for use
|
||||||
|
// with apply.
|
||||||
|
type NamedResourcesStringSliceApplyConfiguration struct {
|
||||||
|
Strings []string `json:"strings,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NamedResourcesStringSliceApplyConfiguration constructs an declarative configuration of the NamedResourcesStringSlice type for use with
|
||||||
|
// apply.
|
||||||
|
func NamedResourcesStringSlice() *NamedResourcesStringSliceApplyConfiguration {
|
||||||
|
return &NamedResourcesStringSliceApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithStrings adds the given value to the Strings field in the declarative configuration
|
||||||
|
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||||
|
// If called multiple times, values provided by each call will be appended to the Strings field.
|
||||||
|
func (b *NamedResourcesStringSliceApplyConfiguration) WithStrings(values ...string) *NamedResourcesStringSliceApplyConfiguration {
|
||||||
|
for i := range values {
|
||||||
|
b.Strings = append(b.Strings, values[i])
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// NodeResourceModelApplyConfiguration represents an declarative configuration of the NodeResourceModel type for use
|
||||||
|
// with apply.
|
||||||
|
type NodeResourceModelApplyConfiguration struct {
|
||||||
|
NamedResources *NamedResourcesResourcesApplyConfiguration `json:"namedResources,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NodeResourceModelApplyConfiguration constructs an declarative configuration of the NodeResourceModel type for use with
|
||||||
|
// apply.
|
||||||
|
func NodeResourceModel() *NodeResourceModelApplyConfiguration {
|
||||||
|
return &NodeResourceModelApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *NodeResourceModelApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *NodeResourceModelApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -19,7 +19,7 @@ limitations under the License.
|
|||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1alpha2 "k8s.io/api/resource/v1alpha2"
|
resourcev1alpha2 "k8s.io/api/resource/v1alpha2"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||||
@@ -30,11 +30,11 @@ import (
|
|||||||
// NodeResourceSliceApplyConfiguration represents an declarative configuration of the NodeResourceSlice type for use
|
// NodeResourceSliceApplyConfiguration represents an declarative configuration of the NodeResourceSlice type for use
|
||||||
// with apply.
|
// with apply.
|
||||||
type NodeResourceSliceApplyConfiguration struct {
|
type NodeResourceSliceApplyConfiguration struct {
|
||||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||||
NodeName *string `json:"nodeName,omitempty"`
|
NodeName *string `json:"nodeName,omitempty"`
|
||||||
DriverName *string `json:"driverName,omitempty"`
|
DriverName *string `json:"driverName,omitempty"`
|
||||||
v1alpha2.NodeResourceModel `json:",inline"`
|
NodeResourceModelApplyConfiguration `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeResourceSlice constructs an declarative configuration of the NodeResourceSlice type for use with
|
// NodeResourceSlice constructs an declarative configuration of the NodeResourceSlice type for use with
|
||||||
@@ -58,18 +58,18 @@ func NodeResourceSlice(name string) *NodeResourceSliceApplyConfiguration {
|
|||||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||||
// Experimental!
|
// Experimental!
|
||||||
func ExtractNodeResourceSlice(nodeResourceSlice *v1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
|
func ExtractNodeResourceSlice(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
|
||||||
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "")
|
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtractNodeResourceSliceStatus is the same as ExtractNodeResourceSlice except
|
// ExtractNodeResourceSliceStatus is the same as ExtractNodeResourceSlice except
|
||||||
// that it extracts the status subresource applied configuration.
|
// that it extracts the status subresource applied configuration.
|
||||||
// Experimental!
|
// Experimental!
|
||||||
func ExtractNodeResourceSliceStatus(nodeResourceSlice *v1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
|
func ExtractNodeResourceSliceStatus(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
|
||||||
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "status")
|
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "status")
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractNodeResourceSlice(nodeResourceSlice *v1alpha2.NodeResourceSlice, fieldManager string, subresource string) (*NodeResourceSliceApplyConfiguration, error) {
|
func extractNodeResourceSlice(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string, subresource string) (*NodeResourceSliceApplyConfiguration, error) {
|
||||||
b := &NodeResourceSliceApplyConfiguration{}
|
b := &NodeResourceSliceApplyConfiguration{}
|
||||||
err := managedfields.ExtractInto(nodeResourceSlice, internal.Parser().Type("io.k8s.api.resource.v1alpha2.NodeResourceSlice"), fieldManager, b, subresource)
|
err := managedfields.ExtractInto(nodeResourceSlice, internal.Parser().Type("io.k8s.api.resource.v1alpha2.NodeResourceSlice"), fieldManager, b, subresource)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -255,3 +255,11 @@ func (b *NodeResourceSliceApplyConfiguration) WithDriverName(value string) *Node
|
|||||||
b.DriverName = &value
|
b.DriverName = &value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *NodeResourceSliceApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *NodeResourceSliceApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
@@ -18,15 +18,11 @@ limitations under the License.
|
|||||||
|
|
||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
|
||||||
v1alpha2 "k8s.io/api/resource/v1alpha2"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ResourceFilterApplyConfiguration represents an declarative configuration of the ResourceFilter type for use
|
// ResourceFilterApplyConfiguration represents an declarative configuration of the ResourceFilter type for use
|
||||||
// with apply.
|
// with apply.
|
||||||
type ResourceFilterApplyConfiguration struct {
|
type ResourceFilterApplyConfiguration struct {
|
||||||
DriverName *string `json:"driverName,omitempty"`
|
DriverName *string `json:"driverName,omitempty"`
|
||||||
v1alpha2.ResourceFilterModel `json:",inline"`
|
ResourceFilterModelApplyConfiguration `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceFilterApplyConfiguration constructs an declarative configuration of the ResourceFilter type for use with
|
// ResourceFilterApplyConfiguration constructs an declarative configuration of the ResourceFilter type for use with
|
||||||
@@ -42,3 +38,11 @@ func (b *ResourceFilterApplyConfiguration) WithDriverName(value string) *Resourc
|
|||||||
b.DriverName = &value
|
b.DriverName = &value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *ResourceFilterApplyConfiguration) WithNamedResources(value *NamedResourcesFilterApplyConfiguration) *ResourceFilterApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// ResourceFilterModelApplyConfiguration represents an declarative configuration of the ResourceFilterModel type for use
|
||||||
|
// with apply.
|
||||||
|
type ResourceFilterModelApplyConfiguration struct {
|
||||||
|
NamedResources *NamedResourcesFilterApplyConfiguration `json:"namedResources,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceFilterModelApplyConfiguration constructs an declarative configuration of the ResourceFilterModel type for use with
|
||||||
|
// apply.
|
||||||
|
func ResourceFilterModel() *ResourceFilterModelApplyConfiguration {
|
||||||
|
return &ResourceFilterModelApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *ResourceFilterModelApplyConfiguration) WithNamedResources(value *NamedResourcesFilterApplyConfiguration) *ResourceFilterModelApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -19,15 +19,14 @@ limitations under the License.
|
|||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v1alpha2 "k8s.io/api/resource/v1alpha2"
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ResourceRequestApplyConfiguration represents an declarative configuration of the ResourceRequest type for use
|
// ResourceRequestApplyConfiguration represents an declarative configuration of the ResourceRequest type for use
|
||||||
// with apply.
|
// with apply.
|
||||||
type ResourceRequestApplyConfiguration struct {
|
type ResourceRequestApplyConfiguration struct {
|
||||||
VendorParameters *runtime.RawExtension `json:"vendorParameters,omitempty"`
|
VendorParameters *runtime.RawExtension `json:"vendorParameters,omitempty"`
|
||||||
v1alpha2.ResourceRequestModel `json:",inline"`
|
ResourceRequestModelApplyConfiguration `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceRequestApplyConfiguration constructs an declarative configuration of the ResourceRequest type for use with
|
// ResourceRequestApplyConfiguration constructs an declarative configuration of the ResourceRequest type for use with
|
||||||
@@ -43,3 +42,11 @@ func (b *ResourceRequestApplyConfiguration) WithVendorParameters(value runtime.R
|
|||||||
b.VendorParameters = &value
|
b.VendorParameters = &value
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *ResourceRequestApplyConfiguration) WithNamedResources(value *NamedResourcesRequestApplyConfiguration) *ResourceRequestApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1alpha2
|
||||||
|
|
||||||
|
// ResourceRequestModelApplyConfiguration represents an declarative configuration of the ResourceRequestModel type for use
|
||||||
|
// with apply.
|
||||||
|
type ResourceRequestModelApplyConfiguration struct {
|
||||||
|
NamedResources *NamedResourcesRequestApplyConfiguration `json:"namedResources,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceRequestModelApplyConfiguration constructs an declarative configuration of the ResourceRequestModel type for use with
|
||||||
|
// apply.
|
||||||
|
func ResourceRequestModel() *ResourceRequestModelApplyConfiguration {
|
||||||
|
return &ResourceRequestModelApplyConfiguration{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithNamedResources sets the NamedResources field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the NamedResources field is set to the value of the last call.
|
||||||
|
func (b *ResourceRequestModelApplyConfiguration) WithNamedResources(value *NamedResourcesRequestApplyConfiguration) *ResourceRequestModelApplyConfiguration {
|
||||||
|
b.NamedResources = value
|
||||||
|
return b
|
||||||
|
}
|
@@ -1523,10 +1523,32 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||||||
// Group=resource.k8s.io, Version=v1alpha2
|
// Group=resource.k8s.io, Version=v1alpha2
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("AllocationResult"):
|
case v1alpha2.SchemeGroupVersion.WithKind("AllocationResult"):
|
||||||
return &resourcev1alpha2.AllocationResultApplyConfiguration{}
|
return &resourcev1alpha2.AllocationResultApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("AllocationResultModel"):
|
||||||
|
return &resourcev1alpha2.AllocationResultModelApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("DriverAllocationResult"):
|
case v1alpha2.SchemeGroupVersion.WithKind("DriverAllocationResult"):
|
||||||
return &resourcev1alpha2.DriverAllocationResultApplyConfiguration{}
|
return &resourcev1alpha2.DriverAllocationResultApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("DriverRequests"):
|
case v1alpha2.SchemeGroupVersion.WithKind("DriverRequests"):
|
||||||
return &resourcev1alpha2.DriverRequestsApplyConfiguration{}
|
return &resourcev1alpha2.DriverRequestsApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesAllocationResult"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesAllocationResultApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesAttribute"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesAttributeApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesAttributeValue"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesAttributeValueApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesFilter"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesFilterApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesInstance"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesInstanceApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesIntSlice"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesIntSliceApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesRequest"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesRequestApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesResources"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesResourcesApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesStringSlice"):
|
||||||
|
return &resourcev1alpha2.NamedResourcesStringSliceApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceModel"):
|
||||||
|
return &resourcev1alpha2.NodeResourceModelApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceSlice"):
|
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceSlice"):
|
||||||
return &resourcev1alpha2.NodeResourceSliceApplyConfiguration{}
|
return &resourcev1alpha2.NodeResourceSliceApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContext"):
|
case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContext"):
|
||||||
@@ -1561,10 +1583,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||||||
return &resourcev1alpha2.ResourceClassParametersReferenceApplyConfiguration{}
|
return &resourcev1alpha2.ResourceClassParametersReferenceApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("ResourceFilter"):
|
case v1alpha2.SchemeGroupVersion.WithKind("ResourceFilter"):
|
||||||
return &resourcev1alpha2.ResourceFilterApplyConfiguration{}
|
return &resourcev1alpha2.ResourceFilterApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("ResourceFilterModel"):
|
||||||
|
return &resourcev1alpha2.ResourceFilterModelApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("ResourceHandle"):
|
case v1alpha2.SchemeGroupVersion.WithKind("ResourceHandle"):
|
||||||
return &resourcev1alpha2.ResourceHandleApplyConfiguration{}
|
return &resourcev1alpha2.ResourceHandleApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequest"):
|
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequest"):
|
||||||
return &resourcev1alpha2.ResourceRequestApplyConfiguration{}
|
return &resourcev1alpha2.ResourceRequestApplyConfiguration{}
|
||||||
|
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequestModel"):
|
||||||
|
return &resourcev1alpha2.ResourceRequestModelApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("StructuredResourceHandle"):
|
case v1alpha2.SchemeGroupVersion.WithKind("StructuredResourceHandle"):
|
||||||
return &resourcev1alpha2.StructuredResourceHandleApplyConfiguration{}
|
return &resourcev1alpha2.StructuredResourceHandleApplyConfiguration{}
|
||||||
case v1alpha2.SchemeGroupVersion.WithKind("VendorParameters"):
|
case v1alpha2.SchemeGroupVersion.WithKind("VendorParameters"):
|
||||||
|
@@ -6,11 +6,13 @@ go 1.22.0
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-logr/logr v1.4.1
|
github.com/go-logr/logr v1.4.1
|
||||||
|
github.com/google/cel-go v0.17.8
|
||||||
github.com/google/go-cmp v0.6.0
|
github.com/google/go-cmp v0.6.0
|
||||||
github.com/stretchr/testify v1.8.4
|
github.com/stretchr/testify v1.8.4
|
||||||
google.golang.org/grpc v1.58.3
|
google.golang.org/grpc v1.58.3
|
||||||
k8s.io/api v0.0.0
|
k8s.io/api v0.0.0
|
||||||
k8s.io/apimachinery v0.0.0
|
k8s.io/apimachinery v0.0.0
|
||||||
|
k8s.io/apiserver v0.0.0
|
||||||
k8s.io/client-go v0.0.0
|
k8s.io/client-go v0.0.0
|
||||||
k8s.io/klog/v2 v2.120.1
|
k8s.io/klog/v2 v2.120.1
|
||||||
k8s.io/kubelet v0.0.0
|
k8s.io/kubelet v0.0.0
|
||||||
@@ -18,6 +20,7 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
||||||
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
|
||||||
@@ -38,13 +41,17 @@ require (
|
|||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/stoewer/go-strcase v1.2.0 // indirect
|
||||||
|
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
|
||||||
golang.org/x/net v0.21.0 // indirect
|
golang.org/x/net v0.21.0 // indirect
|
||||||
golang.org/x/oauth2 v0.10.0 // indirect
|
golang.org/x/oauth2 v0.10.0 // indirect
|
||||||
|
golang.org/x/sync v0.6.0 // indirect
|
||||||
golang.org/x/sys v0.17.0 // indirect
|
golang.org/x/sys v0.17.0 // indirect
|
||||||
golang.org/x/term v0.17.0 // indirect
|
golang.org/x/term v0.17.0 // indirect
|
||||||
golang.org/x/text v0.14.0 // indirect
|
golang.org/x/text v0.14.0 // indirect
|
||||||
golang.org/x/time v0.3.0 // indirect
|
golang.org/x/time v0.3.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||||
google.golang.org/protobuf v1.33.0 // indirect
|
google.golang.org/protobuf v1.33.0 // indirect
|
||||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||||
@@ -64,5 +71,6 @@ replace (
|
|||||||
k8s.io/component-base => ../component-base
|
k8s.io/component-base => ../component-base
|
||||||
k8s.io/cri-api => ../cri-api
|
k8s.io/cri-api => ../cri-api
|
||||||
k8s.io/dynamic-resource-allocation => ../dynamic-resource-allocation
|
k8s.io/dynamic-resource-allocation => ../dynamic-resource-allocation
|
||||||
|
k8s.io/kms => ../kms
|
||||||
k8s.io/kubelet => ../kubelet
|
k8s.io/kubelet => ../kubelet
|
||||||
)
|
)
|
||||||
|
@@ -1,27 +1,37 @@
|
|||||||
cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM=
|
cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM=
|
||||||
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
|
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
|
||||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
|
||||||
|
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18=
|
||||||
|
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM=
|
||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
||||||
|
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
|
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
||||||
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
|
github.com/coreos/go-oidc v2.2.1+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
|
||||||
|
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
|
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
|
||||||
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
|
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
|
||||||
github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g=
|
github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g=
|
||||||
github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
|
github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
|
||||||
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
|
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
|
||||||
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||||
|
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||||
|
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||||
github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||||
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
|
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
|
||||||
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||||
@@ -32,6 +42,7 @@ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEe
|
|||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
||||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||||
github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ=
|
github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ=
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
@@ -39,6 +50,8 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
|
|||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
|
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
|
||||||
|
github.com/google/cel-go v0.17.8 h1:j9m730pMZt1Fc4oKhCLUHfjj6527LuhYcYw0Rl8gqto=
|
||||||
|
github.com/google/cel-go v0.17.8/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY=
|
||||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
@@ -53,8 +66,13 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
|||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
|
||||||
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
|
||||||
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
|
||||||
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
|
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
|
||||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
@@ -89,31 +107,60 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/pquerna/cachecontrol v0.1.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI=
|
||||||
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
|
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
|
||||||
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
|
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
|
||||||
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
|
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
|
||||||
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
|
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
|
||||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||||
|
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||||
|
github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0=
|
||||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU=
|
||||||
|
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75/go.mod h1:KO6IkyS8Y3j8OdNO85qEYBsRPuteD+YciPomcXdrMnk=
|
||||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||||
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
||||||
|
go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI=
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.5.10/go.mod h1:DYivfIviIuQ8+/lCq4vcxuseg2P2XbHygkKwFo9fc8U=
|
||||||
|
go.etcd.io/etcd/client/v2 v2.305.10/go.mod h1:m3CKZi69HzilhVqtPDcjhSGp+kA1OmbNn0qamH80xjA=
|
||||||
|
go.etcd.io/etcd/client/v3 v3.5.10/go.mod h1:RVeBnDz2PUEZqTpgqwAtUd8nAPf5kjyFyND7P1VkOKc=
|
||||||
|
go.etcd.io/etcd/pkg/v3 v3.5.10/go.mod h1:TKTuCKKcF1zxmfKWDkfz5qqYaE3JncKKZPFf8c1nFUs=
|
||||||
|
go.etcd.io/etcd/raft/v3 v3.5.10/go.mod h1:odD6kr8XQXTy9oQnyMPBOr0TVe+gT0neQhElQ6jbGRc=
|
||||||
|
go.etcd.io/etcd/server/v3 v3.5.10/go.mod h1:gBplPHfs6YI0L+RpGkTQO7buDbHv5HJGG/Bst0/zIPo=
|
||||||
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0/go.mod h1:5z+/ZWJQKXa9YT34fQNx5K8Hd1EoIhvtUygUQPqEOgQ=
|
||||||
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48=
|
||||||
|
go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0/go.mod h1:0+KuTDyKL4gjKCF75pHOX4wuzYDUZYfAQdSu43o+Z2I=
|
||||||
|
go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A=
|
||||||
|
go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
|
||||||
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
|
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||||
|
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
|
||||||
|
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
@@ -129,7 +176,8 @@ golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQ
|
|||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||||
|
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@@ -158,7 +206,8 @@ golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNq
|
|||||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||||
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
|
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=
|
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e h1:z3vDksarJxsAKM5dmEGv0GHwE2hKJ096wZra71Vs4sw=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
|
||||||
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
|
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
|
||||||
@@ -170,6 +219,9 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
|
|||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
|
gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
@@ -183,6 +235,7 @@ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7F
|
|||||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
|
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
|
||||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||||
|
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0/go.mod h1:z7+wmGM2dfIiLRfrC6jb5kV2Mq/sK1ZP303cxzkV5Y4=
|
||||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
|
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
|
||||||
|
@@ -0,0 +1,206 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2022 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/google/cel-go/cel"
|
||||||
|
"github.com/google/cel-go/common/types"
|
||||||
|
"github.com/google/cel-go/common/types/traits"
|
||||||
|
|
||||||
|
resourceapi "k8s.io/api/resource/v1alpha2"
|
||||||
|
"k8s.io/apimachinery/pkg/util/version"
|
||||||
|
celconfig "k8s.io/apiserver/pkg/apis/cel"
|
||||||
|
apiservercel "k8s.io/apiserver/pkg/cel"
|
||||||
|
"k8s.io/apiserver/pkg/cel/environment"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
attributesVarPrefix = "attributes."
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Compiler = newCompiler()
|
||||||
|
)
|
||||||
|
|
||||||
|
// CompilationResult represents a compiled expression.
|
||||||
|
type CompilationResult struct {
|
||||||
|
Program cel.Program
|
||||||
|
Error *apiservercel.Error
|
||||||
|
Expression string
|
||||||
|
OutputType *cel.Type
|
||||||
|
Environment *cel.Env
|
||||||
|
}
|
||||||
|
|
||||||
|
type compiler struct {
|
||||||
|
envset *environment.EnvSet
|
||||||
|
}
|
||||||
|
|
||||||
|
func newCompiler() *compiler {
|
||||||
|
return &compiler{envset: mustBuildEnv()}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CompileCELExpression returns a compiled CEL expression. It evaluates to bool.
|
||||||
|
func (c compiler) CompileCELExpression(expression string, envType environment.Type) CompilationResult {
|
||||||
|
resultError := func(errorString string, errType apiservercel.ErrorType) CompilationResult {
|
||||||
|
return CompilationResult{
|
||||||
|
Error: &apiservercel.Error{
|
||||||
|
Type: errType,
|
||||||
|
Detail: errorString,
|
||||||
|
},
|
||||||
|
Expression: expression,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
env, err := c.envset.Env(envType)
|
||||||
|
if err != nil {
|
||||||
|
return resultError(fmt.Sprintf("unexpected error loading CEL environment: %v", err), apiservercel.ErrorTypeInternal)
|
||||||
|
}
|
||||||
|
|
||||||
|
ast, issues := env.Compile(expression)
|
||||||
|
if issues != nil {
|
||||||
|
return resultError("compilation failed: "+issues.String(), apiservercel.ErrorTypeInvalid)
|
||||||
|
}
|
||||||
|
expectedReturnType := cel.BoolType
|
||||||
|
if ast.OutputType() != expectedReturnType {
|
||||||
|
return resultError(fmt.Sprintf("must evaluate to %v", expectedReturnType.String()), apiservercel.ErrorTypeInvalid)
|
||||||
|
}
|
||||||
|
_, err = cel.AstToCheckedExpr(ast)
|
||||||
|
if err != nil {
|
||||||
|
// should be impossible since env.Compile returned no issues
|
||||||
|
return resultError("unexpected compilation error: "+err.Error(), apiservercel.ErrorTypeInternal)
|
||||||
|
}
|
||||||
|
prog, err := env.Program(ast,
|
||||||
|
cel.InterruptCheckFrequency(celconfig.CheckFrequency),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return resultError("program instantiation failed: "+err.Error(), apiservercel.ErrorTypeInternal)
|
||||||
|
}
|
||||||
|
return CompilationResult{
|
||||||
|
Program: prog,
|
||||||
|
Expression: expression,
|
||||||
|
OutputType: ast.OutputType(),
|
||||||
|
Environment: env,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var valueTypes = map[string]struct {
|
||||||
|
celType *cel.Type
|
||||||
|
// get returns nil if the attribute doesn't have the type, otherwise
|
||||||
|
// the value of that type.
|
||||||
|
get func(attr resourceapi.NamedResourcesAttribute) any
|
||||||
|
}{
|
||||||
|
"quantity": {apiservercel.QuantityType, func(attr resourceapi.NamedResourcesAttribute) any {
|
||||||
|
if attr.QuantityValue == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return apiservercel.Quantity{Quantity: attr.QuantityValue}
|
||||||
|
}},
|
||||||
|
"bool": {cel.BoolType, func(attr resourceapi.NamedResourcesAttribute) any {
|
||||||
|
if attr.BoolValue == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return *attr.BoolValue
|
||||||
|
}},
|
||||||
|
"int": {cel.IntType, func(attr resourceapi.NamedResourcesAttribute) any {
|
||||||
|
if attr.IntValue == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return *attr.IntValue
|
||||||
|
}},
|
||||||
|
"intslice": {types.NewListType(cel.IntType), func(attr resourceapi.NamedResourcesAttribute) any {
|
||||||
|
if attr.IntSliceValue == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return attr.IntSliceValue.Ints
|
||||||
|
}},
|
||||||
|
"string": {cel.StringType, func(attr resourceapi.NamedResourcesAttribute) any {
|
||||||
|
if attr.StringValue == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return *attr.StringValue
|
||||||
|
}},
|
||||||
|
"stringslice": {types.NewListType(cel.StringType), func(attr resourceapi.NamedResourcesAttribute) any {
|
||||||
|
if attr.StringSliceValue == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return attr.StringSliceValue.Strings
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
|
||||||
|
var boolType = reflect.TypeOf(true)
|
||||||
|
|
||||||
|
func (c CompilationResult) Evaluate(ctx context.Context, attributes []resourceapi.NamedResourcesAttribute) (bool, error) {
|
||||||
|
variables := make(map[string]any, len(valueTypes))
|
||||||
|
for name, valueType := range valueTypes {
|
||||||
|
variables[attributesVarPrefix+name] = buildValueMapper(c.Environment.CELTypeAdapter(), attributes, valueType.get)
|
||||||
|
}
|
||||||
|
result, _, err := c.Program.ContextEval(ctx, variables)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
resultAny, err := result.ConvertToNative(boolType)
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Errorf("CEL result of type %s could not be converted to bool: %w", result.Type().TypeName(), err)
|
||||||
|
}
|
||||||
|
resultBool, ok := resultAny.(bool)
|
||||||
|
if !ok {
|
||||||
|
return false, fmt.Errorf("CEL native result value should have been a bool, got instead: %T", resultAny)
|
||||||
|
}
|
||||||
|
return resultBool, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func mustBuildEnv() *environment.EnvSet {
|
||||||
|
envset := environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion())
|
||||||
|
versioned := []environment.VersionedOptions{
|
||||||
|
{
|
||||||
|
IntroducedVersion: version.MajorMinor(1, 30),
|
||||||
|
EnvOptions: buildVersionedAttributes(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
envset, err := envset.Extend(versioned...)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("internal error building CEL environment: %w", err))
|
||||||
|
}
|
||||||
|
return envset
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildVersionedAttributes() []cel.EnvOption {
|
||||||
|
options := make([]cel.EnvOption, 0, len(valueTypes))
|
||||||
|
for name, valueType := range valueTypes {
|
||||||
|
options = append(options, cel.Variable(attributesVarPrefix+name, types.NewMapType(cel.StringType, valueType.celType)))
|
||||||
|
}
|
||||||
|
return options
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildValueMapper(adapter types.Adapter, attributes []resourceapi.NamedResourcesAttribute, get func(resourceapi.NamedResourcesAttribute) any) traits.Mapper {
|
||||||
|
// This implementation constructs a map and then let's cel handle the
|
||||||
|
// lookup and iteration. This is done for the sake of simplicity.
|
||||||
|
// Whether it's faster than writing a custom mapper depends on
|
||||||
|
// real-world attribute sets and CEL expressions and would have to be
|
||||||
|
// benchmarked.
|
||||||
|
valueMap := make(map[string]any)
|
||||||
|
for _, attribute := range attributes {
|
||||||
|
if value := get(attribute); value != nil {
|
||||||
|
valueMap[attribute.Name] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return types.NewStringInterfaceMap(adapter, valueMap)
|
||||||
|
}
|
@@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2022 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
resourceapi "k8s.io/api/resource/v1alpha2"
|
||||||
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
"k8s.io/apiserver/pkg/cel/environment"
|
||||||
|
"k8s.io/klog/v2/ktesting"
|
||||||
|
"k8s.io/utils/ptr"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCompile(t *testing.T) {
|
||||||
|
for name, scenario := range map[string]struct {
|
||||||
|
expression string
|
||||||
|
attributes []resourceapi.NamedResourcesAttribute
|
||||||
|
expectCompileError string
|
||||||
|
expectMatchError string
|
||||||
|
expectMatch bool
|
||||||
|
}{
|
||||||
|
"true": {
|
||||||
|
expression: "true",
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"false": {
|
||||||
|
expression: "false",
|
||||||
|
expectMatch: false,
|
||||||
|
},
|
||||||
|
"syntax-error": {
|
||||||
|
expression: "?!",
|
||||||
|
expectCompileError: "Syntax error",
|
||||||
|
},
|
||||||
|
"type-error": {
|
||||||
|
expression: `attributes.quantity["no-such-attr"]`,
|
||||||
|
expectCompileError: "must evaluate to bool",
|
||||||
|
},
|
||||||
|
"runtime-error": {
|
||||||
|
expression: `attributes.quantity["no-such-attr"].isGreaterThan(quantity("0"))`,
|
||||||
|
expectMatchError: "no such key: no-such-attr",
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
expression: `attributes.quantity["name"].isGreaterThan(quantity("0"))`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{QuantityValue: ptr.To(resource.MustParse("1"))}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"bool": {
|
||||||
|
expression: `attributes.bool["name"]`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{BoolValue: ptr.To(true)}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"int": {
|
||||||
|
expression: `attributes.int["name"] > 0`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{IntValue: ptr.To(int64(1))}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"intslice": {
|
||||||
|
expression: `attributes.intslice["name"].isSorted() && attributes.intslice["name"].indexOf(3) == 2`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{IntSliceValue: &resourceapi.NamedResourcesIntSlice{Ints: []int64{1, 2, 3}}}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"empty-intslice": {
|
||||||
|
expression: `size(attributes.intslice["name"]) == 0`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{IntSliceValue: &resourceapi.NamedResourcesIntSlice{}}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
expression: `attributes.string["name"] == "fish"`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{StringValue: ptr.To("fish")}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"stringslice": {
|
||||||
|
expression: `attributes.stringslice["name"].isSorted() && attributes.stringslice["name"].indexOf("a") == 0`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{StringSliceValue: &resourceapi.NamedResourcesStringSlice{Strings: []string{"a", "b", "c"}}}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"empty-stringslice": {
|
||||||
|
expression: `size(attributes.stringslice["name"]) == 0`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{{Name: "name", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{StringSliceValue: &resourceapi.NamedResourcesStringSlice{}}}},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"all": {
|
||||||
|
expression: `attributes.quantity["quantity"].isGreaterThan(quantity("0")) &&
|
||||||
|
attributes.bool["bool"] &&
|
||||||
|
attributes.int["int"] > 0 &&
|
||||||
|
attributes.intslice["intslice"].isSorted() &&
|
||||||
|
attributes.string["string"] == "fish" &&
|
||||||
|
attributes.stringslice["stringslice"].isSorted()`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{
|
||||||
|
{Name: "quantity", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{QuantityValue: ptr.To(resource.MustParse("1"))}},
|
||||||
|
{Name: "bool", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{BoolValue: ptr.To(true)}},
|
||||||
|
{Name: "int", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{IntValue: ptr.To(int64(1))}},
|
||||||
|
{Name: "intslice", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{IntSliceValue: &resourceapi.NamedResourcesIntSlice{Ints: []int64{1, 2, 3}}}},
|
||||||
|
{Name: "string", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{StringValue: ptr.To("fish")}},
|
||||||
|
{Name: "stringslice", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{StringSliceValue: &resourceapi.NamedResourcesStringSlice{Strings: []string{"a", "b", "c"}}}},
|
||||||
|
},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
"many": {
|
||||||
|
expression: `attributes.bool["a"] && attributes.bool["b"] && attributes.bool["c"]`,
|
||||||
|
attributes: []resourceapi.NamedResourcesAttribute{
|
||||||
|
{Name: "a", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{BoolValue: ptr.To(true)}},
|
||||||
|
{Name: "b", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{BoolValue: ptr.To(true)}},
|
||||||
|
{Name: "c", NamedResourcesAttributeValue: resourceapi.NamedResourcesAttributeValue{BoolValue: ptr.To(true)}},
|
||||||
|
},
|
||||||
|
expectMatch: true,
|
||||||
|
},
|
||||||
|
} {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
_, ctx := ktesting.NewTestContext(t)
|
||||||
|
result := Compiler.CompileCELExpression(scenario.expression, environment.StoredExpressions)
|
||||||
|
if scenario.expectCompileError != "" && result.Error == nil {
|
||||||
|
t.Fatalf("expected compile error %q, got none", scenario.expectCompileError)
|
||||||
|
}
|
||||||
|
if result.Error != nil {
|
||||||
|
if scenario.expectCompileError == "" {
|
||||||
|
t.Fatalf("unexpected compile error: %v", result.Error)
|
||||||
|
}
|
||||||
|
if !strings.Contains(result.Error.Error(), scenario.expectCompileError) {
|
||||||
|
t.Fatalf("expected compile error to contain %q, but got instead: %v", scenario.expectCompileError, result.Error)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
match, err := result.Evaluate(ctx, scenario.attributes)
|
||||||
|
if err != nil {
|
||||||
|
if scenario.expectMatchError == "" {
|
||||||
|
t.Fatalf("unexpected evaluation error: %v", err)
|
||||||
|
}
|
||||||
|
if !strings.Contains(err.Error(), scenario.expectMatchError) {
|
||||||
|
t.Fatalf("expected evaluation error to contain %q, but got instead: %v", scenario.expectMatchError, err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if match != scenario.expectMatch {
|
||||||
|
t.Fatalf("expected result %v, got %v", scenario.expectMatch, match)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@@ -455,7 +455,7 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes
|
|||||||
ExpectedEtcdPath: "/registry/resourceclaimparameters/" + namespace + "/claim1parameters",
|
ExpectedEtcdPath: "/registry/resourceclaimparameters/" + namespace + "/claim1parameters",
|
||||||
},
|
},
|
||||||
gvr("resource.k8s.io", "v1alpha2", "noderesourceslices"): {
|
gvr("resource.k8s.io", "v1alpha2", "noderesourceslices"): {
|
||||||
Stub: `{"metadata": {"name": "node1slice"}, "nodeName": "worker1", "driverName": "dra.example.com"}`, // TODO: add one structured parameter model
|
Stub: `{"metadata": {"name": "node1slice"}, "nodeName": "worker1", "driverName": "dra.example.com", "namedResources": {}}`,
|
||||||
ExpectedEtcdPath: "/registry/noderesourceslices/node1slice",
|
ExpectedEtcdPath: "/registry/noderesourceslices/node1slice",
|
||||||
},
|
},
|
||||||
// --
|
// --
|
||||||
|
Reference in New Issue
Block a user