package networking

import "github.com/coreos/rkt/networking"

kvm.go file provides networking supporting functions for kvm flavor

Index

Constants

const (
	// Suffix to LocalConfigDir path, where users place their net configs
	UserNetPathSuffix = "net.d"

	// Default net path relative to stage1 root
	BuiltinNetPath = "etc/rkt/" + UserNetPathSuffix
)
const BuiltinNetPluginsPath = "usr/lib/rkt/plugins/net"
const (
	IPv4InterfaceArpProxySysctlTemplate = "net.ipv4.conf.%s.proxy_arp"
)
const (
	IfNamePattern = "eth%d"
)
const UserNetPluginsPath = "/usr/lib/rkt/plugins/net"

TODO(eyakubovich): make this configurable in rkt.conf

Functions

func CleanUpGarbage

func CleanUpGarbage(podRoot string, podID *types.UUID) error

CleanUpGarbage can be called when Load fails, but there may still be some garbage lying around. Right now, this deletes the namespace.

Types

type BridgeNetConf

type BridgeNetConf struct {
	NetConf
	BrName string `json:"bridge"`
	IsGw   bool   `json:"isGateway"`
}

type FlannelNetConf

type FlannelNetConf struct {
	NetConf

	SubnetFile string                 `json:"subnetFile"`
	Delegate   map[string]interface{} `json:"delegate"`
}

type MacVTapNetConf

type MacVTapNetConf struct {
	NetConf
	Master string `json:"master"`
	Mode   string `json:"mode"`
}

type NetConf

type NetConf struct {
	cnitypes.NetConf
	IPMasq           bool `json:"ipMasq"`
	MTU              int  `json:"mtu"`
	IsDefaultGateway bool `json:"isDefaultGateway"`
}

NetConf local struct extends cnitypes.NetConf with information about masquerading similar to CNI plugins

type Networking

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

Networking describes the networking details of a pod.

func Load

func Load(podRoot string, podID *types.UUID, localConfig string) (*Networking, error)

Load creates the Networking object from saved state. Assumes the current netns is that of the host.

func Setup

func Setup(podRoot string, podID types.UUID, fps []commonnet.ForwardedPort, netList common.NetList, localConfig, flavor string, noDNS, debug bool) (*Networking, error)

Setup creates a new networking namespace and executes network plugins to set up networking. It returns in the new pod namespace

func (*Networking) GetActiveNetworks

func (e *Networking) GetActiveNetworks() []activeNet

GetActiveNetworks returns activeNets to be used as NetDescriptors by plugins, which are required for stage1 executor to run (only for KVM)

func (*Networking) GetForwardableNet

func (n *Networking) GetForwardableNet() (*activeNet, error)

GetForwardableNet iterates through all loaded networks and returns either the first network that has masquerading enabled, or the last network in case there is no masqueraded one, or an error if no network was loaded.

func (*Networking) GetForwardableNetHostIP

func (n *Networking) GetForwardableNetHostIP() (net.IP, error)

GetForwardableNetHostIP uses GetForwardableNet() to determine the default network and then returns the Host's IP of that network.

func (*Networking) GetForwardableNetPodIP

func (n *Networking) GetForwardableNetPodIP() (net.IP, error)

GetForwardableNetPodIP uses GetForwardableNet() to determine the default network and then returns the Pod's IP of that network.

func (*Networking) GetIfacesByIP

func (n *Networking) GetIfacesByIP(ifaceIP net.IP) ([]net.Interface, error)

GetIfacesByIP searches for and returns the interfaces with the given IP Disregards the subnet mask since not every net.IP object contains On success it will return the list of found interfaces

func (*Networking) Save

func (e *Networking) Save() error

Save writes out the info about active nets for "rkt list" and friends to display

func (*Networking) Teardown

func (n *Networking) Teardown(flavor string, debug bool)

Teardown cleans up a produced Networking object.

Source Files

kvm.go net_plugin.go networking.go podenv.go portfwd.go

Directories

PathSynopsis
networking/netinfo
networking/tuntap
Version
v1.30.0 (latest)
Published
Apr 13, 2018
Platform
linux/amd64
Imports
32 packages
Last checked
5 days ago

Tools for package owners.