Skip to content

Commit 3f43b5a

Browse files
Merge pull request #128240 from LionelJouin/KEP-4817
DRA: Implementation of ResourceClaim.Status.Devices (KEP-4817) Kubernetes-commit: 4cf2818f964d8862db4399cb548060f72bea4ded
2 parents 0869e9d + 6d5d359 commit 3f43b5a

16 files changed

+2442
-347
lines changed

Diff for: resource/v1alpha3/generated.pb.go

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

Diff for: resource/v1alpha3/generated.proto

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

Diff for: resource/v1alpha3/types.go

+93
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,18 @@ type ResourceClaimStatus struct {
701701
// it got removed. May be reused once decoding v1alpha3 is no longer
702702
// supported.
703703
// DeallocationRequested bool `json:"deallocationRequested,omitempty" protobuf:"bytes,3,opt,name=deallocationRequested"`
704+
705+
// Devices contains the status of each device allocated for this
706+
// claim, as reported by the driver. This can include driver-specific
707+
// information. Entries are owned by their respective drivers.
708+
//
709+
// +optional
710+
// +listType=map
711+
// +listMapKey=driver
712+
// +listMapKey=device
713+
// +listMapKey=pool
714+
// +featureGate=DRAResourceClaimDeviceStatus
715+
Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"`
704716
}
705717

706718
// ReservedForMaxSize is the maximum number of entries in
@@ -986,3 +998,84 @@ type ResourceClaimTemplateList struct {
986998
// Items is the list of resource claim templates.
987999
Items []ResourceClaimTemplate `json:"items" protobuf:"bytes,2,rep,name=items"`
9881000
}
1001+
1002+
// AllocatedDeviceStatus contains the status of an allocated device, if the
1003+
// driver chooses to report it. This may include driver-specific information.
1004+
type AllocatedDeviceStatus struct {
1005+
// Driver specifies the name of the DRA driver whose kubelet
1006+
// plugin should be invoked to process the allocation once the claim is
1007+
// needed on a node.
1008+
//
1009+
// Must be a DNS subdomain and should end with a DNS domain owned by the
1010+
// vendor of the driver.
1011+
//
1012+
// +required
1013+
Driver string `json:"driver" protobuf:"bytes,1,rep,name=driver"`
1014+
1015+
// This name together with the driver name and the device name field
1016+
// identify which device was allocated (`<driver name>/<pool name>/<device name>`).
1017+
//
1018+
// Must not be longer than 253 characters and may contain one or more
1019+
// DNS sub-domains separated by slashes.
1020+
//
1021+
// +required
1022+
Pool string `json:"pool" protobuf:"bytes,2,rep,name=pool"`
1023+
1024+
// Device references one device instance via its name in the driver's
1025+
// resource pool. It must be a DNS label.
1026+
//
1027+
// +required
1028+
Device string `json:"device" protobuf:"bytes,3,rep,name=device"`
1029+
1030+
// Conditions contains the latest observation of the device's state.
1031+
// If the device has been configured according to the class and claim
1032+
// config references, the `Ready` condition should be True.
1033+
//
1034+
// +optional
1035+
// +listType=map
1036+
// +listMapKey=type
1037+
Conditions []metav1.Condition `json:"conditions" protobuf:"bytes,4,opt,name=conditions"`
1038+
1039+
// Data contains arbitrary driver-specific data.
1040+
//
1041+
// The length of the raw data must be smaller or equal to 10 Ki.
1042+
//
1043+
// +optional
1044+
Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,5,opt,name=data"`
1045+
1046+
// NetworkData contains network-related information specific to the device.
1047+
//
1048+
// +optional
1049+
NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"`
1050+
}
1051+
1052+
// NetworkDeviceData provides network-related details for the allocated device.
1053+
// This information may be filled by drivers or other components to configure
1054+
// or identify the device within a network context.
1055+
type NetworkDeviceData struct {
1056+
// InterfaceName specifies the name of the network interface associated with
1057+
// the allocated device. This might be the name of a physical or virtual
1058+
// network interface being configured in the pod.
1059+
//
1060+
// Must not be longer than 256 characters.
1061+
//
1062+
// +optional
1063+
InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"`
1064+
1065+
// IPs lists the network addresses assigned to the device's network interface.
1066+
// This can include both IPv4 and IPv6 addresses.
1067+
// The IPs are in the CIDR notation, which includes both the address and the
1068+
// associated subnet mask.
1069+
// e.g.: "192.0.2.5/24" for IPv4 and "2001:db8::5/64" for IPv6.
1070+
//
1071+
// +optional
1072+
// +listType=atomic
1073+
IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"`
1074+
1075+
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
1076+
//
1077+
// Must not be longer than 128 characters.
1078+
//
1079+
// +optional
1080+
HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"`
1081+
}

Diff for: resource/v1alpha3/types_swagger_doc_generated.go

+26
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ package v1alpha3
2727
// Those methods can be generated by using hack/update-codegen.sh
2828

2929
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
30+
var map_AllocatedDeviceStatus = map[string]string{
31+
"": "AllocatedDeviceStatus contains the status of an allocated device, if the driver chooses to report it. This may include driver-specific information.",
32+
"driver": "Driver specifies the name of the DRA driver whose kubelet plugin should be invoked to process the allocation once the claim is needed on a node.\n\nMust be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver.",
33+
"pool": "This name together with the driver name and the device name field identify which device was allocated (`<driver name>/<pool name>/<device name>`).\n\nMust not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.",
34+
"device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.",
35+
"conditions": "Conditions contains the latest observation of the device's state. If the device has been configured according to the class and claim config references, the `Ready` condition should be True.",
36+
"data": "Data contains arbitrary driver-specific data.\n\nThe length of the raw data must be smaller or equal to 10 Ki.",
37+
"networkData": "NetworkData contains network-related information specific to the device.",
38+
}
39+
40+
func (AllocatedDeviceStatus) SwaggerDoc() map[string]string {
41+
return map_AllocatedDeviceStatus
42+
}
43+
3044
var map_AllocationResult = map[string]string{
3145
"": "AllocationResult contains attributes of an allocated resource.",
3246
"devices": "Devices is the result of allocating devices.",
@@ -211,6 +225,17 @@ func (DeviceSelector) SwaggerDoc() map[string]string {
211225
return map_DeviceSelector
212226
}
213227

228+
var map_NetworkDeviceData = map[string]string{
229+
"": "NetworkDeviceData provides network-related details for the allocated device. This information may be filled by drivers or other components to configure or identify the device within a network context.",
230+
"interfaceName": "InterfaceName specifies the name of the network interface associated with the allocated device. This might be the name of a physical or virtual network interface being configured in the pod.\n\nMust not be longer than 256 characters.",
231+
"ips": "IPs lists the network addresses assigned to the device's network interface. This can include both IPv4 and IPv6 addresses. The IPs are in the CIDR notation, which includes both the address and the associated subnet mask. e.g.: \"192.0.2.5/24\" for IPv4 and \"2001:db8::5/64\" for IPv6.",
232+
"hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 characters.",
233+
}
234+
235+
func (NetworkDeviceData) SwaggerDoc() map[string]string {
236+
return map_NetworkDeviceData
237+
}
238+
214239
var map_OpaqueDeviceConfiguration = map[string]string{
215240
"": "OpaqueDeviceConfiguration contains configuration parameters for a driver in a format defined by the driver vendor.",
216241
"driver": "Driver is used to determine which kubelet plugin needs to be passed these configuration parameters.\n\nAn admission policy provided by the driver developer could use this to decide whether it needs to validate them.\n\nMust be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver.",
@@ -267,6 +292,7 @@ var map_ResourceClaimStatus = map[string]string{
267292
"": "ResourceClaimStatus tracks whether the resource has been allocated and what the result of that was.",
268293
"allocation": "Allocation is set once the claim has been allocated successfully.",
269294
"reservedFor": "ReservedFor indicates which entities are currently allowed to use the claim. A Pod which references a ResourceClaim which is not reserved for that Pod will not be started. A claim that is in use or might be in use because it has been reserved must not get deallocated.\n\nIn a cluster with multiple scheduler instances, two pods might get scheduled concurrently by different schedulers. When they reference the same ResourceClaim which already has reached its maximum number of consumers, only one pod can be scheduled.\n\nBoth schedulers try to add their pod to the claim.status.reservedFor field, but only the update that reaches the API server first gets stored. The other one fails with an error and the scheduler which issued it knows that it must put the pod back into the queue, waiting for the ResourceClaim to become usable again.\n\nThere can be at most 32 such reservations. This may get increased in the future, but not reduced.",
295+
"devices": "Devices contains the status of each device allocated for this claim, as reported by the driver. This can include driver-specific information. Entries are owned by their respective drivers.",
270296
}
271297

272298
func (ResourceClaimStatus) SwaggerDoc() map[string]string {

Diff for: resource/v1alpha3/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)