manager_containers

package
v0.0.0-...-5fda629 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MulanPSL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootPath = "supbagent.resource.manager_containers."

	WatchOpCreate = "create"
	WatchOpDelete = "delete"

	MetricsPushOff = "off"
	LogsPushOff    = "off"
	TracePushOff   = "off"

	MetricT = "metric"
	LogT    = "log"
	TraceT  = "trace"

	ApplicationKey = "applicationKey"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerFunctionMap

type ContainerFunctionMap struct {
	LimitationConfig LimitationConfig
	// contains filtered or unexported fields
}

func NewFunctionMap

func NewFunctionMap(ctx context.Context,
	controller *controller.Manager,
	collector *collector.Manager,
	contain *containers.Container,
	nu supbnervous.Controller,
	ids func() []string) (*ContainerFunctionMap, error)

func (*ContainerFunctionMap) GetLimitationConfig

func (r *ContainerFunctionMap) GetLimitationConfig(args ...interface{}) (interface{}, error)

描述: 显示当前的资源限制

error:

eg: r.GetLimitationConfig()

func (*ContainerFunctionMap) ListFunction

func (r *ContainerFunctionMap) ListFunction(arg ...interface{}) (interface{}, error)

func (*ContainerFunctionMap) PushLogsOnOff

func (r *ContainerFunctionMap) PushLogsOnOff(args ...interface{}) (interface{}, error)

func (*ContainerFunctionMap) PushMetricsOnOff

func (r *ContainerFunctionMap) PushMetricsOnOff(args ...interface{}) (interface{}, error)

func (*ContainerFunctionMap) PushTraceOnOff

func (r *ContainerFunctionMap) PushTraceOnOff(args ...interface{}) (interface{}, error)

func (*ContainerFunctionMap) Resume

func (r *ContainerFunctionMap) Resume(arg ...interface{}) (interface{}, error)

func (*ContainerFunctionMap) Run

func (r *ContainerFunctionMap) Run(arg ...interface{}) (interface{}, error)

func (*ContainerFunctionMap) SetCpuRatio

func (r *ContainerFunctionMap) SetCpuRatio(args ...interface{}) (interface{}, error)

描述: 设置容器的时间片占比 ratio float64: [0, 1.]

error:

eg: r.SetCpuRatio(0.5)

func (*ContainerFunctionMap) SetCpuSets

func (r *ContainerFunctionMap) SetCpuSets(args ...interface{}) (interface{}, error)

描述: 设置容器的CPU核心分配 cpuSets string: `0` `0-1` `0,1`

error:

eg: r.SetCpuSets(`0`)

func (*ContainerFunctionMap) SetCpuShares

func (r *ContainerFunctionMap) SetCpuShares(args ...interface{}) (interface{}, error)

描述: 设置容器的shares ratio float64: [0, 1.]

error:

eg: r.SetCpuRatio(0.5)

func (*ContainerFunctionMap) SetNetLatency

func (r *ContainerFunctionMap) SetNetLatency(args ...interface{}) (interface{}, error)

描述: 设置容器的上行网络带宽 latency string: "10ms"

error:

eg: r.SetNetLatency("10ms")

func (*ContainerFunctionMap) SetNetUpstreamBandwidth

func (r *ContainerFunctionMap) SetNetUpstreamBandwidth(args ...interface{}) (interface{}, error)

描述: 设置容器的上行网络带宽 rate string: 10mbit、5kbit

error:

eg: r.SetNetUpstreamBandwidth("10mbit")

func (*ContainerFunctionMap) Stop

func (r *ContainerFunctionMap) Stop(arg ...interface{}) (interface{}, error)

type ContainerManager

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

func NewContainerManager

func NewContainerManager(ctx context.Context, controller *controller.Manager, collector *collector.Manager) (*ContainerManager, error)

func (*ContainerManager) ContainContainer

func (r *ContainerManager) ContainContainer(guid string) bool

func (*ContainerManager) ContainerIds

func (r *ContainerManager) ContainerIds() []string

func (*ContainerManager) CreateContainer

func (r *ContainerManager) CreateContainer(image, containerName, runtime, workDir, imagePullPolicy, hostGuid string, envs, ports, lifecycle, livenessProbe, readinessProbe, reasources, securityContext, volumeMounts map[string]string, cmds, terminationMessagePath, terminationMessagePolicy []string, nu supbnervous.Controller, tags []spongeregister.Tag) (string, error)

描述: 创建容器

error:

eg: r.CreateContainer(...)

func (*ContainerManager) DeleteAllContainers

func (r *ContainerManager) DeleteAllContainers(nu supbnervous.Controller) error

func (*ContainerManager) DeleteContainer

func (r *ContainerManager) DeleteContainer(guid string, nu supbnervous.Controller) error

描述: 删除容器

error:

eg: r.DeleteContainer(...)

func (*ContainerManager) Deploy

func (*ContainerManager) GetContainer

func (r *ContainerManager) GetContainer(guid string) (*containers.Container, error)

func (*ContainerManager) GetContainerLogChan

func (r *ContainerManager) GetContainerLogChan(containerId string) (string, error)

func (*ContainerManager) GetContainerMetricsChan

func (r *ContainerManager) GetContainerMetricsChan(containerId string) (<-chan string, error)

func (*ContainerManager) GetContainerRPCFunctionMap

func (r *ContainerManager) GetContainerRPCFunctionMap(guid string) (map[string]func(args ...interface{}) (interface{}, error), error)

map function name --> function

func (*ContainerManager) GetContainerResource

func (r *ContainerManager) GetContainerResource(guid string) (LimitationConfig, error)

func (*ContainerManager) GetContainerWatcher

func (r *ContainerManager) GetContainerWatcher() <-chan *ContainerWatcher

func (*ContainerManager) GetContainersRPCFunctionMap

func (r *ContainerManager) GetContainersRPCFunctionMap() (map[string]map[string]func(args ...interface{}) (interface{}, error), error)

map guid --> function name --> function

func (*ContainerManager) ListContainers

func (r *ContainerManager) ListContainers() map[string]*containers.Container

func (*ContainerManager) RegisterContainer

func (r *ContainerManager) RegisterContainer(image, containerName, hostGuid string, nu supbnervous.Controller, tags []spongeregister.Tag) (string, error)

描述: 注册容器

error:

eg: r.RegisterContainer(...)

func (*ContainerManager) ResumeContainer

func (r *ContainerManager) ResumeContainer(guid string) error

描述: 恢复容器

error:

eg: r.ResumeContainer(...)

func (*ContainerManager) StopContainer

func (r *ContainerManager) StopContainer(guid string) error

描述: 暂停容器

error:

eg: r.StopContainer(...)

type ContainerWatcher

type ContainerWatcher struct {
	Op   string
	Guid string
}

func (*ContainerWatcher) DeepCopy

func (r *ContainerWatcher) DeepCopy() *ContainerWatcher

type LimitationConfig

type LimitationConfig struct {
	CpuRatio float64

	CpuSets string

	// tc 命令不允许 0 值
	NetUpStreamBandwidth string
	NetLatency           string
	NetBrust             uint32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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