dynamic-resource-allocationk8s.io/dynamic-resource-allocation/resourceslice/tracker Index | Files

package tracker

import "k8s.io/dynamic-resource-allocation/resourceslice/tracker"

Index

Types

type Options

type Options struct {
	// EnableDeviceTaints controls whether DeviceTaintRules
	// will be reflected in ResourceSlices reported by the tracker.
	//
	// If false, then TaintInformer and ClassInformer
	// are not needed. The tracker turns into
	// a thin wrapper around the underlying
	// SliceInformer, with no processing of its own.
	EnableDeviceTaints bool

	SliceInformer resourceinformers.ResourceSliceInformer
	TaintInformer resourcealphainformers.DeviceTaintRuleInformer
	ClassInformer resourceinformers.DeviceClassInformer

	// KubeClient is used to generate Events when CEL expressions
	// encounter runtime errors.
	KubeClient kubernetes.Interface
}

Options configure a Tracker.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker maintains a view of ResourceSlice objects with matching DeviceTaintRules applied. It is backed by informers to process potential changes to resolved ResourceSlices asynchronously.

func StartTracker

func StartTracker(ctx context.Context, opts Options) (finalT *Tracker, finalErr error)

StartTracker creates and initializes informers for a new Tracker.

func (*Tracker) AddEventHandler

AddEventHandler adds an event handler to the tracker. Events to a single handler are delivered sequentially, but there is no coordination between different handlers. A handler may use the tracker.

The return value can be used to wait for cache synchronization. All currently know ResourceSlices get delivered via Add events before this method returns.

func (*Tracker) HasSynced

func (t *Tracker) HasSynced() bool

HasSynced returns true if the tracker is done with processing all currently existing input objects. Adding a new event handler at that point is possible and will emit events with up-to-date ResourceSlice objects.

func (*Tracker) ListPatchedResourceSlices

func (t *Tracker) ListPatchedResourceSlices() ([]*resourceapi.ResourceSlice, error)

ListPatchedResourceSlices returns all ResourceSlices in the cluster with modifications from DeviceTaints applied.

func (*Tracker) Stop

func (t *Tracker) Stop()

Stop ends all background activity and blocks until that shutdown is complete.

Source Files

tracker.go

Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
24 packages
Last checked
now

Tools for package owners.