Skip to content

Commit c21a017

Browse files
Merge pull request #129970 from mortent/AddResourceV1beta2API
Add resource v1beta2 API Kubernetes-commit: 070f0ad3bdfc17da90defdb45bb644aaf07dd43e
2 parents 118546d + d0673db commit c21a017

38 files changed

+17256
-458
lines changed

resource/v1alpha3/generated.pb.go

+186-186
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resource/v1alpha3/generated.proto

+17-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resource/v1alpha3/types.go

+26-15
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ type ResourceSliceSpec struct {
178178
// the portion of counters it uses will no longer be available for use
179179
// by other devices.
180180
type CounterSet struct {
181-
// Name defines the name of the counter set.
182-
// It must be a DNS label.
181+
// CounterSet is the name of the set from which the
182+
// counters defined will be consumed.
183183
//
184184
// +required
185185
Name string `json:"name" protobuf:"bytes,1,name=name"`
186186

187-
// Counters defines the set of counters for this CounterSet
187+
// Counters defines the counters that will be consumed by the device.
188188
// The name of each counter must be unique in that set and must be a DNS label.
189189
//
190190
// To ensure this uniqueness, capacities defined by the vendor
@@ -284,20 +284,21 @@ type BasicDevice struct {
284284
// +optional
285285
Capacity map[QualifiedName]resource.Quantity `json:"capacity,omitempty" protobuf:"bytes,2,rep,name=capacity"`
286286

287-
// ConsumesCounter defines a list of references to sharedCounters
287+
// ConsumesCounters defines a list of references to sharedCounters
288288
// and the set of counters that the device will
289289
// consume from those counter sets.
290290
//
291291
// There can only be a single entry per counterSet.
292292
//
293-
// The maximum number of device counter consumption entries
294-
// is 32. This is the same as the maximum number of shared counters
295-
// allowed in a ResourceSlice.
293+
// The total number of device counter consumption entries
294+
// must be <= 32. In addition, the total number in the
295+
// entire ResourceSlice must be <= 1024 (for example,
296+
// 64 devices with 16 counters each).
296297
//
297298
// +optional
298299
// +listType=atomic
299300
// +featureGate=DRAPartitionableDevices
300-
ConsumesCounter []DeviceCounterConsumption `json:"consumesCounter,omitempty" protobuf:"bytes,3,rep,name=consumesCounter"`
301+
ConsumesCounters []DeviceCounterConsumption `json:"consumesCounters,omitempty" protobuf:"bytes,3,rep,name=consumesCounters"`
301302

302303
// NodeName identifies the node where the device is available.
303304
//
@@ -331,7 +332,7 @@ type BasicDevice struct {
331332

332333
// If specified, these are the driver-defined taints.
333334
//
334-
// The maximum number of taints is 8.
335+
// The maximum number of taints is 4.
335336
//
336337
// This is an alpha field and requires enabling the DRADeviceTaints
337338
// feature gate.
@@ -345,17 +346,19 @@ type BasicDevice struct {
345346
// DeviceCounterConsumption defines a set of counters that
346347
// a device will consume from a CounterSet.
347348
type DeviceCounterConsumption struct {
348-
// SharedCounter defines the shared counter from which the
349+
// CounterSet defines the set from which the
349350
// counters defined will be consumed.
350351
//
351352
// +required
352-
SharedCounter string `json:"sharedCounter" protobuf:"bytes,1,opt,name=sharedCounter"`
353+
CounterSet string `json:"counterSet" protobuf:"bytes,1,opt,name=counterSet"`
353354

354355
// Counters defines the Counter that will be consumed by
355356
// the device.
356357
//
357-
//
358-
// The maximum number of Counters is 32.
358+
// The maximum number counters in a device is 32.
359+
// In addition, the maximum number of all counters
360+
// in all devices is 1024 (for example, 64 devices with
361+
// 16 counters each).
359362
//
360363
// +required
361364
Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,opt,name=counters"`
@@ -364,6 +367,14 @@ type DeviceCounterConsumption struct {
364367
// Limit for the sum of the number of entries in both attributes and capacity.
365368
const ResourceSliceMaxAttributesAndCapacitiesPerDevice = 32
366369

370+
// Limit for the total number of counters in each device.
371+
const ResourceSliceMaxCountersPerDevice = 32
372+
373+
// Limit for the total number of counters defined in devices in
374+
// a ResourceSlice. We want to allow up to 64 devices to specify
375+
// up to 16 counters, so the limit for the ResourceSlice will be 1024.
376+
const ResourceSliceMaxDeviceCountersPerSlice = 1024 // 64 * 16
377+
367378
// QualifiedName is the name of a device attribute or capacity.
368379
//
369380
// Attributes and capacities are defined either by the owner of the specific
@@ -427,7 +438,7 @@ type DeviceAttribute struct {
427438
const DeviceAttributeMaxValueLength = 64
428439

429440
// DeviceTaintsMaxLength is the maximum number of taints per device.
430-
const DeviceTaintsMaxLength = 8
441+
const DeviceTaintsMaxLength = 4
431442

432443
// The device this taint is attached to has the "effect" on
433444
// any claim which does not tolerate the taint and, through the claim,
@@ -784,7 +795,7 @@ type DeviceSubRequest struct {
784795
// Allocation will fail if some devices are already allocated,
785796
// unless adminAccess is requested.
786797
//
787-
// If AlloctionMode is not specified, the default mode is ExactCount. If
798+
// If AllocationMode is not specified, the default mode is ExactCount. If
788799
// the mode is ExactCount and count is not specified, the default count is
789800
// one. Any other requests must specify this field.
790801
//

resource/v1alpha3/types_swagger_doc_generated.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ func (AllocationResult) SwaggerDoc() map[string]string {
5252
}
5353

5454
var map_BasicDevice = map[string]string{
55-
"": "BasicDevice defines one device instance.",
56-
"attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.",
57-
"capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.",
58-
"consumesCounter": "ConsumesCounter defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumption entries is 32. This is the same as the maximum number of shared counters allowed in a ResourceSlice.",
59-
"nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
60-
"nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
61-
"allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
62-
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 8.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
55+
"": "BasicDevice defines one device instance.",
56+
"attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.",
57+
"capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.",
58+
"consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe total number of device counter consumption entries must be <= 32. In addition, the total number in the entire ResourceSlice must be <= 1024 (for example, 64 devices with 16 counters each).",
59+
"nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
60+
"nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
61+
"allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
62+
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 4.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
6363
}
6464

6565
func (BasicDevice) SwaggerDoc() map[string]string {
@@ -86,8 +86,8 @@ func (Counter) SwaggerDoc() map[string]string {
8686

8787
var map_CounterSet = map[string]string{
8888
"": "CounterSet defines a named set of counters that are available to be used by devices defined in the ResourceSlice.\n\nThe counters are not allocatable by themselves, but can be referenced by devices. When a device is allocated, the portion of counters it uses will no longer be available for use by other devices.",
89-
"name": "Name defines the name of the counter set. It must be a DNS label.",
90-
"counters": "Counters defines the set of counters for this CounterSet The name of each counter must be unique in that set and must be a DNS label.\n\nTo ensure this uniqueness, capacities defined by the vendor must be listed without the driver name as domain prefix in their name. All others must be listed with their domain prefix.\n\nThe maximum number of counters is 32.",
89+
"name": "CounterSet is the name of the set from which the counters defined will be consumed.",
90+
"counters": "Counters defines the counters that will be consumed by the device. The name of each counter must be unique in that set and must be a DNS label.\n\nTo ensure this uniqueness, capacities defined by the vendor must be listed without the driver name as domain prefix in their name. All others must be listed with their domain prefix.\n\nThe maximum number of counters is 32.",
9191
}
9292

9393
func (CounterSet) SwaggerDoc() map[string]string {
@@ -214,9 +214,9 @@ func (DeviceConstraint) SwaggerDoc() map[string]string {
214214
}
215215

216216
var map_DeviceCounterConsumption = map[string]string{
217-
"": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.",
218-
"sharedCounter": "SharedCounter defines the shared counter from which the counters defined will be consumed.",
219-
"counters": "Counters defines the Counter that will be consumed by the device.\n\nThe maximum number of Counters is 32.",
217+
"": "DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet.",
218+
"counterSet": "CounterSet defines the set from which the counters defined will be consumed.",
219+
"counters": "Counters defines the Counter that will be consumed by the device.\n\nThe maximum number counters in a device is 32. In addition, the maximum number of all counters in all devices is 1024 (for example, 64 devices with 16 counters each).",
220220
}
221221

222222
func (DeviceCounterConsumption) SwaggerDoc() map[string]string {
@@ -267,7 +267,7 @@ var map_DeviceSubRequest = map[string]string{
267267
"name": "Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format <main request>/<subrequest>.\n\nMust be a DNS label.",
268268
"deviceClassName": "DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest.\n\nA class is required. Which classes are available depends on the cluster.\n\nAdministrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.",
269269
"selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.",
270-
"allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AlloctionMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.",
270+
"allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.",
271271
"count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.",
272272
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
273273
}

resource/v1alpha3/zz_generated.deepcopy.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)