container

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAllContaienrUnderSvc

func DeleteAllContaienrUnderSvc(svcname, namespace string) (err error)

DeleteAllContaienrUnderSvc 删除指定服务下面的所有容器

func DeleteContainerByName

func DeleteContainerByName(conname, svcname, namespace string) (err error)

DeleteContainerByName 根据名称删除容器配置信息 conname 容器名称 svcname 服务名称 namespace 命名空间名称

func SaveContainer

func SaveContainer(con *Container) (err error)

func UpgradeContaienrByName

func UpgradeContaienrByName(con *Container) (err error)

UpgradeContaienrByName 升级容器配置信息 con 容器配置指针

func UpgradeContainerNetByName

func UpgradeContainerNetByName(conname, svcname, namespace string, net []NetConfigure) (isChange bool, err error)

UpgradeContainerNetByName 更新容器的网络配置信息 conname 容器名称 svcname 服务名称 namespace 命名空间名称 net 网络配置数据 如果网络数据发生变化,则isChange为true,反之为false

Types

type Container

type Container struct {
	ID   bson.ObjectId     `json:"id,omitempty" bson:"_id,omitempty"`
	Name string            `json:"name"`
	Img  string            `json:"img"`
	Cmd  []string          `json:"cmd"`
	Env  map[string]string `json:"env"`
	Svc  string            `json:"svc"`
	Nsme string            `json:"namespace"`
	Idx  int               `json:"idx"`
	Net  []NetConfigure    `json:"net"`
	Port []int             `json:"port"`
}

func GetAllContainersBySvc

func GetAllContainersBySvc(svc, namespace string) (cons []Container, err error)

GetAllContainersBySvc 获取指定服务下面所有的容器数据 svcname 服务名称 namespace 命名空间名称

func GetContainerByName

func GetContainerByName(conname, svcname, namespace string) (con *Container, err error)

GetContainerByName 根据名称获取容器配置信息 conname 容器名称 svcname 服务名称 namespace 命名空间名称

func (*Container) ToString

func (c *Container) ToString() (out string)

type NetConfigure

type NetConfigure struct {
	AccessType int `json:"access_type"`
	InPort     int `json:"in_port"`
	OutPort    int `json:"out_port"`
	Protocol   int `json:"protocol"`
}

NetConfigure 服务配置信息 accessType 默认为ClusterIP:

0 - ClusterIP
1 - LoadBalancer
2 - SvcLBTypeInner

Inport 容器监听端口 Outport 负载监听端口 protocol 协议类型 默认为TCP

0 - TCP
1 - UDP

func (*NetConfigure) ToString

func (net *NetConfigure) ToString() (out string)

Jump to

Keyboard shortcuts

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