builder

package
v0.0.0-...-003c574 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeployVersion = "tencentcloud-deploy-version"
	DeployGroup   = "tencentcloud-deploy-group"
	ServiceGate   = "tencentcloud-service-gate"

	PatchTypeMetaAndTemplate = "meta_template"
	PatchTypeMataAndSelector = "meta_selector"
	PatchTypeTemplate        = "template"
	PatchTypeAll             = "all"

	StrategyRecreate  = "recreate"
	StrategyBlueGreen = "blue-green"
	StrategyCanary    = "canary"
	StrategyOffline   = "offline"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Action string

	// 用户提供参数, 通过环境变量传入
	Username    string
	Password    string
	Certificate string
	Server      string
	Namespace   string

	Services []string
	Replicas int32
	Strategy string
	Image    string

	DeployTarget   string
	DeploymentName string

	// rollback
	FromDeployTarget   string
	FromDeploymentName string
	ToDeployTarget     string
	ToDeploymentName   string

	DeployGroup string

	// ScaleStep int64
	ScaleTo   *int32
	ScaleUp   *int32
	ScaleDown *int32

	ShrinkTo     int64
	AutoDeletion bool
	// contains filtered or unexported fields
}

Builder is

func NewBuilder

func NewBuilder(envs map[string]string) (*Builder, error)

NewBuilder is

func (*Builder) Run

func (b *Builder) Run() error

type CMD

type CMD struct {
	Command []string // cmd with args
	WorkDir string
}

func (CMD) Run

func (c CMD) Run() (string, error)

type Cluster

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

func NewCluster

func NewCluster(configPath, context, ns string) (*Cluster, error)

func (*Cluster) AddLabelsToDeployment

func (c *Cluster) AddLabelsToDeployment(dm *extv1beta1.Deployment, labels, patchType string) error

func (*Cluster) AddLabelsToPod

func (c *Cluster) AddLabelsToPod(pod *apiv1.Pod, labels string) error

func (*Cluster) AddLabelsToReplicaSet

func (c *Cluster) AddLabelsToReplicaSet(rs *extv1beta1.ReplicaSet, labels string, effectSubResources bool, patchType string) error

func (*Cluster) CloneDeployment

func (c *Cluster) CloneDeployment(info *DeployInfo) (*extv1beta1.Deployment, error)

func (*Cluster) CreateDeployment

func (c *Cluster) CreateDeployment(dm *extv1beta1.Deployment) error

func (*Cluster) CreateReplicaSet

func (c *Cluster) CreateReplicaSet(rs *extv1beta1.ReplicaSet) (*extv1beta1.ReplicaSet, error)

func (*Cluster) DeleteDeployment

func (c *Cluster) DeleteDeployment(dm *extv1beta1.Deployment) error

func (*Cluster) Deploy

func (c *Cluster) Deploy(info *DeployInfo) (*extv1beta1.Deployment, error)

TODO 处理默认策略

func (*Cluster) DisableDeploymentAllTraffic

func (c *Cluster) DisableDeploymentAllTraffic(dm *extv1beta1.Deployment) error

func (*Cluster) DisablePodTraffic

func (c *Cluster) DisablePodTraffic(pod *apiv1.Pod, serviceName string) error

func (*Cluster) EnableDeploymentAllTraffic

func (c *Cluster) EnableDeploymentAllTraffic(dm *extv1beta1.Deployment) error

func (*Cluster) EnablePodTraffic

func (c *Cluster) EnablePodTraffic(pod *apiv1.Pod, serviceName string) error

func (*Cluster) GetDeployment

func (c *Cluster) GetDeployment(name string) (*extv1beta1.Deployment, error)

func (*Cluster) GetDeploymentByDeployGroup

func (c *Cluster) GetDeploymentByDeployGroup(dgName, target string) (dm *extv1beta1.Deployment, err error)

func (*Cluster) GetDeploymentVersion

func (c *Cluster) GetDeploymentVersion(dm *extv1beta1.Deployment) (int64, error)

func (*Cluster) GetPod

func (c *Cluster) GetPod(podName string) (*apiv1.Pod, error)

func (*Cluster) GetReplicaSet

func (c *Cluster) GetReplicaSet(name string) (*extv1beta1.ReplicaSet, error)

replicaSet

func (*Cluster) GetService

func (c *Cluster) GetService(name string) (*apiv1.Service, error)

service

func (*Cluster) InitService

func (c *Cluster) InitService(svc *apiv1.Service) (*apiv1.Service, error)

func (*Cluster) ListAllDeploymentsByDeployGroup

func (c *Cluster) ListAllDeploymentsByDeployGroup(deployGroup string) (dmList DeploymentList, err error)

func (*Cluster) ListDeployments

func (c *Cluster) ListDeployments(selector string) (*extv1beta1.DeploymentList, error)

func (*Cluster) ListPods

func (c *Cluster) ListPods(selector string) (*apiv1.PodList, error)

func (*Cluster) ListReplicaSets

func (c *Cluster) ListReplicaSets(labelSelector string) (*extv1beta1.ReplicaSetList, error)

func (*Cluster) PauseDeployment

func (c *Cluster) PauseDeployment(dm *extv1beta1.Deployment) error

func (*Cluster) ResumeDeployment

func (c *Cluster) ResumeDeployment(dm *extv1beta1.Deployment) error

func (*Cluster) RollbackDeployment

func (c *Cluster) RollbackDeployment(fromDm, toDm *extv1beta1.Deployment) error

func (*Cluster) ScaleDeployment

func (c *Cluster) ScaleDeployment(dm *extv1beta1.Deployment, scaleTo int32, autoDeletion bool) error

func (*Cluster) TryInitDeployment

func (c *Cluster) TryInitDeployment(dm *extv1beta1.Deployment, deployGroup string, services []string) error

初始化遗留部署

type DeployInfo

type DeployInfo struct {
	Strategy    string
	Template    *extv1beta1.Deployment
	DeployGroup string
	Services    []string
	Image       string
	Replicas    int32

	Version *int64
	Name    string
}

func (*DeployInfo) String

func (info *DeployInfo) String() string

type DeploymentList

type DeploymentList []*extv1beta1.Deployment

func (DeploymentList) Len

func (dl DeploymentList) Len() int

func (DeploymentList) Less

func (dl DeploymentList) Less(i, j int) bool

func (DeploymentList) Swap

func (dl DeploymentList) Swap(i, j int)

Jump to

Keyboard shortcuts

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