cni

package
v1.20.11 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BcsNetworkContainer     = "BcsNetworkContainer"
	BcsNetworkContainerTrue = "true"
	BcsNetworkMode          = "networkMode"
)
View Source
const (
	ContainerStatusAbnormal = 1
)
View Source
const (
	PodNetEgressLimitName = "CTNR_NET_EGRESS_RATE"
)

Variables

This section is empty.

Functions

func NewPod

func NewPod(operator container.Container, tasks []*container.BcsContainerTask,
	handler *container.PodEventHandler, netImage string) container.Pod

NewPod create CNIPod instance with container interaface and container info

Types

type CNIPod

type CNIPod struct {

	//container network flow limit args
	NetLimit *comtypes.NetLimit
	// contains filtered or unexported fields
}

CNIPod combination for mutiple container

func (*CNIPod) CommitImage

func (p *CNIPod) CommitImage(id, image string) error

func (*CNIPod) Execute

func (p *CNIPod) Execute(name string, command []string) error

Execute execute command in container(name)

func (*CNIPod) Finit

func (p *CNIPod) Finit() error

Finit cni pod finit, close network infrastructure

func (*CNIPod) GetContainerByName

func (p *CNIPod) GetContainerByName(name string) *container.BcsContainerInfo

GetContainerByName get container info by container name

func (*CNIPod) GetContainerID

func (p *CNIPod) GetContainerID() string

GetContainerID get pod container id, in CNIPod, container id is network container id

func (*CNIPod) GetContainerTasks

func (p *CNIPod) GetContainerTasks() map[string]*container.BcsContainerTask

func (*CNIPod) GetContainers

func (p *CNIPod) GetContainers() []*container.BcsContainerInfo

GetContainers get all running container's info

func (*CNIPod) GetIPAddr

func (p *CNIPod) GetIPAddr() string

GetIPAddr get pod ip address if exist

func (*CNIPod) GetMessage

func (p *CNIPod) GetMessage() string

GetMessage get pod status message

func (*CNIPod) GetNamespace

func (p *CNIPod) GetNamespace() string

GetNamespace get pod namespace

func (*CNIPod) GetNetArgs

func (p *CNIPod) GetNetArgs() [][2]string

func (*CNIPod) GetNetStatus

func (p *CNIPod) GetNetStatus() string

GetNetStatus return network status

func (*CNIPod) GetNetns

func (p *CNIPod) GetNetns() string

GetNetns netns path, format like /proc/$pid/net/netns

func (*CNIPod) GetNetworkName

func (p *CNIPod) GetNetworkName() string

GetNetworkName netns name, like cni name or docker network name

func (*CNIPod) GetPid

func (p *CNIPod) GetPid() int

GetPid get pod pid, in CNIPod, pid come from network container

func (*CNIPod) GetPodID

func (p *CNIPod) GetPodID() string

GetPodID get pod id

func (*CNIPod) GetPodStatus

func (p *CNIPod) GetPodStatus() container.PodStatus

GetPodStatus get pod status. see @PodStatus

func (*CNIPod) Init

func (p *CNIPod) Init() error

Init init pod infrastructure, in cnipod, we need start container by @defaultNetworkImage first. we will create network depend on this cotainer. all other containers will share network info with network container

func (*CNIPod) Injection

func (p *CNIPod) Injection() bool

Injection check ip address is injected

func (*CNIPod) IsHealthy

func (p *CNIPod) IsHealthy() bool

IsHealthy check pod is healthy

func (*CNIPod) SetIPAddr

func (p *CNIPod) SetIPAddr(ip string)

SetIPAddr set ip addr for pod

func (*CNIPod) SetPodID

func (p *CNIPod) SetPodID(ID string)

SetPodID set pod id if needed

func (*CNIPod) Start

func (p *CNIPod) Start() error

Start Starting all containers

func (*CNIPod) Stop

func (p *CNIPod) Stop(graceExit int)

Stop stop all containers

func (*CNIPod) UpdateResources

func (p *CNIPod) UpdateResources(id string, resource *schedTypes.Resource) error

func (*CNIPod) UploadFile

func (p *CNIPod) UploadFile(name, source, dest string) error

UploadFile upload source file to container(name)

Jump to

Keyboard shortcuts

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