Documentation ¶
Index ¶
- Constants
- func GetAllNetworkConfigList(cniPath *CNIPath) ([]*libcni.NetworkConfigList, error)
- type CNIPath
- type PortMapEntry
- type Setup
- func (m *Setup) AddNetworks(ctx context.Context) error
- func (m *Setup) DelNetworks(ctx context.Context) error
- func (m *Setup) GetNetworkIP(network string, version string) (net.IP, error)
- func (m *Setup) GetNetworkInterface(network string) (string, error)
- func (m *Setup) SetArgs(args []string) error
- func (m *Setup) SetCapability(network string, capName string, args interface{}) error
- func (m *Setup) SetEnvPath(envPath string)
- func (m *Setup) SetPortProtection(network string, lowPort int) error
Constants ¶
const ( // ErrNoCNIConfig corresponds to a missing CNI configuration path ErrNoCNIConfig = netError("no CNI configuration path provided") // ErrNoCNIPlugin corresponds to a missing CNI plugin path ErrNoCNIPlugin = netError("no CNI plugin path provided") )
Variables ¶
This section is empty.
Functions ¶
func GetAllNetworkConfigList ¶
func GetAllNetworkConfigList(cniPath *CNIPath) ([]*libcni.NetworkConfigList, error)
GetAllNetworkConfigList lists configured networks in configuration path directory provided by cniPath
Types ¶
type CNIPath ¶
CNIPath contains path to CNI configuration directory and path to executable CNI plugins directory
type PortMapEntry ¶
type PortMapEntry struct { HostPort int `json:"hostPort"` ContainerPort int `json:"containerPort"` Protocol string `json:"protocol"` HostIP string `json:"hostIP,omitempty"` }
PortMapEntry describes a port mapping between host and container
type Setup ¶
type Setup struct {
// contains filtered or unexported fields
}
Setup contains network installation setup
func NewSetup ¶
func NewSetup(networks []string, containerID string, netNS string, cniPath *CNIPath) (*Setup, error)
NewSetup creates and returns a network setup to configure, add and remove network interfaces in container
func NewSetupFromConfig ¶
func NewSetupFromConfig(networkConfList []*libcni.NetworkConfigList, containerID string, netNS string, cniPath *CNIPath) (*Setup, error)
NewSetupFromConfig creates and returns network setup to configure from a network configuration list
func (*Setup) AddNetworks ¶
AddNetworks brings up networks interface in container
func (*Setup) DelNetworks ¶
DelNetworks tears down networks interface in container
func (*Setup) GetNetworkIP ¶
GetNetworkIP returns IP associated with a configured network, if network is empty, the function returns IP for the first configured network
func (*Setup) GetNetworkInterface ¶
GetNetworkInterface returns container network interface associated with a network, if network is empty, the function returns interface for the first configured network
func (*Setup) SetCapability ¶
SetCapability sets capability arguments for the corresponding network plugin uses by a configured network
func (*Setup) SetEnvPath ¶
SetEnvPath allows to define custom paths for PATH environment variables used during CNI plugin execution