Skip to content

Commit

Permalink
Merge pull request #128240 from LionelJouin/KEP-4817
Browse files Browse the repository at this point in the history
DRA: Implementation of ResourceClaim.Status.Devices (KEP-4817)

Kubernetes-commit: 4cf2818f964d8862db4399cb548060f72bea4ded
  • Loading branch information
k8s-publishing-bot committed Nov 8, 2024
2 parents 0869e9d + 6d5d359 commit 3f43b5a
Show file tree
Hide file tree
Showing 16 changed files with 2,442 additions and 347 deletions.
1,042 changes: 881 additions & 161 deletions resource/v1alpha3/generated.pb.go

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions resource/v1alpha3/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions resource/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,18 @@ type ResourceClaimStatus struct {
// it got removed. May be reused once decoding v1alpha3 is no longer
// supported.
// DeallocationRequested bool `json:"deallocationRequested,omitempty" protobuf:"bytes,3,opt,name=deallocationRequested"`

// 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.
//
// +optional
// +listType=map
// +listMapKey=driver
// +listMapKey=device
// +listMapKey=pool
// +featureGate=DRAResourceClaimDeviceStatus
Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"`
}

// ReservedForMaxSize is the maximum number of entries in
Expand Down Expand Up @@ -986,3 +998,84 @@ type ResourceClaimTemplateList struct {
// Items is the list of resource claim templates.
Items []ResourceClaimTemplate `json:"items" protobuf:"bytes,2,rep,name=items"`
}

// AllocatedDeviceStatus contains the status of an allocated device, if the
// driver chooses to report it. This may include driver-specific information.
type AllocatedDeviceStatus struct {
// 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.
//
// Must be a DNS subdomain and should end with a DNS domain owned by the
// vendor of the driver.
//
// +required
Driver string `json:"driver" protobuf:"bytes,1,rep,name=driver"`

// This name together with the driver name and the device name field
// identify which device was allocated (`<driver name>/<pool name>/<device name>`).
//
// Must not be longer than 253 characters and may contain one or more
// DNS sub-domains separated by slashes.
//
// +required
Pool string `json:"pool" protobuf:"bytes,2,rep,name=pool"`

// Device references one device instance via its name in the driver's
// resource pool. It must be a DNS label.
//
// +required
Device string `json:"device" protobuf:"bytes,3,rep,name=device"`

// 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.
//
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions" protobuf:"bytes,4,opt,name=conditions"`

// Data contains arbitrary driver-specific data.
//
// The length of the raw data must be smaller or equal to 10 Ki.
//
// +optional
Data runtime.RawExtension `json:"data,omitempty" protobuf:"bytes,5,opt,name=data"`

// NetworkData contains network-related information specific to the device.
//
// +optional
NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"`
}

// 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.
type NetworkDeviceData struct {
// 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.
//
// Must not be longer than 256 characters.
//
// +optional
InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"`

// 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.
//
// +optional
// +listType=atomic
IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"`

// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
//
// Must not be longer than 128 characters.
//
// +optional
HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"`
}
26 changes: 26 additions & 0 deletions resource/v1alpha3/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ package v1alpha3
// Those methods can be generated by using hack/update-codegen.sh

// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
var map_AllocatedDeviceStatus = map[string]string{
"": "AllocatedDeviceStatus contains the status of an allocated device, if the driver chooses to report it. This may include driver-specific information.",
"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.",
"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.",
"device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.",
"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.",
"data": "Data contains arbitrary driver-specific data.\n\nThe length of the raw data must be smaller or equal to 10 Ki.",
"networkData": "NetworkData contains network-related information specific to the device.",
}

func (AllocatedDeviceStatus) SwaggerDoc() map[string]string {
return map_AllocatedDeviceStatus
}

var map_AllocationResult = map[string]string{
"": "AllocationResult contains attributes of an allocated resource.",
"devices": "Devices is the result of allocating devices.",
Expand Down Expand Up @@ -211,6 +225,17 @@ func (DeviceSelector) SwaggerDoc() map[string]string {
return map_DeviceSelector
}

var map_NetworkDeviceData = map[string]string{
"": "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.",
"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.",
"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.",
"hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 characters.",
}

func (NetworkDeviceData) SwaggerDoc() map[string]string {
return map_NetworkDeviceData
}

var map_OpaqueDeviceConfiguration = map[string]string{
"": "OpaqueDeviceConfiguration contains configuration parameters for a driver in a format defined by the driver vendor.",
"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.",
Expand Down Expand Up @@ -267,6 +292,7 @@ var map_ResourceClaimStatus = map[string]string{
"": "ResourceClaimStatus tracks whether the resource has been allocated and what the result of that was.",
"allocation": "Allocation is set once the claim has been allocated successfully.",
"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.",
"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.",
}

func (ResourceClaimStatus) SwaggerDoc() map[string]string {
Expand Down
64 changes: 61 additions & 3 deletions resource/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3f43b5a

Please sign in to comment.