networkdriver

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: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"network-driver",
	"Cilium Network Driver",

	cell.Config(defaultNetworkDriverConfig),

	cell.ProvidePrivate(
		ciliumNetworkDriverConfigResource,
		resourceClaimResource,
		podResource,
	),
	cell.Invoke(registerNetworkDriver),
)

Cell implements the Cilium Network Driver for exposing network devices to workloads.

Functions

This section is empty.

Types

type Driver

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

func (*Driver) HandleError

func (d *Driver) HandleError(ctx context.Context, err error, msg string)

HandleError logs out error messages from kubelet.

func (*Driver) PrepareResourceClaims

func (driver *Driver) PrepareResourceClaims(ctx context.Context, claims []*resourceapi.ResourceClaim) (result map[kube_types.UID]kubeletplugin.PrepareResult, err error)

PrepareResourceClaims gets called when we have a request to allocate a resource claim. we also need to have a way to remember the allocations elsewhere so allocation state persist across restarts in the plugin.

func (*Driver) RunPodSandbox

func (driver *Driver) RunPodSandbox(ctx context.Context, podSandbox *api.PodSandbox) error

RunPodSandbox is called by the container runtime when a pod sandbox is started. It configures the allocated network devices for the pod based on its network namespace.

func (*Driver) Start

func (driver *Driver) Start(ctx cell.HookContext) error

Start retrieves and validates the configuration. If configuration is found and valid, it initializes all the devicemanagers that are enabled by config, and starts the DRA + NRI registration.

func (*Driver) Stop

func (driver *Driver) Stop(ctx cell.HookContext) error

Stop stops the nri and dra hooks.

func (*Driver) StopPodSandbox

func (driver *Driver) StopPodSandbox(ctx context.Context, podSandbox *api.PodSandbox) error

StopPodSandbox is called when a pod sandbox is stopped. It cleans up the allocated network devices for the pod.

func (*Driver) Synchronize

func (driver *Driver) Synchronize(ctx context.Context, pods []*api.PodSandbox, _ []*api.Container) ([]*api.ContainerUpdate, error)

Synchronize is invoked by the runtime when the NRI plugin (re)connects — notably right after an agent restart — with every running pod. The sandbox tasks are alive here, so the netns is populated; we capture it so a later StopPodSandbox can recover the netns on containerd < 2.1 even across an agent restart. This mirrors how driver.allocations is rebuilt from ResourceClaims on restart: node-local runtime state reconstructed from a durable source rather than persisted to disk. We request no container updates.

func (*Driver) UnprepareResourceClaims

func (driver *Driver) UnprepareResourceClaims(ctx context.Context, claims []kubeletplugin.NamespacedObject) (result map[kube_types.UID]error, err error)

UnprepareResourceClaims gets called whenever we have a request to deallocate a resource claim. ex: pod goes away.

type NetworkDriverConfig

type NetworkDriverConfig struct {
	Enabled bool `mapstructure:"enable-network-driver"`
}

func (NetworkDriverConfig) Flags

func (cfg NetworkDriverConfig) Flags(flags *pflag.FlagSet)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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