Documentation ¶
Overview ¶
nolint: nilnil
Index ¶
- Constants
- Variables
- func FindFreeIP(subnet *net.IPNet, leases []net.IP, start, end net.IP) net.IP
- func InitPluginCNI(conf ConfCNI) (*cniPlugin, error)
- func InitPluginLXDBridge(server lxd.ContainerServer, conf ConfLXDBridge) (*lxdBridgePlugin, error)
- func InitPluginNoop() (*noopPlugin, error)
- type ConfCNI
- type ConfLXDBridge
- type ContainerNetwork
- type Plugin
- type PodNetwork
- type Properties
- type PropertiesRunning
- type Result
- type Status
Constants ¶
const ( DefaultCNIbinPath = "/opt/cni/bin" DefaultCNIconfPath = "/etc/cni/net.d" )
const (
// DefaultInterface for containers is always eth0
DefaultInterface = "eth0"
)
const (
DefaultLXDBridge = "lxdbr0"
)
Variables ¶
var (
ErrNoNetworksFound = errors.New("no valid networks found")
)
var (
ErrNoop = errors.New("noop")
)
var (
ErrNotBridge = errors.New("not a bridge")
)
var ErrNotImplemented = errors.New("not implemented")
var (
ErrNotSupported = errors.New("not supported")
)
Functions ¶
func FindFreeIP ¶
FindFreeIP tries to find an available IP address within given subnet, respecting reserved addresses in leases and must be between the start and end address. Network and broadcast IP are also reserved and automatically added to leases. If start or end is nil their closest available address from the subnet is selected. nolint: gomnd
func InitPluginCNI ¶
InitPluginCNI instantiates the cni plugin using the provided config
func InitPluginLXDBridge ¶
func InitPluginLXDBridge(server lxd.ContainerServer, conf ConfLXDBridge) (*lxdBridgePlugin, error)
InitPluginLXDBridge instantiates the LXDBridge plugin using the provided config
func InitPluginNoop ¶
func InitPluginNoop() (*noopPlugin, error)
InitPluginNoop instantiates the noop plugin
Types ¶
type ConfCNI ¶
type ConfCNI struct { BinPath string ConfPath string NetnsPath string // CNI output will be written to OutputWriter OutputWriter io.Writer }
ConfCNI are configuration options for the cni plugin. All properties are optional and get a default value
type ConfLXDBridge ¶
ConfLXDBridge are configuration options for the LXDBridge plugin. All properties are optional and get a default value
type ContainerNetwork ¶
type ContainerNetwork interface { // WhenCreated is called when the container is created WhenCreated(ctx context.Context, prop *Properties) (*Result, error) // WhenStarted is called when the container is started WhenStarted(ctx context.Context, prop *PropertiesRunning) (*Result, error) // WhenStopped is called when the container is stopped. If tearing down here, must tear down as good as possible. Must tear // down here if not implemented for WhenDeleted. If an error is returned it will only be logged WhenStopped(ctx context.Context, prop *Properties) error // WhenDeleted is called when the container is deleted. If tearing down here, must tear down as good as possible. Must tear // down here if not implemented for WhenStopped. If an error is returned it will only be logged WhenDeleted(ctx context.Context, prop *Properties) error }
ContainerNetwork is the interface for a container network environment context
type Plugin ¶
type Plugin interface { // PodNetwork enters a pod network environment context PodNetwork(id string, annotations map[string]string) (PodNetwork, error) // Status returns error if the plugin is in error state Status() error // UpdateRuntimeConfig is called when there are updates to the configuration which the plugin might need to apply UpdateRuntimeConfig(conf *rtApi.RuntimeConfig) error }
NetworkPlugin is the interface for lxe network plugins
type PodNetwork ¶
type PodNetwork interface { // ContainerNetwork enters a container network environment context ContainerNetwork(id string, annotations map[string]string) (ContainerNetwork, error) // Status reports IP and any error with the network of that pod Status(ctx context.Context, prop *PropertiesRunning) (*Status, error) // WhenCreated is called when the pod is created WhenCreated(ctx context.Context, prop *Properties) (*Result, error) // WhenStarted is called when the pod is started. WhenStarted(ctx context.Context, prop *PropertiesRunning) (*Result, error) // WhenStopped is called when the pod is stopped. If tearing down here, must tear down as good as possible. Must tear // down here if not implemented for WhenDeleted. If an error is returned it will only be logged WhenStopped(ctx context.Context, prop *Properties) error // WhenDeleted is called when the pod is deleted. If tearing down here, must tear down as good as possible. Must tear // down here if not implemented for WhenStopped. If an error is returned it will only be logged WhenDeleted(ctx context.Context, prop *Properties) error }
PodNetwork is the interface for a pod network environment.
type Properties ¶
type Properties struct { // Arbitrary Data are provided if a previous call on this PodNetwork returned them Data map[string]string }
Properties of the resource at the time of the call
type PropertiesRunning ¶
type PropertiesRunning struct { Properties // Pid of the resource. This value is set for calls where the applicable resource is running Pid int64 }
PropertiesRunning contains additionally running info
type Result ¶
type Result struct { // Arbitrary Data to keep related to the pod. If non-nil they will overwrite the previous saved data. Data map[string]string // List of Nics to add to the resource Nics []device.Nic // NetworkConfigEntries of cloudinit to be set. Keep in mind cloudinit runs only when the container starts NetworkConfigEntries []cloudinit.NetworkConfigEntryPhysical }
Result contains additionally info which can only be set on creation