cmd

package
v0.0.0-...-9514e8a Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

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

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

func NewCmd

func NewCmd(opts ...Option) *Cmd

NewCmd creates a new Cmd instance, whose Add, Del and Check methods can be passed to skel.PluginMain

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.

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 ConfigurationParams

type ConfigurationParams struct {
	Log     *logrus.Entry
	Conf    *models.DaemonConfigurationStatus
	Args    *skel.CmdArgs
	CniArgs *types.ArgsSpec
}

ConfigurationParams contains the arguments and Cilium configuration of a CNI invocation. Those fields may be used by custom implementations of the EndpointConfigurator interface to customize the CNI ADD call.

type DefaultConfigurator

type DefaultConfigurator struct{}

DefaultConfigurator is the default endpoint configurator. It configures a single endpoint for the interface name provided by the CNI ADD invocation, using an auto-selected IPAM pool.

func (*DefaultConfigurator) GetConfigurations

GetConfigurations returns a single a default configuration

type EndpointConfiguration

type EndpointConfiguration interface {
	// IfName specifies the container interface name to be used for this endpoint
	IfName() string
	// IPAMPool specifies which IPAM pool the endpoint's IP should be allocated from
	IPAMPool() string

	// PrepareEndpoint returns the interface configuration 'cmd' of the container
	// namespace as well as the template for the endpoint creation request 'ep'.
	PrepareEndpoint(ipam *models.IPAMResponse) (cmd *CmdState, ep *models.EndpointChangeRequest, err error)
}

EndpointConfiguration determines the configuration of an endpoint to be created duing a CNI ADD invocation.

type EndpointConfigurator

type EndpointConfigurator interface {
	GetConfigurations(p ConfigurationParams) ([]EndpointConfiguration, error)
}

EndpointConfigurator returns a list of endpoint configurations for a given CNI ADD invocation. If the CNI ADD invocation should result in multiple endpoints being created, it may return multiple endpoint configurations, one for each endpoint.

type Option

type Option func(cmd *Cmd)

Option allows the customization of the Cmd implementation

func WithEPConfigurator

func WithEPConfigurator(cfg EndpointConfigurator) Option

WithEPConfigurator is used to create a Cmd instance with a custom endpoint configurator. The endpoint configurator can be used to customize the creation of endpoints during the CNI ADD invocation. This function is exported to be accessed outside the tree.

Jump to

Keyboard shortcuts

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