Documentation ¶
Index ¶
- Constants
- Variables
- func CNIGateway() (string, error)
- func CreateCNINetwork(ctx context.Context, cni gocni.CNI, task containerd.Task, ...) (*gocni.CNIResult, error)
- func DeleteCNINetwork(ctx context.Context, cni gocni.CNI, client *containerd.Client, name string) error
- func GetIPAddress(container string, PID uint32) (string, error)
- func InitNetwork() (gocni.CNI, error)
- func NSPathByPid(pid int) string
- func NSPathByPidWithRoot(root string, pid int) string
- func WithNetNS(ns netns.NsHandle, work func() error) error
- func WithNetNSByPath(path string, work func() error) error
- func WithNetNSLink(ns netns.NsHandle, ifName string, work func(link netlink.Link) error) error
Constants ¶
View Source
const ( // CNIBinDir describes the directory where the CNI binaries are stored CNIBinDir = "/opt/cni/bin" // CNIConfDir describes the directory where the CNI plugin's configuration is stored CNIConfDir = "/etc/cni/net.d" // NetNSPathFmt gives the path to the a process network namespace, given the pid NetNSPathFmt = "/proc/%d/ns/net" // CNIDataDir is the directory CNI stores allocated IP for containers CNIDataDir = "/var/run/cni" )
Variables ¶
View Source
var ErrLinkNotFound = errors.New("Link not found")
Functions ¶
func CNIGateway ¶
CNIGateway returns the gateway for default subnet
func CreateCNINetwork ¶
func CreateCNINetwork(ctx context.Context, cni gocni.CNI, task containerd.Task, labels map[string]string) (*gocni.CNIResult, error)
CreateCNINetwork creates a CNI network interface and attaches it to the context
func DeleteCNINetwork ¶
func DeleteCNINetwork(ctx context.Context, cni gocni.CNI, client *containerd.Client, name string) error
DeleteCNINetwork deletes a CNI network based on task ID and Pid
func GetIPAddress ¶
GetIPAddress returns the IP address from container based on container name and PID
func InitNetwork ¶
InitNetwork writes configlist file and initializes CNI network
func NSPathByPid ¶
func NSPathByPidWithRoot ¶
func WithNetNSByPath ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.