cninetwork

package
v0.0.0-...-2e6da28 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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

This section is empty.

Functions

func CNIGateway

func CNIGateway() (string, error)

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

func GetIPAddress(container string, PID uint32) (string, error)

GetIPAddress returns the IP address from container based on container name and PID

func InitNetwork

func InitNetwork() (gocni.CNI, error)

InitNetwork writes configlist file and initializes CNI network

Types

This section is empty.

Jump to

Keyboard shortcuts

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