resourceslice

package
v0.31.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

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, kubeClient kubernetes.Interface, driver string, owner Owner, resources *DriverResources) *Controller

StartController constructs a new controller and starts it. 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.

If a kubeClient is provided, then it synchronizes ResourceSlices with the resource information provided by plugins. Without it, the controller is inactive. This can happen when kubelet is run stand-alone without an apiserver. In that case we can't and don't need to publish ResourceSlices.

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 takes over ownership, so these resources must not get modified after this method 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.

type Owner

type Owner struct {
	APIVersion string
	Kind       string
	Name       string
	UID        types.UID
}

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.

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

	// Device names must be unique inside the pool.
	Devices []resourceapi.Device
}

Pool is the collection of devices belonging to the same pool.

Jump to

Keyboard shortcuts

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