dummy

package
v1.21.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyDevice

type DummyDevice struct {
	Name   string
	HWAddr string
	MTU    int
	Flags  string
}

func (DummyDevice) Free

func (d DummyDevice) Free(cfg types.DeviceConfig) error

Free deletes the dummy link. This is best-effort cleanup for a device that was created by Setup but never attached to a pod (e.g. the pod failed to start after prepare): once the interface is moved into a pod netns and that netns is reaped, the kernel destroys the dummy automatically, so the root-namespace lookup here simply finds nothing and returns nil.

func (DummyDevice) GetAttrs

func (DummyDevice) IfName

func (d DummyDevice) IfName() string

func (DummyDevice) KernelIfName

func (d DummyDevice) KernelIfName() string

func (DummyDevice) MarshalBinary

func (d DummyDevice) MarshalBinary() (data []byte, err error)

func (DummyDevice) Match

func (DummyDevice) Setup

func (d DummyDevice) Setup(cfg types.DeviceConfig) error

Setup creates the dummy link in the root network namespace. The caller (RunPodSandbox) subsequently moves it into the pod netns.

netlink.LinkAdd uses NLM_F_EXCL and is therefore not idempotent: it returns EEXIST if the interface already exists. On EEXIST we adopt the existing device when it is a dummy (e.g. a leftover from a prior, partially-completed allocation), otherwise we delete and recreate it so we never adopt a stale device of the wrong type.

func (*DummyDevice) UnmarshalBinary

func (d *DummyDevice) UnmarshalBinary(data []byte) error

type DummyManager

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

func NewManager

func NewManager(logger *slog.Logger, cfg *v2alpha1.DummyDeviceManagerConfig) (*DummyManager, error)

func (*DummyManager) ListDevices

func (mgr *DummyManager) ListDevices() ([]types.Device, error)

ListDevices advertises the dummy devices derived from configuration.

Like macvlan, dummy links are virtual devices that this driver owns: they do not exist in the kernel until a claim is allocated and Device.Setup creates one. ListDevices therefore does not scan the kernel; it synthesises Count discrete devices named dummy0..dummy<Count-1> so DRA can advertise and allocate them. The (Count+1)th claim stays Pending.

func (*DummyManager) RestoreDevice

func (mgr *DummyManager) RestoreDevice(data []byte) (types.Device, error)

func (*DummyManager) Type

func (mgr *DummyManager) Type() types.DeviceManagerType

Jump to

Keyboard shortcuts

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