api

package
v0.0.0-...-ecdf00b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevMgmtAPIVersion = "devmgmtproto.k8s.io/v1alpha1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name string `json:"name"`

	// One of the following:
	StringValue   *string            `json:"stringValue,omitempty"`
	IntValue      *int               `json:"intValue,omitempty"`
	QuantityValue *resource.Quantity `json:"quantityValue,omitempty"`
	SemVerValue   *SemVer            `json:"semVerValue,omitempty"`
}

Attribute capture the name, value, and type of an device attribute.

func (Attribute) Equal

func (a Attribute) Equal(b Attribute) bool

func (Attribute) EqualValue

func (a Attribute) EqualValue(b Attribute) bool

type Device

type Device struct {
	// Name is a driver-specific identifier for the device.
	// +required
	Name string `json:"name"`

	// Attributes contain additional metadata that can be used in
	// constraints. If an attribute name overlaps with the pool attribute,
	// the device attribute takes precedence.
	//
	// +optional
	Attributes []Attribute `json:"attributes,omitempty"`

	// Requests contains the pool resources that are consumed when
	// this device is allocated.
	//
	// +optional
	Requests map[string]resource.Quantity `json:"requests,omitempty"`

	// Resources allows the definition of per-device resources that can
	// be allocated in a manner similar to standard Kubernetes resources.
	// NOTE: We may not need to implement this right away.
	//
	// +optional
	Resources []ResourceCapacity `json:"resources,omitempty"`
}

Device is used to track individual devices in a pool.

type DeviceAllocation

type DeviceAllocation struct {
	// DevicePoolName is the name of the DevicePool to which this
	// device belongs.
	// +required
	DevicePoolName string `json:"devicePoolName"`

	// DeviceName contains the name of the allocated Device.
	// +required
	DeviceName string `json:"deviceName,omitempty"`

	// Allocations contain the resource allocations from this device,
	// for the claim. Note that this may only satisfy part of the claim.
	// Also, because devices may allocate some resources in blocks, this
	// may even be larger than the requests or limits in the claim.
	// +optional
	Allocations []ResourceAllocation `json:"allocations,omitempty"`
}

DeviceAllocation contains an individual device allocation result, including per-device resource allocations, when applicable.

type DeviceClaim

type DeviceClaim struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DeviceClaimSpec   `json:"spec,omitempty"`
	Status DeviceClaimStatus `json:"status,omitempty"`
}

DeviceClaim is used to specify a request for a set of devices. Namespace scoped.

type DeviceClaimDetail

type DeviceClaimDetail struct {
	// DeviceType may be specified to get a device from any class that
	// supports this type of device. For example, the user can request
	// an 'sriov-nic', and any class that can provide that type will be
	// considered for fulfillment of the claim.
	//
	// +optional
	DeviceType *string `json:"deviceType"`

	// DeviceClass is the name of the DeviceClass containing the basic information
	// about the device being requested.
	//
	// +optional
	DeviceClass *string `json:"deviceClass"`

	// Constraints is a CEL expression that operates on device attributes.
	// In order for a device to be considered, this CEL expression and the
	// Constraints expression from the DeviceClass must both be true.
	//
	// +optional
	Constraints *string `json:"constraints,omitempty"`

	// Requests allows the user to specify the minimum requirements that
	// must be satisfied across all devices allocated for this claim.  All
	// drivers can support "count" for requests, but other resource types
	// are driver-specific. The default value for requests is a single
	// entry for "count" with value of 1.
	Requests map[string]resource.Quantity `json:"requests,omitempty"`

	// Limits allows the user to control the maximum count of devices
	// that is allocated to satisfy the claim. Depending on the driver
	// and device other resource limits may or may not be enforceable.
	Limits map[string]resource.Quantity `json:"limits,omitempty"`

	// MatchAttributes allows specifying a constraint within a set of
	// chosen devices, without having to explicitly specify the value of
	// the constraint.  For example, this allows constraints like "all
	// devices must be the same model", without having to specify the exact
	// model. We may be able to use this for some basic topology
	// constraints too, by representing the topology as device attributes.
	//
	// Currently, these are just strings. However, we could make them
	// structs, and include required vs preferred matches. Required matches
	// would fail if not met, where as preferred would lower the score if
	// not met. We could even allow low/medium/high priority and adjust the
	// score differently for each.
	//
	// +optional
	MatchAttributes []string `json:"matchAttributes,omitempty"`

	// Configs contains references to arbitrary vendor device configuration
	// objects that will be attached to the device allocation.
	// +optional
	Configs []DeviceConfigReference `json:"configs,omitempty"`
}

DeviceClaimDetail contains the details of how to fulfill a specific request for devices.

type DeviceClaimInstance

type DeviceClaimInstance struct {

	// If fields of DeviceClaimDetail are populated, OneOf should
	// be empty.
	DeviceClaimDetail `json:",inline"`

	// OneOf contains a list of claims, only one of which must be satisfied.
	// Claims are listed in order of priority.
	//
	// +optional
	OneOf []DeviceClaimDetail `json:"oneOf,omitempty"`
}

DeviceClaimInstance captures a claim which must be satisfied, or a group for which one must be sastisfied.

type DeviceClaimSpec

type DeviceClaimSpec struct {
	// MatchAttributes allows specifying a constraint that will apply
	// across all of the claims. For example, if you specified "numa", then
	// this overall claim could only be successfully fulfilled if all of
	// the included claims could be fulfilled by pools with the same "numa"
	// attribute value. If we simply set matchAttributes in each claim
	// separately, then they could be consistent within claims, but
	// inconsistent across claims. Therefore, we need this additional
	// constraint.
	//
	// +optional
	MatchAttributes []string `json:"matchAttributes,omitempty"`

	// Claims contains the actual claim details, arranged into groups
	// containing claims which must all be satsified, or for which only
	// one needs to be satisfied.
	//
	// +required
	Claims []DeviceClaimInstance `json:"claims,omitempty"`
}

DeviceClaimSpec details the requirements that devices chosen to satisfy this claim must meet.

type DeviceClaimStatus

type DeviceClaimStatus struct {
	// ClassConfigs contains the entire set of dereferenced vendor
	// configurations from the DeviceClass, as of the time of allocation.
	// +optional
	ClassConfigs []runtime.RawExtension `json:"classConfigs,omitempty"`

	// ClaimConfigs contains the entire set of dereferenced vendor
	// configurations from the DeviceClaim, as of the time of allocation.
	// +optional
	ClaimConfigs []runtime.RawExtension `json:"claimConfigs,omitempty"`

	// Allocations contains the list of device allocations needed to
	// satisfy the claim, one per pool from which devices were allocated.
	//
	// Note that the "current capacity" of the cluster is the result of
	// applying all such allocations to the published DevicePools. This
	// means storing these allocations only in claim status fields is likely
	// to scale poorly, and we will need a different strategy in the real
	// code. For example, we may need to accumulate these in the DevicePool
	// status fields themselves, and just reference them from here.
	//
	// This field is owned by the scheduler, whereas the Devices field
	// is owned by the driver.
	//
	// +optional
	Allocations []DeviceAllocation `json:"allocations,omitempty"`

	// Devices contains the status of each device assigned to this
	// claim, as reported by the driver. This can include driver-specific
	// information. Entries are owned by their respective drivers.
	// TODO: How can we do that?
	DeviceStatuses []DeviceStatus `json:"deviceStatuses,omitempty"`

	// PodNames contains the names of all Pods using this claim.
	// TODO: Can we just use ownerRefs instead?
	// +optional
	PodNames []string `json:"podNames,omitempty"`
}

DeviceClaimStatus contains the results of the claim allocation.

type DeviceClass

type DeviceClass struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec DeviceClassSpec `json:"spec,omitempty"`
}

DeviceClass is a vendor or admin-provided resource that contains contraint and configuration information. Essentially, it is a re-usable collection of predefined data that device claims may use. Cluster scoped.

type DeviceClassConfigReference

type DeviceClassConfigReference struct {
	// API version of the referent.
	// +required
	APIVersion string `json:"apiVersion"`

	// Kind of the referent.
	// +required
	Kind string `json:"kind"`

	// Namespace of the referent.
	// +required
	Namespace string `json:"namespace"`

	// Name of the referent.
	// +required
	Name string `json:"name"`
}

DeviceClassConfigReference is used to refer to arbitrary configuration objects from the class. Since it is the class, and therefore is created by the administrator, it allows referencing objects in any namespace.

type DeviceClassSpec

type DeviceClassSpec struct {
	// Driver specifies the driver that should handle this class of devices.
	// When a DeviceClaim uses this class, only devices published by the
	// specified driver will be considered.
	// +required
	Driver string `json:driver,omitempty`

	// DeviceType is a driver-independent classification of the device.  In
	// claims, this may be used instead of specifying the class
	// explicitly, so that we do not aribtrarily limit claims to a
	// particular vendor's devices.
	//
	// Alternatively, we may want to consider a DeviceCapabilities vector,
	// or use device attributes or individual resource types supported by a
	// device to indicate device functions.
	//
	// +required
	DeviceType string `json:deviceType,omitempty`

	// Constraints is a CEL expression that operates on device attributes,
	// and must evaluate to true for a device to be considered. It will be
	// ANDed with any Constraints field in the DeviceClaim using this class.
	//
	// +optional
	Constraints *string `json:"constraints,omitempty"`

	// AdminAccess indicates that this class provides administrative access
	// to the devices. Claims using a class with AdminAccess are expected
	// to be used for monitoring or other management services for a device.
	// They ignore all ordinary claims to the device with respect to access
	// modes and any resource allocations. Access to these classes must be
	// controlled via ResourceQuota. Default is false.
	//
	// +optional
	AdminAccess *bool `json:"adminAccess,omitempty"`

	// DeviceConfigs contains references to arbitrary vendor device configuration
	// objects that will be attached to the device allocation.
	//
	// +optional
	Configs []DeviceClassConfigReference `json:"configs,omitempty"`
}

DeviceClassSpec provides the details of the DeviceClass.

type DeviceConfigReference

type DeviceConfigReference struct {
	// API version of the referent.
	// +required
	APIVersion string `json:"apiVersion"`

	// Kind of the referent.
	// +required
	Kind string `json:"kind"`

	// Name of the referent.
	// +required
	Name string `json:"name"`
}

DeviceConfigReference is used to refer to arbitrary configuration object from the claim. Since it is created by the end user, the referenced objects are restricted to the same namespace as the DeviceClaim.

type DeviceIP

type DeviceIP struct {
	// IP is the IP address assigned to the device
	IP string `json:"ip,omitempty"`
}

type DevicePool

type DevicePool struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DevicePoolSpec   `json:"spec,omitempty"`
	Status DevicePoolStatus `json:"status,omitempty"`
}

DevicePool represents a collection of devices managed by a given driver. How devices are divided into pools is driver-specific, but typically the expectation would a be a pool per identical collection of devices, per node. It is fine to have more than one pool for a given node, for the same driver.

type DevicePoolSpec

type DevicePoolSpec struct {
	// NodeName is the name of the node containing the devices in the pool.
	// For network attached devices, this may be empty.
	// +optional
	NodeName *string `json:"nodeName,omitempty"`

	// Driver is the name of the DeviceDriver that created this object and
	// owns the data in it.
	// +required
	Driver string `json:"driver,omitempty"`

	// Attributes contains device attributes that are common to all devices
	// in the pool.
	// +optional
	Attributes []Attribute `json:"attributes,omitempty"`

	// Resources are pooled resources that are shared by all devices in the
	// pool. This is typically used when representing a partitionable
	// device, and need not be populated otherwise.
	//
	// +optional
	Resources []ResourceCapacity `json:"resources,omitempty"`

	// Devices contains the individual devices in the pool.
	//
	// +required
	Devices []Device `json:"devices,omitempty"`
}

DevicePoolSpec identifies the driver and contains the data for the pool prior to any allocations. NOTE: It's not clear that spec/status is the right model for this data.

type DevicePoolStatus

type DevicePoolStatus struct {
	AvailableDevices int `json:"availableDevices,omitempty"`
}

DevicePoolStatus contains the state of the pool as last reported by the driver. Note that this will not include the allocations that have been made by the scheduler but not yet seen by the driver. Thus, it is NOT sufficient to make future scheduling decisions.

type DeviceStatus

type DeviceStatus struct {
	// DevicePoolName is the name of the DevicePool to which this
	// device belongs. The driver for that device pool owns this
	// entry.
	// +required
	DevicePoolName string `json:"devicePoolName"`

	// DeviceName contains the name of the allocated Device.
	// +required
	DeviceName string `json:"deviceName,omitempty"`

	// Conditions contains the latest observation of the device's state.
	Conditions []metav1.Condition `json:"conditions"`

	// DeviceIP contains the IP allocated for the device, if appropriate.
	// +optional
	DeviceIP *string `json:"deviceIP,omitempty"`

	// DeviceIPs contains all of the IPs allocated for a device, if any.
	// If populated, the zero'th entry must match DeviceIP.
	// +optional
	DeviceIPs []DeviceIP `json:"deviceIPs,omitempty"`

	// Arbitrary driver-specific data.
	// +optional
	DeviceInfo []runtime.RawExtension `json:"deviceInfo,omitempty"`

	// Allocations contain the resource allocations from this device,
	// for the claim. Note that this may only satisfy part of the claim.
	// Also, because devices may allocate some resources in blocks, this
	// may even be larger than the requests or limits in the claim.
	// +optional
	Allocations []ResourceAllocation `json:"allocations,omitempty"`
}

DeviceStatus contains the status of an allocated result, if the driver chooses to report it. This may include driver-specific information.

type ResourceAllocation

type ResourceAllocation struct {
	// Name is the resource name/string for this allocation.
	// +required
	Name string `json:"name"`

	// Amount is the amount of resource allocated for this claim.
	// +required
	Allocation resource.Quantity `json:"allocation,inline"`
}

ResourceAllocation contains the per-device resource allocations.

type ResourceCapacity

type ResourceCapacity struct {
	// Name is the resource name/type.
	Name string `json:"name"`

	// Capacity is the total capacity of the named resource.
	// +required
	Capacity resource.Quantity `json:"capacity"`

	// BlockSize is the increments in which capacity is consumed. For
	// example, if you can only allocate memory in 4k pages, then the
	// block size should be "4Ki". Default is 1.
	//
	// +optional
	BlockSize *resource.Quantity `json:"blockSize,omitempty"`
}

type SemVer

type SemVer string

SemVer represents a semantic version value. In this prototype it is just a string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL