dummy

package
v1.21.0-pre.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 13 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) Merge

func (d DummyDevice) Merge(_ types.Device)

Merge is a no-op for DummyDevice: its KernelIfName always mirrors Name and is never derived from live host state, so nothing can be lost on rescan.

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) RestoreDevice

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

func (*DummyManager) Run

func (mgr *DummyManager) Run(ctx context.Context, publish func([]types.Device)) error

Run publishes the synthesised dummy devices once, then blocks until ctx is cancelled. Dummy devices are static — derived purely from config — so a single publish at startup is sufficient.

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