Skip to content

Commit c83dd08

Browse files
pohlyk8s-publishing-bot
authored andcommitted
dra api: rename NodeResourceSlice -> ResourceSlice
While currently those objects only get published by the kubelet for node-local resources, this could change once we also support network-attached resources. Dropping the "Node" prefix enables such a future extension. The NodeName in ResourceSlice and StructuredResourceHandle then becomes optional. The kubelet still needs to provide one and it must match its own node name, otherwise it doesn't have permission to access ResourceSlice objects. Kubernetes-commit: 0b6a0d686a060b5d5ff92cea931aacd4eba85adb
1 parent 0a349fb commit c83dd08

9 files changed

+1203
-1190
lines changed

resource/v1alpha2/generated.pb.go

Lines changed: 1061 additions & 1062 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resource/v1alpha2/generated.proto

Lines changed: 38 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resource/v1alpha2/register.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
5252
&ResourceClaimTemplateList{},
5353
&PodSchedulingContext{},
5454
&PodSchedulingContextList{},
55-
&NodeResourceSlice{},
56-
&NodeResourceSliceList{},
55+
&ResourceSlice{},
56+
&ResourceSliceList{},
5757
&ResourceClaimParameters{},
5858
&ResourceClaimParametersList{},
5959
&ResourceClassParameters{},

resource/v1alpha2/types.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,11 @@ type StructuredResourceHandle struct {
224224
// +optional
225225
VendorClaimParameters runtime.RawExtension `json:"vendorClaimParameters,omitempty" protobuf:"bytes,2,opt,name=vendorClaimParameters"`
226226

227-
// NodeName is the name of the node providing the necessary resources.
228-
NodeName string `json:"nodeName" protobuf:"bytes,4,name=nodeName"`
227+
// NodeName is the name of the node providing the necessary resources
228+
// if the resources are local to a node.
229+
//
230+
// +optional
231+
NodeName string `json:"nodeName,omitempty" protobuf:"bytes,4,name=nodeName"`
229232

230233
// Results lists all allocated driver resources.
231234
//
@@ -529,21 +532,25 @@ type ResourceClaimTemplateList struct {
529532
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
530533
// +k8s:prerelease-lifecycle-gen:introduced=1.30
531534

532-
// NodeResourceSlice provides information about available
535+
// ResourceSlice provides information about available
533536
// resources on individual nodes.
534-
type NodeResourceSlice struct {
537+
type ResourceSlice struct {
535538
metav1.TypeMeta `json:",inline"`
536539
// Standard object metadata
537540
// +optional
538541
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
539542

540-
// NodeName identifies the node where the capacity is available.
541-
// A field selector can be used to list only NodeResourceSlice
543+
// NodeName identifies the node which provides the resources
544+
// if they are local to a node.
545+
//
546+
// A field selector can be used to list only ResourceSlice
542547
// objects with a certain node name.
543-
NodeName string `json:"nodeName" protobuf:"bytes,2,name=nodeName"`
548+
//
549+
// +optional
550+
NodeName string `json:"nodeName,omitempty" protobuf:"bytes,2,opt,name=nodeName"`
544551

545552
// DriverName identifies the DRA driver providing the capacity information.
546-
// A field selector can be used to list only NodeResourceSlice
553+
// A field selector can be used to list only ResourceSlice
547554
// objects with a certain driver name.
548555
DriverName string `json:"driverName" protobuf:"bytes,3,name=driverName"`
549556

@@ -561,15 +568,15 @@ type NodeResourceModel struct {
561568
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
562569
// +k8s:prerelease-lifecycle-gen:introduced=1.30
563570

564-
// NodeResourceSliceList is a collection of NodeResourceSlices.
565-
type NodeResourceSliceList struct {
571+
// ResourceSliceList is a collection of ResourceSlices.
572+
type ResourceSliceList struct {
566573
metav1.TypeMeta `json:",inline"`
567574
// Standard list metadata
568575
// +optional
569576
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
570577

571578
// Items is the list of node resource capacity objects.
572-
Items []NodeResourceSlice `json:"items" protobuf:"bytes,2,rep,name=items"`
579+
Items []ResourceSlice `json:"items" protobuf:"bytes,2,rep,name=items"`
573580
}
574581

575582
// +genclient

resource/v1alpha2/types_swagger_doc_generated.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,6 @@ func (NodeResourceModel) SwaggerDoc() map[string]string {
7676
return map_NodeResourceModel
7777
}
7878

79-
var map_NodeResourceSlice = map[string]string{
80-
"": "NodeResourceSlice provides information about available resources on individual nodes.",
81-
"metadata": "Standard object metadata",
82-
"nodeName": "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.",
83-
"driverName": "DriverName identifies the DRA driver providing the capacity information. A field selector can be used to list only NodeResourceSlice objects with a certain driver name.",
84-
}
85-
86-
func (NodeResourceSlice) SwaggerDoc() map[string]string {
87-
return map_NodeResourceSlice
88-
}
89-
90-
var map_NodeResourceSliceList = map[string]string{
91-
"": "NodeResourceSliceList is a collection of NodeResourceSlices.",
92-
"metadata": "Standard list metadata",
93-
"items": "Items is the list of node resource capacity objects.",
94-
}
95-
96-
func (NodeResourceSliceList) SwaggerDoc() map[string]string {
97-
return map_NodeResourceSliceList
98-
}
99-
10079
var map_PodSchedulingContext = map[string]string{
10180
"": "PodSchedulingContext objects hold information that is needed to schedule a Pod with ResourceClaims that use \"WaitForFirstConsumer\" allocation mode.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.",
10281
"metadata": "Standard object metadata",
@@ -370,11 +349,32 @@ func (ResourceRequestModel) SwaggerDoc() map[string]string {
370349
return map_ResourceRequestModel
371350
}
372351

352+
var map_ResourceSlice = map[string]string{
353+
"": "ResourceSlice provides information about available resources on individual nodes.",
354+
"metadata": "Standard object metadata",
355+
"nodeName": "NodeName identifies the node which provides the resources if they are local to a node.\n\nA field selector can be used to list only ResourceSlice objects with a certain node name.",
356+
"driverName": "DriverName identifies the DRA driver providing the capacity information. A field selector can be used to list only ResourceSlice objects with a certain driver name.",
357+
}
358+
359+
func (ResourceSlice) SwaggerDoc() map[string]string {
360+
return map_ResourceSlice
361+
}
362+
363+
var map_ResourceSliceList = map[string]string{
364+
"": "ResourceSliceList is a collection of ResourceSlices.",
365+
"metadata": "Standard list metadata",
366+
"items": "Items is the list of node resource capacity objects.",
367+
}
368+
369+
func (ResourceSliceList) SwaggerDoc() map[string]string {
370+
return map_ResourceSliceList
371+
}
372+
373373
var map_StructuredResourceHandle = map[string]string{
374374
"": "StructuredResourceHandle is the in-tree representation of the allocation result.",
375375
"vendorClassParameters": "VendorClassParameters are the per-claim configuration parameters from the resource class at the time that the claim was allocated.",
376376
"vendorClaimParameters": "VendorClaimParameters are the per-claim configuration parameters from the resource claim parameters at the time that the claim was allocated.",
377-
"nodeName": "NodeName is the name of the node providing the necessary resources.",
377+
"nodeName": "NodeName is the name of the node providing the necessary resources if the resources are local to a node.",
378378
"results": "Results lists all allocated driver resources.",
379379
}
380380

resource/v1alpha2/zz_generated.deepcopy.go

Lines changed: 60 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testdata/HEAD/resource.k8s.io.v1alpha2.NodeResourceSlice.json renamed to testdata/HEAD/resource.k8s.io.v1alpha2.ResourceSlice.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"kind": "NodeResourceSlice",
2+
"kind": "ResourceSlice",
33
"apiVersion": "resource.k8s.io/v1alpha2",
44
"metadata": {
55
"name": "nameValue",

testdata/HEAD/resource.k8s.io.v1alpha2.NodeResourceSlice.yaml renamed to testdata/HEAD/resource.k8s.io.v1alpha2.ResourceSlice.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: resource.k8s.io/v1alpha2
22
driverName: driverNameValue
3-
kind: NodeResourceSlice
3+
kind: ResourceSlice
44
metadata:
55
annotations:
66
annotationsKey: annotationsValue

0 commit comments

Comments
 (0)