cmd

package
v0.0.0-...-073d460 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CtState map[string]string

容器的运行状态

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GenCtState

func GenCtState(endpoints []Endpoint) error

func GetPorts

func GetPorts(ports string) (string, string)

func GetRandomPort

func GetRandomPort() string

func MakeEdName

func MakeEdName(edName string) string

func MakeEnvDeployName

func MakeEnvDeployName(env string) string

func MakeEnvName

func MakeEnvName(env string) string

func MakeRange

func MakeRange(min, max int) []int

func RandomSl

func RandomSl(n int, sl []int) []int

func ReadToken

func ReadToken() string

func UpdateGwx

func UpdateGwx(svcName string, nodes []string, gwEnv string) error

func WriteToken

func WriteToken(token string) error

Types

type Container

type Container struct {
	ID    string
	Image string
	State string
	Ports []cPort
	Names []string
}

Container is a Docker container

type Endpoint

type Endpoint struct {
	ID         int
	Name       string
	Containers []Container
	Networks   []Network
	Services   []Service
	Tasks      []Task
	Nodes      []Node
}

Endpoint is a Docker Swarm endpoint

type Network

type Network struct {
	Attachable bool
	Created    string
	ID         string
	Internal   bool
	Name       string
}

Network is a Docker network

type Node

type Node struct {
	ID   string
	Spec struct {
		Role         string
		Availability string
	}
	Description struct {
		Hostname string
	}
	Status struct {
		State string
		Addr  string
	}
	ManagerStatus struct {
		Reachability string
		Addr         string
	}
}

Node is a Docker Swarm node (manager or worker)

type Portainer

type Portainer struct {
	URL string

	Endpoints []Endpoint
	// contains filtered or unexported fields
}

Portainer is an instance of Portainer

func NewPortainer

func NewPortainer() Portainer

NewPortainer returns a new Portainer instance

func (*Portainer) CreateCt

func (p *Portainer) CreateCt(eId int, imgName string, cName string, cPort string,
	hostPort string) (string, error)

func (*Portainer) DeployCt

func (p *Portainer) DeployCt(eId int, cName string, imgName string, cPort string,
	hostPort string, esName string) string

func (Portainer) Post

func (p Portainer) Post(data map[string]interface{}, path string) bool

func (*Portainer) PullImage

func (p *Portainer) PullImage(eId int, imageName string) bool

func (*Portainer) RmCt

func (p *Portainer) RmCt(eId int, cName string)

func (*Portainer) StartCt

func (p *Portainer) StartCt(eId int, cId string, esName string) bool

func (*Portainer) StopCt

func (p *Portainer) StopCt()

type Scale

type Scale struct {
	// 策略种类,  随机, 均衡等
	Strategy string
}

func (*Scale) Random

func (s *Scale) Random(scaleNum int, esLen int) []int

type Scalex

type Scalex interface {
	Random(scaleNum int, esLen int) []int
}

type Service

type Service struct {
	ID      string
	Version struct {
		Index int
	}
	Spec struct {
		Name string
		Mode struct {
			Replicated struct {
				Replicas int
			}
			Global string
		}
		Labels       map[string]string
		TaskTemplate struct {
			ContainerSpec struct {
				Env []string
			}
		}
	}
}

Service is a Docker service

type Task

type Task struct {
	Name      string
	ServiceID string
	NodeID    string
	Status    struct {
		State   string
		Message string
	}
	DesiredState string
}

Task is a Docker task

Jump to

Keyboard shortcuts

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