svcconf

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNetconifg

func GenerateNetconifg(scf *SvcConf) (err error)

GenerateNetconifg 重建服务的网络配置信息

func MergerSvc added in v0.6.5

func MergerSvc(oldSvc, newSvc *SvcConf)

func SaveSvcConf

func SaveSvcConf(scf *SvcConf) error

func UpdateSvcConf

func UpdateSvcConf(scf *SvcConf) error

Types

type LoadBlance

type LoadBlance struct {
	IP   string `json:"ip"`
	Port []int  `json:"port"`
}

LoadBlance 负载均衡数据

func (*LoadBlance) ToString

func (lb *LoadBlance) ToString() (out string)

type SvcConf

type SvcConf struct {
	Id            bson.ObjectId            `json:"id,omitempty" bson:"_id,omitempty"`
	Name          string                   `json:"name"`
	Desc          string                   `json:"desc"`
	SvcName       string                   `json:"svc_name"`     // 在K8s中的服务名
	SvcNameBak    map[string]LoadBlance    `json:"svc_name_bak"` // 升级过程中的备份服务名
	Replicas      int                      `json:"replicas"`
	Namespace     string                   `json:"namespace"`
	Netconf       []container.NetConfigure `json:"netconf"`
	Status        int                      `json:"status"` // 0 - 处理成功 1 - 准备解析网络配置 2 - 开始解析网络配置 3 - 网络解析配置失败
	Msg           string                   `json:"msg"`
	Deploy        int                      `json:"deploy"` // 0 - 未部署 1 - 部署成功 2 - 部署中 3 - 蓝绿部署中 4 - 部署失败 5-滚动部署部分完成 6 - 数据同步 7-回滚中 8-升级确认中
	Instance      []SvcInstance            `json:"instance"`
	LbConfig      LoadBlance               `json:"lb_config"`
	BackID        string                   `json:"back_id"`
	BackContainer []container.Container    `json:"back_container,omitempty"`
}

SvcConf 服务配置信息 默认情况下Replicas为2

func Conver

func Conver(conf interface{}) (c *SvcConf, err error)

func GetSvcConfByID

func GetSvcConfByID(id string) (*SvcConf, error)

func GetSvcConfByName

func GetSvcConfByName(svcname, namespace string) (scf *SvcConf, err error)

func (*SvcConf) BackupSvcConf

func (sc *SvcConf) BackupSvcConf() error

BackupSvcConf 备份服务配置

func (*SvcConf) Copy

func (scf *SvcConf) Copy(tcp *SvcConf)

将当前结构体的数据复制给tcp

func (*SvcConf) CountInstances

func (sc *SvcConf) CountInstances(scope float64) ([]string, []string, int)

CountInstances 计算本次需要升级实例名称 返回挑选出来需要升级的实例名称,同时返回剩余可以用于升级的实例个数 在更新Service—Config状态时需要同时知道哪些Instance是本次升级的,哪些Instance是本次挑选时落选的,因此把落选Instance一并返回

func (*SvcConf) DeleteMySelf

func (sc *SvcConf) DeleteMySelf() (err error)

func (*SvcConf) GetBackSvcConf

func (sc *SvcConf) GetBackSvcConf() (bsc *SvcConf, err error)

GetBackSvcConf 取回备份配置

func (*SvcConf) ToString

func (scf *SvcConf) ToString() (out string)

ToString 格式化输出结构体内容

type SvcConfGroup

type SvcConfGroup struct {
	Id        bson.ObjectId  `json:"id,omitempty" bson:"_id,omitempty"`
	SvcGroup  map[string]int `json:"svc_group"`
	Namespace string         `json:"namespace"`
	Clusterid string         `json:"clusterid"`
	Name      string         `json:"name"`
}

SvcConfGroup 服务群组配置信息 作为自己的软服务编排(以业务场景为主,进行的服务编排.不依赖于k8s的服务编排)

func Unmarshal

func Unmarshal(scg interface{}) (nscf SvcConfGroup, err error)

type SvcInstance

type SvcInstance struct {
	Name   string `json:"name"`   //服务名称. 此名称对应的是K8s中的服务实例名
	Status int    `json:"status"` //服务当前状态. 0 - 未部署 1 - 部署成功 2 - 部署中 3 - 部署失败 4 - 滚动部署中
	Msg    string `json:"msg"`
}

SvcInstance 服务实例信息 用于蓝绿发布/金丝雀发布

func (*SvcInstance) ToString

func (sis *SvcInstance) ToString() (out string)

Jump to

Keyboard shortcuts

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