network

package
v1.0.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CNIBinDir is the default path to CNI plugin binaries.
	CNIBinDir = "/opt/cni/bin"
	// CNIConfDir is the default path to CNI network configuration files.
	CNIConfDir = "/etc/cni/net.d"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Manager contains network manager configuration and exposes methods to bring up and down network interface.

func (*Manager) Init

func (m *Manager) Init(cniPath *snetwork.CNIPath) error

Init initializes CNI network manager.

func (*Manager) SetPodCIDR

func (m *Manager) SetPodCIDR(cidr string)

SetPodCIDR updates pod's CIDR.

func (*Manager) SetUpPod

func (m *Manager) SetUpPod(podConfig *PodConfig) (*PodNetwork, error)

SetUpPod bring up pod's network interface.

func (*Manager) Status

func (m *Manager) Status() error

Status returns an error if the network manager is not initialized.

func (*Manager) TearDownPod

func (m *Manager) TearDownPod(podNetwork *PodNetwork) error

TearDownPod tears down pod's network interface.

type PodConfig

type PodConfig struct {
	ID           string
	Namespace    string
	Name         string
	NsPath       string
	PortMappings []*k8s.PortMapping
}

PodConfig contains/defines pod network configuration.

type PodNetwork

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

PodNetwork represents set up pod's network. It is a caller's responsibility to tear this network down by calling Manager.TearDownPod during pod's shutdown. PodNetwork is also used to retrieve pod's IP address.

func (*PodNetwork) GetIP

func (n *PodNetwork) GetIP() (net.IP, error)

GetIP returns pod's IP address. It first tries to fetch IPv4 and in case of errors will try to fetch IPv6.

Jump to

Keyboard shortcuts

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