cmd

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 49 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PluginMain added in v1.19.0

func PluginMain(opts ...Option)

PluginMain is the main entry point for the Cilium CNI plugin.

Types

type Cmd

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

Cmd provides methods for the CNI ADD, DEL and CHECK commands.

func (*Cmd) Add

func (cmd *Cmd) Add(args *skel.CmdArgs) (err error)

func (*Cmd) Check

func (cmd *Cmd) Check(args *skel.CmdArgs) error

Check implements the cni CHECK verb. It ensures that the interface is configured correctly

Currently, it verifies that - endpoint exists in the agent and is healthy - the interface in the container is sane

func (*Cmd) Del

func (cmd *Cmd) Del(args *skel.CmdArgs) error

Del is invoked on CNI DEL

Note: ENI specific attributes do not need to be released as the ENIs and ENI IPs can be reused and are not released until the node terminates.

func (*Cmd) Status added in v1.18.0

func (cmd *Cmd) Status(args *skel.CmdArgs) error

Status implements the cni STATUS verb. Currently, it

  • checks cilium-cni connectivity with cilium-agent using healthz endpoint
  • If cilium-cni depends on delegated plugins (host-local, azure etc) for IPAM, cilium-cni invokes the STATUS API of the delegated plugins and passes the result back.

type CmdState

type CmdState struct {
	IP6       netip.Addr
	IP6routes []route.Route
	IP6rules  []route.Rule
	IP4       netip.Addr
	IP4routes []route.Route
	IP4rules  []route.Rule
	HostAddr  *models.NodeAddressing
}

type OnConfigReady added in v1.19.0

type OnConfigReady interface {
	OnConfigReady(args *skel.CmdArgs, cniArgs *types.ArgsSpec, conf *models.DaemonConfigurationStatus) error
}

OnConfigReady is invoked at the beginning of [(*Cmd).Add], right after the CNI network configuration, CNI arguments and the Cilium agent configuration were loaded. It may be used to sets up internal state of the hook.

type OnIPAMReady added in v1.19.0

type OnIPAMReady interface {
	OnIPAMReady(ipam *models.IPAMResponse) error
}

OnIPAMReady is invoked after IPAM configuration was validated. It may be used to derive further endpoint configuration related to IPAM.

type OnInterfaceConfigReady added in v1.19.0

type OnInterfaceConfigReady interface {
	OnInterfaceConfigReady(cmd *CmdState, ep *models.EndpointChangeRequest, res *cniTypesV1.Result) error
}

OnInterfaceConfigReady is invoked right before the pod's network interface pair is configured and the endpoint creation request is sent to the daemon. It may be used to modify the endpoint creation request, the command state and the CNI result accumulated so far.

type OnLinkConfigReady added in v1.19.0

type OnLinkConfigReady interface {
	OnLinkConfigReady(linkConfig *connector.LinkConfig) error
}

OnLinkConfigReady is invoked before the datapath connectors are called to create the pod's network links (i.e. veth or netkit pairs). It may be used to further modify the link configuration.

type Option

type Option func(cmd *Cmd)

Option allows the customization of the Cmd implementation

func WithOnConfigReady added in v1.19.0

func WithOnConfigReady(f OnConfigReady) Option

WithOnConfigReady adds a new callback to be invoked after the CNI network configuration, CNI arguments and the Cilium agent configuration were loaded.

func WithOnIPAMReady added in v1.19.0

func WithOnIPAMReady(f OnIPAMReady) Option

WithOnIPAMReady adds a new callback to be invoked after IPAM configuration was validated.

func WithOnInterfaceConfigReady added in v1.19.0

func WithOnInterfaceConfigReady(f OnInterfaceConfigReady) Option

WithOnInterfaceConfigReady adds a new callback to be invoked before the pod's network interface pair is configured.

func WithOnLinkConfigReady added in v1.19.0

func WithOnLinkConfigReady(f OnLinkConfigReady) Option

WithOnLinkConfigReady adds a new callback to be invoked before the datapath connectors are called to create the pod's network links.

func WithVersion added in v1.19.0

func WithVersion(version string) Option

WithVersion overrides the version reported by the CNI plugin binary in its about string.

Jump to

Keyboard shortcuts

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