Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller synchronizes information about resources of one driver with ResourceSlice objects. It supports node-local and network-attached resources. A DRA driver for node-local resources typically runs this controller as part of its kubelet plugin.
func StartController ¶
func StartController(ctx context.Context, options Options) (*Controller, error)
StartController constructs a new controller and starts it.
func (*Controller) GetStats ¶ added in v0.32.0
func (c *Controller) GetStats() Stats
GetStats provides some insights into operations of the controller.
func (*Controller) Stop ¶
func (c *Controller) Stop()
Stop cancels all background activity and blocks until the controller has stopped.
func (*Controller) Update ¶
func (c *Controller) Update(resources *DriverResources)
Update sets the new desired state of the resource information.
The controller is doing a deep copy, so the caller may update the instance once Update returns.
type DriverResources ¶
type DriverResources struct {
// Each driver may manage different resource pools.
Pools map[string]Pool
}
DriverResources is a complete description of all resources synchronized by the controller.
func (*DriverResources) DeepCopy ¶ added in v0.32.0
func (in *DriverResources) DeepCopy() *DriverResources
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DriverResources.
func (*DriverResources) DeepCopyInto ¶ added in v0.32.0
func (in *DriverResources) DeepCopyInto(out *DriverResources)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Options ¶ added in v0.32.0
type Options struct {
// DriverName is the required name of the DRA driver.
DriverName string
// KubeClient is used to read Node objects (if necessary) and to access
// ResourceSlices. It must be specified.
KubeClient kubernetes.Interface
// If the owner is a v1.Node, then the NodeName field in the
// ResourceSlice objects is set and used to identify objects
// managed by the controller. The UID is not needed in that
// case, the controller will determine it automatically.
//
// The owner must be cluster-scoped. This is not always possible,
// therefore it is optional. A driver without a owner must take
// care that remaining slices get deleted manually as part of
// a driver uninstall because garbage collection won't work.
Owner *Owner
// This is the initial desired set of slices.
Resources *DriverResources
// Queue can be used to override the default work queue implementation.
Queue workqueue.TypedRateLimitingInterface[string]
// MutationCacheTTL can be used to change the default TTL of one minute.
// See source code for details.
MutationCacheTTL *time.Duration
// SyncDelay defines how long to wait between receiving the most recent
// informer event and syncing again. The default is 30 seconds.
//
// This is long enough that the informer cache should be up-to-date
// (matter mostly for deletes because an out-dated cache causes
// redundant delete API calls) and not too long that a human mistake
// doesn't get fixed while that human is waiting for it.
SyncDelay *time.Duration
}
Options contains various optional settings for StartController.
type Owner ¶
Owner is the resource which is meant to be listed as owner of the resource slices. For a node the UID may be left blank. The controller will look it up automatically.
func (*Owner) DeepCopy ¶ added in v0.32.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Owner.
func (*Owner) DeepCopyInto ¶ added in v0.32.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Pool ¶
type Pool struct {
// NodeSelector may be different for each pool. Must not get set together
// with Resources.NodeName. It nil and Resources.NodeName is not set,
// then devices are available on all nodes.
NodeSelector *v1.NodeSelector
// Generation can be left at zero. It gets bumped up automatically
// by the controller.
Generation int64
// Slices is a list of all ResourceSlices that the driver
// wants to publish for this pool. The driver must ensure
// that each resulting slice is valid. See the API
// definition for details, in particular the limit on
// the number of devices.
//
// If slices are not valid, then the controller will
// log errors produced by the apiserver.
//
// Drivers should publish at least one slice for each
// pool that they normally manage, even if that slice
// is empty. "Empty pool" is different from "no pool"
// because it shows that the driver is up-and-running
// and simply doesn't have any devices.
Slices []Slice
}
Pool is the collection of devices belonging to the same pool.
func (*Pool) DeepCopy ¶ added in v0.32.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pool.
func (*Pool) DeepCopyInto ¶ added in v0.32.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Slice ¶ added in v0.32.0
type Slice struct {
// Devices lists all devices which are part of the slice.
Devices []resourceapi.Device
}
Slice is turned into one ResourceSlice by the controller.
func (*Slice) DeepCopy ¶ added in v0.32.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Slice.
func (*Slice) DeepCopyInto ¶ added in v0.32.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.