device

package
v1.20.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DesiredDeviceIndex = statedb.Index[*DesiredDevice, DesiredDeviceKey]{
		Name: "id",
		FromObject: func(obj *DesiredDevice) index.KeySet {
			return index.NewKeySet(obj.GetKey().Key())
		},
		FromKey:    DesiredDeviceKey.Key,
		FromString: index.FromString,
		Unique:     true,
	}
	DesiredDeviceNameIndex = statedb.Index[*DesiredDevice, string]{
		Name: "name",
		FromObject: func(obj *DesiredDevice) index.KeySet {
			return index.NewKeySet(index.String(obj.Name))
		},
		FromKey:    index.String,
		FromString: index.FromString,
		Unique:     true,
	}
)
View Source
var Cell = cell.Module(
	"device-reconciler",
	"Reconciles desired devices to the Linux kernel links",
	TableCell,
	cell.Provide(newDeviceManager),
	cell.Invoke(registerReconciler),
)
View Source
var (
	ErrOwnerDoesNotExist = errors.New("owner does not exist")
)
View Source
var TableCell = cell.Group(
	cell.ProvidePrivate(newDesiredDeviceTable),
	cell.Provide(statedb.RWTable[*DesiredDevice].ToTable),
)

Functions

This section is empty.

Types

type DesiredDevice

type DesiredDevice struct {
	Owner      DeviceOwner       `json:"owner" yaml:"owner"`
	Name       string            `json:"name" yaml:"name"`
	DeviceSpec DesiredDeviceSpec `json:"spec" yaml:"spec"`
	// contains filtered or unexported fields
}

func (*DesiredDevice) Clone

func (dd *DesiredDevice) Clone() *DesiredDevice

func (*DesiredDevice) GetKey

func (dd *DesiredDevice) GetKey() DesiredDeviceKey

func (*DesiredDevice) GetStatus

func (dd *DesiredDevice) GetStatus() reconciler.Status

func (*DesiredDevice) SetStatus

func (dd *DesiredDevice) SetStatus(s reconciler.Status) *DesiredDevice

func (*DesiredDevice) TableHeader

func (dd *DesiredDevice) TableHeader() []string

func (*DesiredDevice) TableRow

func (dd *DesiredDevice) TableRow() []string

func (*DesiredDevice) Validate

func (dd *DesiredDevice) Validate() error

type DesiredDeviceKey

type DesiredDeviceKey struct {
	Owner DeviceOwner
	Name  string
}

func (DesiredDeviceKey) Key

func (k DesiredDeviceKey) Key() index.Key

func (*DesiredDeviceKey) MarshalBinary

func (k *DesiredDeviceKey) MarshalBinary() ([]byte, error)

func (DesiredDeviceKey) String

func (k DesiredDeviceKey) String() string

func (*DesiredDeviceKey) UnmarshalBinary

func (k *DesiredDeviceKey) UnmarshalBinary(data []byte) error

type DesiredDeviceSpec

type DesiredDeviceSpec interface {
	ToNetlink() (netlink.Link, error)
	Properties() string
	MarshalJSON() ([]byte, error)
	MarshalYAML() (any, error)
}

type DesiredVLANDeviceSpec

type DesiredVLANDeviceSpec struct {
	Name        string `json:"name" yaml:"name"`
	VLANID      int    `json:"vlanID" yaml:"vlanID"`
	MTU         int    `json:"mtu" yaml:"mtu"`
	ParentName  string `json:"parentName" yaml:"parentName"`
	ParentIndex int
}

func (*DesiredVLANDeviceSpec) MarshalJSON

func (d *DesiredVLANDeviceSpec) MarshalJSON() ([]byte, error)

func (*DesiredVLANDeviceSpec) MarshalYAML

func (d *DesiredVLANDeviceSpec) MarshalYAML() (any, error)

func (*DesiredVLANDeviceSpec) Properties

func (d *DesiredVLANDeviceSpec) Properties() string
func (d *DesiredVLANDeviceSpec) ToNetlink() (netlink.Link, error)

type DeviceOwner

type DeviceOwner struct {
	Name string `json:"name" yaml:"name"`
}

type Initializer

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

type ManagerOperations

type ManagerOperations interface {
	// UpsertDevice upserts a desired device into the desired device table.
	UpsertDevice(device DesiredDevice) error
	// UpsertDeviceWait upserts a desired device into the desired device table
	// and waits for the device to be reconciled.
	UpsertDeviceWait(device DesiredDevice, timeout time.Duration) error
	// DeleteDevice deletes a desired device from the desired device table.
	DeleteDevice(device DesiredDevice) error
	// GetOrRegisterOwner gets or registers an owner with the given name.
	GetOrRegisterOwner(name string) DeviceOwner
	// RemoveOwner removes an owner and associated devices with the given owner.
	RemoveOwner(owner DeviceOwner) error
	// RegisterInitializer registers an initializer with the given name and returns
	// the initializer to the caller.
	RegisterInitializer(name string) Initializer
	// FinalizeInitializer should be called by the caller with registered initializer
	// once callers initial sync is completed. Once all initializers are finalized,
	// the reconciler will start initial pruning.
	FinalizeInitializer(initializer Initializer)
}

ManagerOperations is the interface for the desired device reconciler manager

Jump to

Keyboard shortcuts

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