network

package
v3.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: BSD-3-Clause Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
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

type CNIPath struct {
	Conf   string
	Plugin string
}

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

func (m *Setup) AddNetworks() error

AddNetworks brings up networks interface in container

func (*Setup) DelNetworks

func (m *Setup) DelNetworks() error

DelNetworks tears down networks interface in container

func (*Setup) GetNetworkIP

func (m *Setup) GetNetworkIP(network string, version string) (net.IP, error)

GetNetworkIP returns IP associated with a configured network, if network is empty, the function returns IP for the first configured network

func (*Setup) GetNetworkInterface

func (m *Setup) GetNetworkInterface(network string) (string, error)

GetNetworkInterface returns container network interface associated with a network, if network is empty, the function returns interface for the first configured network

func (*Setup) SetArgs

func (m *Setup) SetArgs(args []string) error

SetArgs affects arguments to corresponding network plugins

func (*Setup) SetCapability

func (m *Setup) SetCapability(network string, capName string, args interface{}) error

SetCapability sets capability arguments for the corresponding network plugin uses by a configured network

func (*Setup) SetEnvPath

func (m *Setup) SetEnvPath(envPath string)

SetEnvPath allows to define custom paths for PATH environment variables used during CNI plugin execution

Jump to

Keyboard shortcuts

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