Documentation ¶
Index ¶
- Constants
- Variables
- func FullStateString(state *types.ContainerState) string
- func GetAvailabilityText(availability Availability) string
- func GetStateText(state EngineState) string
- func MatchConstraints(constraints []Constraint, engine *Engine) bool
- func ShortContainerID(containerid string) string
- func StateString(state *types.ContainerState) string
- type Availability
- type Client
- func (client *Client) Close()
- func (client *Client) CreateContainerRequest(ctx context.Context, config models.Container) (*ctypes.CreateContainerResponse, error)
- func (client *Client) GetContainerRequest(ctx context.Context, containerid string) (*types.ContainerJSON, error)
- func (client *Client) GetContainersRequest(ctx context.Context) ([]types.Container, error)
- func (client *Client) GetDockerInfoRequest(ctx context.Context) (*types.Info, error)
- func (client *Client) OperateContainerRequest(ctx context.Context, operate models.ContainerOperate) error
- func (client *Client) RemoveContainerRequest(ctx context.Context, containerid string) error
- func (client *Client) UpgradeContainerRequest(ctx context.Context, operate models.ContainerOperate) (*ctypes.UpgradeContainerResponse, error)
- type Cluster
- func (cluster *Cluster) CreateContainers(groupid string, instances int, webhooks types.WebHooks, ...) (string, *types.CreatedContainers, error)
- func (cluster *Cluster) GetEngine(ip string) *Engine
- func (cluster *Cluster) GetEngineGroups(engine *Engine) []*Group
- func (cluster *Cluster) GetGroup(groupid string) *Group
- func (cluster *Cluster) GetGroupAllContainers(groupid string) *types.GroupContainers
- func (cluster *Cluster) GetGroupAllEngines(groupid string) []*Engine
- func (cluster *Cluster) GetGroupContainers(metaid string) *types.GroupContainer
- func (cluster *Cluster) GetGroupEngines(groupid string) []*Engine
- func (cluster *Cluster) GetGroups() []*Group
- func (cluster *Cluster) GetMetaBase(metaid string) *MetaBase
- func (cluster *Cluster) GetMetaData(metaid string) *MetaData
- func (cluster *Cluster) GetMetaDataEngines(metaid string) (*MetaData, []*Engine, error)
- func (cluster *Cluster) GetMetaEnginesContainers(metaData *MetaData, metaEngines map[string]*Engine) *types.GroupContainer
- func (cluster *Cluster) GetServerOfEngines(server Server) *Engine
- func (cluster *Cluster) InGroupsContains(ip string, name string) bool
- func (cluster *Cluster) NotifyGroupEnginesWatchEvent(description string, watchEngines WatchEngines)
- func (cluster *Cluster) NotifyGroupMetaContainersEvent(description string, exception error, metaid string)
- func (cluster *Cluster) OperateContainer(containerid string, action string) (string, *types.OperatedContainers, error)
- func (cluster *Cluster) OperateContainers(metaid string, containerid string, action string) (*types.OperatedContainers, error)
- func (cluster *Cluster) RecoveryContainers(metaid string) error
- func (cluster *Cluster) RefreshEnginesContainers(metaEngines map[string]*Engine)
- func (cluster *Cluster) RemoveContainer(containerid string) (string, *types.RemovedContainers, error)
- func (cluster *Cluster) RemoveContainers(metaid string, containerid string) (*types.RemovedContainers, error)
- func (cluster *Cluster) RemoveContainersOfMetaName(groupid string, metaname string) (string, *types.RemovedContainers, error)
- func (cluster *Cluster) RemoveGroup(groupid string) bool
- func (cluster *Cluster) SetGroup(group *Group)
- func (cluster *Cluster) SetServerNodeLabels(server Server, labels map[string]string) error
- func (cluster *Cluster) Start() error
- func (cluster *Cluster) Stop()
- func (cluster *Cluster) UpdateContainers(metaid string, instances int, webhooks types.WebHooks, ...) (*types.CreatedContainers, error)
- func (cluster *Cluster) UpgradeContainers(metaid string, imagetag string) (*types.UpgradeContainers, error)
- type Constraint
- type Container
- type ContainerBaseConfig
- type ContainerConfig
- type Containers
- type ContainersConfigCache
- func (cache *ContainersConfigCache) ClearContainerBaseConfig(metaid string)
- func (cache *ContainersConfigCache) ContainsMetaData(groupid string, name string) bool
- func (cache *ContainersConfigCache) CreateContainerBaseConfig(metaid string, baseConfig *ContainerBaseConfig)
- func (cache *ContainersConfigCache) CreateMetaData(groupid string, instances int, webhooks types.WebHooks, ...) (*MetaData, error)
- func (cache *ContainersConfigCache) GetContainerBaseConfig(metaid string, containerid string) *ContainerBaseConfig
- func (cache *ContainersConfigCache) GetGroupMetaData(groupid string) []*MetaData
- func (cache *ContainersConfigCache) GetMetaData(metaid string) *MetaData
- func (cache *ContainersConfigCache) GetMetaDataBaseConfigs(metaid string) []*ContainerBaseConfig
- func (cache *ContainersConfigCache) GetMetaDataBaseConfigsCount(metaid string) int
- func (cache *ContainersConfigCache) GetMetaDataOfContainer(containerid string) *MetaData
- func (cache *ContainersConfigCache) GetMetaDataOfName(groupid string, name string) *MetaData
- func (cache *ContainersConfigCache) Init()
- func (cache *ContainersConfigCache) MakeContainerIdleIndex(metaid string) int
- func (cache *ContainersConfigCache) MakeUniqueMetaID() string
- func (cache *ContainersConfigCache) RemoveContainerBaseConfig(metaid string, containerid string)
- func (cache *ContainersConfigCache) RemoveGroupMetaData(groupid string) bool
- func (cache *ContainersConfigCache) RemoveMetaData(metaid string) bool
- func (cache *ContainersConfigCache) SetAvailableNodesChanged(metaid string, changed bool)
- func (cache *ContainersConfigCache) SetImageTag(metaid string, imagetag string) bool
- func (cache *ContainersConfigCache) SetMetaData(metaid string, instances int, webhooks types.WebHooks, ...)
- type Engine
- func (engine *Engine) Close()
- func (engine *Engine) Container(containerid string) *Container
- func (engine *Engine) Containers(metaid string) Containers
- func (engine *Engine) CreateContainer(config models.Container) (*Container, error)
- func (engine *Engine) EngineLabelsPairs() map[string]string
- func (engine *Engine) ForceUpgradeContainer(operate models.ContainerOperate) (*Container, error)
- func (engine *Engine) HasContainer(containerid string) bool
- func (engine *Engine) HasMeta(metaid string) bool
- func (engine *Engine) IsDisconnected() bool
- func (engine *Engine) IsHealthy() bool
- func (engine *Engine) IsPending() bool
- func (engine *Engine) MetaIds() []string
- func (engine *Engine) NodeLabelsPairs() map[string]string
- func (engine *Engine) Open()
- func (engine *Engine) OperateContainer(operate models.ContainerOperate) error
- func (engine *Engine) RefreshContainers() error
- func (engine *Engine) RemoveContainer(containerid string) error
- func (engine *Engine) SetNodeLabelsPairs(labels map[string]string)
- func (engine *Engine) SetState(state EngineState)
- func (engine *Engine) State() string
- func (engine *Engine) TotalCpus() int64
- func (engine *Engine) TotalMemory() int64
- func (engine *Engine) Update(nodeData *types.NodeData)
- func (engine *Engine) UpgradeContainer(operate models.ContainerOperate) (*Container, error)
- func (engine *Engine) UsedCpus() int64
- func (engine *Engine) UsedMemory() int64
- func (engine *Engine) ValidateContainers()
- type EnginePriorities
- type EngineState
- type EnginesFilter
- func (filter *EnginesFilter) AllocEngines() []*Engine
- func (filter *EnginesFilter) FailEngines() []*Engine
- func (filter *EnginesFilter) Filter(engines []*Engine) []*Engine
- func (filter *EnginesFilter) SetAllocEngine(engine *Engine)
- func (filter *EnginesFilter) SetFailEngine(engine *Engine)
- func (filter *EnginesFilter) Size() int
- type EnginesPool
- type Group
- type Hook
- type HookContainer
- type HookContainers
- type HookEvent
- type HooksProcessor
- type MetaBase
- type MetaData
- type MigrateContainer
- type MigrateContainersCache
- func (cache *MigrateContainersCache) Cancel(engine *Engine)
- func (cache *MigrateContainersCache) Contains(metaid string) bool
- func (cache *MigrateContainersCache) OnMigratorNotifyHandleFunc(migrator *Migrator, err error)
- func (cache *MigrateContainersCache) OnMigratorQuitHandleFunc(migrator *Migrator)
- func (cache *MigrateContainersCache) RemoveGroup(groupid string)
- func (cache *MigrateContainersCache) SetCluster(cluster *Cluster)
- func (cache *MigrateContainersCache) Start(engine *Engine)
- type MigrateState
- type Migrator
- func (migrator *Migrator) Cancel(metaid string, containers Containers)
- func (migrator *Migrator) Clear()
- func (migrator *Migrator) Container(containerid string) *MigrateContainer
- func (migrator *Migrator) Containers() []*MigrateContainer
- func (migrator *Migrator) Start()
- func (migrator *Migrator) Update(metaid string, containers Containers)
- type MigratorHandler
- type MigratorNotifyHandleFunc
- type MigratorQuitHandleFunc
- type ReduceEngine
- type RemoveContainer
- type RemovePool
- type Server
- type SortContainerBaseConfigs
- type UpgradeContainer
- type UpgradeContainersCache
- func (cache *UpgradeContainersCache) Contains(metaid string) bool
- func (cache *UpgradeContainersCache) SetCluster(cluster *Cluster)
- func (cache *UpgradeContainersCache) Upgrade(upgradeCh chan<- bool, metaid string, newTag string, containers Containers)
- func (cache *UpgradeContainersCache) UpgraderHandleFunc(upgrader *Upgrader, errMsgs []string)
- type UpgradeState
- type Upgrader
- type UpgraderHandleFunc
- type WatchEngines
- type WeightedEngine
Constants ¶
const ( // NodeLabelsPrefix is the constraint key prefix for node labels. NodeLabelsPrefix = "node.labels." // EngineLabelsPrefix is the constraint key prefix for engine labels. EngineLabelsPrefix = "engine.labels." )
const ( MigrateReady = iota + 1 Migrating MigrateFailure MigrateCompleted )
const ( // UpgradeReady is exported, engine container upgrade is ready UpgradeReady = iota + 1 // UpgradeIgnore is exported, engine healthy is false, can't upgrade, migrate container. UpgradeIgnore // UpgradeCompleted is exported, engine container upgraded completed. UpgradeCompleted // UpgradeFailure is exported, engine container upgraded failure. UpgradeFailure // UpgradeRecovery is exported, engine container recovery upgraded. UpgradeRecovery )
Variables ¶
var ( //cluster discovery is nil. ErrClusterDiscoveryInvalid = errors.New("cluster discovery invalid") //cluster meta not found ErrClusterMetaDataNotFound = errors.New("cluster metadata not found") //cluster group not found ErrClusterGroupNotFound = errors.New("cluster group not found") //cluster container not found ErrClusterContainerNotFound = errors.New("cluster container not found") //cluster server not found ErrClusterServerNotFound = errors.New("cluster server not found") //cluster group no docker engine available ErrClusterNoEngineAvailable = errors.New("cluster no docker-engine available") //cluster containers instances invalid ErrClusterContainersInstancesInvalid = errors.New("cluster containers instances invalid") //cluster containers meta create failure ErrClusterContainersMetaCreateFailure = errors.New("cluster containers meta create failure") //cluster create containers name conflict ErrClusterCreateContainerNameConflict = errors.New("cluster create containers name conflict, this cluster already exists") //cluster create containers tag already using ErrClusterCreateContainerTagAlreadyUsing = errors.New("cluster create containers tag is already using") //cluster create containers all failure ErrClusterCreateContainerFailure = errors.New("cluster create containers failure") //cluster containers is upgrading ErrClusterContainersUpgrading = errors.New("cluster containers state is upgrading") //cluster containers is migrating ErrClusterContainersMigrating = errors.New("cluster containers state is migrating") //cluster containers is setting ErrClusterContainersSetting = errors.New("cluster containers state is setting") //cluster containers instances no change ErrClusterContainersInstancesNoChange = errors.New("cluster containers instances no change") )
cluster errors define
Functions ¶
func FullStateString ¶
func FullStateString(state *types.ContainerState) string
FullStateString returns readable description of the state
func GetAvailabilityText ¶
func GetAvailabilityText(availability Availability) string
GetAvailabilityText is exported return a availability typed text.
func GetStateText ¶
func GetStateText(state EngineState) string
GetStateText is exported return a state typed text.
func MatchConstraints ¶
func MatchConstraints(constraints []Constraint, engine *Engine) bool
MatchConstraints returns true if the node satisfies the given constraints.
func ShortContainerID ¶
ShortContainerID is exported return a short containerid string.
func StateString ¶
func StateString(state *types.ContainerState) string
StateString returns a single string to describe state
Types ¶
type Availability ¶
type Availability int
Availability define
const ( //Active, accept scheduling service allocations and failover at any time. Active Availability = iota //Pasue, pause node scheduling, node assigned services are not affected, and no fault migration occurs. Pasue //Expel, exclude nodes from the cluster and create all services on that node to other nodes with active availability. Drain )
Engine availability enum value
type Client ¶
type Client struct { ApiAddr string // contains filtered or unexported fields }
Client is exported
func (*Client) CreateContainerRequest ¶
func (client *Client) CreateContainerRequest(ctx context.Context, config models.Container) (*ctypes.CreateContainerResponse, error)
CreateContainerRequest is exported create a container request.
func (*Client) GetContainerRequest ¶
func (client *Client) GetContainerRequest(ctx context.Context, containerid string) (*types.ContainerJSON, error)
GetContainerRequest is exported get a container type info.
func (*Client) GetContainersRequest ¶
GetContainersRequest is exported return all containers info.
func (*Client) GetDockerInfoRequest ¶
GetDockerInfoRequest is exported get docker node info
func (*Client) OperateContainerRequest ¶
func (client *Client) OperateContainerRequest(ctx context.Context, operate models.ContainerOperate) error
OperateContainerRequest is exported operate a container request.
func (*Client) RemoveContainerRequest ¶
RemoveContainerRequest is exported remove a container request.
func (*Client) UpgradeContainerRequest ¶
func (client *Client) UpgradeContainerRequest(ctx context.Context, operate models.ContainerOperate) (*ctypes.UpgradeContainerResponse, error)
UpgradeContainerRequest is exported upgrade a container request.
type Cluster ¶
type Cluster struct { sync.RWMutex Location string NotifySender *notify.NotifySender Discovery *discovery.Discovery // contains filtered or unexported fields }
Cluster is exported
func NewCluster ¶
func NewCluster(driverOpts system.DriverOpts, notifySender *notify.NotifySender, discovery *discovery.Discovery) (*Cluster, error)
NewCluster is exported
func (*Cluster) CreateContainers ¶
func (cluster *Cluster) CreateContainers(groupid string, instances int, webhooks types.WebHooks, placement types.Placement, config models.Container, createOption types.CreateOption) (string, *types.CreatedContainers, error)
CreateContainers is exported
func (*Cluster) GetEngineGroups ¶
GetEngineGroups is exported
func (*Cluster) GetGroupAllContainers ¶
func (cluster *Cluster) GetGroupAllContainers(groupid string) *types.GroupContainers
GetGroupAllContainers is exported
func (*Cluster) GetGroupAllEngines ¶
GetGroupAllEngines is exported Returns all engine under group and contains offline (cluster engines not exists.)
func (*Cluster) GetGroupContainers ¶
func (cluster *Cluster) GetGroupContainers(metaid string) *types.GroupContainer
GetGroupContainers is exported
func (*Cluster) GetGroupEngines ¶
GetGroupEngines is exported Returns pairs engine under group and cluster engines is exists
func (*Cluster) GetMetaBase ¶
GetMetaBase is exported
func (*Cluster) GetMetaData ¶
GetMetaData is exported
func (*Cluster) GetMetaDataEngines ¶
GetMetaDataEngines is exported
func (*Cluster) GetMetaEnginesContainers ¶
func (cluster *Cluster) GetMetaEnginesContainers(metaData *MetaData, metaEngines map[string]*Engine) *types.GroupContainer
GetMetaEnginesContainers is exported
func (*Cluster) GetServerOfEngines ¶
GetServerOfEngines is exported
func (*Cluster) InGroupsContains ¶
InGroupsContains is exported
func (*Cluster) NotifyGroupEnginesWatchEvent ¶
func (cluster *Cluster) NotifyGroupEnginesWatchEvent(description string, watchEngines WatchEngines)
NotifyGroupEnginesWatchEvent is exported
func (*Cluster) NotifyGroupMetaContainersEvent ¶
func (cluster *Cluster) NotifyGroupMetaContainersEvent(description string, exception error, metaid string)
NotifyGroupMetaContainersEvent is exported
func (*Cluster) OperateContainer ¶
func (cluster *Cluster) OperateContainer(containerid string, action string) (string, *types.OperatedContainers, error)
OperateContainer is exported
func (*Cluster) OperateContainers ¶
func (cluster *Cluster) OperateContainers(metaid string, containerid string, action string) (*types.OperatedContainers, error)
OperateContainers is exported if containerid is empty string so operate metaid's all containers
func (*Cluster) RecoveryContainers ¶
RecoveryContainers is exported
func (*Cluster) RefreshEnginesContainers ¶
RefreshEnginesContainers is exported
func (*Cluster) RemoveContainer ¶
func (cluster *Cluster) RemoveContainer(containerid string) (string, *types.RemovedContainers, error)
RemoveContainer is exported
func (*Cluster) RemoveContainers ¶
func (cluster *Cluster) RemoveContainers(metaid string, containerid string) (*types.RemovedContainers, error)
RemoveContainers is exported if containerid is empty string so remove metaid's all containers
func (*Cluster) RemoveContainersOfMetaName ¶
func (cluster *Cluster) RemoveContainersOfMetaName(groupid string, metaname string) (string, *types.RemovedContainers, error)
RemoveContainersOfMetaName is exported remove meta's all containers
func (*Cluster) RemoveGroup ¶
RemoveGroup is exported
func (*Cluster) SetServerNodeLabels ¶
SetServerNodeLabels is exported
func (*Cluster) Start ¶
Start is exported Cluster start, init container config cache watch open discovery service
func (*Cluster) Stop ¶
func (cluster *Cluster) Stop()
Stop is exported Cluster stop close discovery service stop pendEngines loop
func (*Cluster) UpdateContainers ¶
func (cluster *Cluster) UpdateContainers(metaid string, instances int, webhooks types.WebHooks, placement types.Placement, config models.Container, updateOption types.UpdateOption) (*types.CreatedContainers, error)
UpdateContainers is exported
func (*Cluster) UpgradeContainers ¶
func (cluster *Cluster) UpgradeContainers(metaid string, imagetag string) (*types.UpgradeContainers, error)
UpgradeContainers is exported
type Constraint ¶
type Constraint struct {
// contains filtered or unexported fields
}
Constraint defines a constraint.
func ParseConstraints ¶
func ParseConstraints(constraints []string) ([]Constraint, error)
ParseConstraints parses list of constraints.
func (*Constraint) Match ¶
func (c *Constraint) Match(whats ...string) bool
Match checks if the Constraint matches the target strings.
type Container ¶
type Container struct { BaseConfig *ContainerBaseConfig Config *ContainerConfig Info types.ContainerJSON Engine *Engine }
Container is exported
func (*Container) OriginalName ¶
OriginalName is exported Return Container OriginalName
func (*Container) ValidateConfig ¶
ValidateConfig is exported
type ContainerBaseConfig ¶
type ContainerBaseConfig struct { Index int `json:"Index"` models.Container MetaData *MetaData `json:"-"` }
ContainerBaseConfig is exported
type Containers ¶
type Containers []*Container
Containers represents a list of containers
func (Containers) Get ¶
func (containers Containers) Get(IDOrName string) *Container
Get returns a container using its ID or Name
type ContainersConfigCache ¶
type ContainersConfigCache struct { sync.RWMutex Root string // contains filtered or unexported fields }
ContainersConfigCache is exported
func NewContainersConfigCache ¶
func NewContainersConfigCache(root string) (*ContainersConfigCache, error)
NewContainersConfigCache is exported Structure ContainersCache
func (*ContainersConfigCache) ClearContainerBaseConfig ¶
func (cache *ContainersConfigCache) ClearContainerBaseConfig(metaid string)
ClearContainerBaseConfig is exported
func (*ContainersConfigCache) ContainsMetaData ¶
func (cache *ContainersConfigCache) ContainsMetaData(groupid string, name string) bool
ContainsMetaData is exported Return bool, find metadata name
func (*ContainersConfigCache) CreateContainerBaseConfig ¶
func (cache *ContainersConfigCache) CreateContainerBaseConfig(metaid string, baseConfig *ContainerBaseConfig)
CreateContainerBaseConfig is exported
func (*ContainersConfigCache) CreateMetaData ¶
func (cache *ContainersConfigCache) CreateMetaData(groupid string, instances int, webhooks types.WebHooks, placement types.Placement, config models.Container, isremovedelay bool, isrecovery bool) (*MetaData, error)
CreateMetaData is exported
func (*ContainersConfigCache) GetContainerBaseConfig ¶
func (cache *ContainersConfigCache) GetContainerBaseConfig(metaid string, containerid string) *ContainerBaseConfig
GetContainerBaseConfig is exported
func (*ContainersConfigCache) GetGroupMetaData ¶
func (cache *ContainersConfigCache) GetGroupMetaData(groupid string) []*MetaData
GetGroupMetaData is exported
func (*ContainersConfigCache) GetMetaData ¶
func (cache *ContainersConfigCache) GetMetaData(metaid string) *MetaData
GetMetaData is exported Return metaid of a metadata
func (*ContainersConfigCache) GetMetaDataBaseConfigs ¶
func (cache *ContainersConfigCache) GetMetaDataBaseConfigs(metaid string) []*ContainerBaseConfig
GetMetaDataBaseConfigs is exported
func (*ContainersConfigCache) GetMetaDataBaseConfigsCount ¶
func (cache *ContainersConfigCache) GetMetaDataBaseConfigsCount(metaid string) int
GetMetaDataBaseConfigsCount is exported result < 0, not found metadata
func (*ContainersConfigCache) GetMetaDataOfContainer ¶
func (cache *ContainersConfigCache) GetMetaDataOfContainer(containerid string) *MetaData
GetMetaDataOfContainer is exported Return containerid of a metadata
func (*ContainersConfigCache) GetMetaDataOfName ¶
func (cache *ContainersConfigCache) GetMetaDataOfName(groupid string, name string) *MetaData
GetMetaDataOfName is exported Return name of a metadata
func (*ContainersConfigCache) Init ¶
func (cache *ContainersConfigCache) Init()
Init is exported Initialize containers baseConfig, load cache directory's metaData First clear containers cache
func (*ContainersConfigCache) MakeContainerIdleIndex ¶
func (cache *ContainersConfigCache) MakeContainerIdleIndex(metaid string) int
MakeContainerIdleIndex is exported Return a baseContainerConfig idle index
func (*ContainersConfigCache) MakeUniqueMetaID ¶
func (cache *ContainersConfigCache) MakeUniqueMetaID() string
MakeUniqueMetaID is exported Return a new create unique metaid
func (*ContainersConfigCache) RemoveContainerBaseConfig ¶
func (cache *ContainersConfigCache) RemoveContainerBaseConfig(metaid string, containerid string)
RemoveContainerBaseConfig is exported
func (*ContainersConfigCache) RemoveGroupMetaData ¶
func (cache *ContainersConfigCache) RemoveGroupMetaData(groupid string) bool
RemoveGroupMetaData is exported
func (*ContainersConfigCache) RemoveMetaData ¶
func (cache *ContainersConfigCache) RemoveMetaData(metaid string) bool
RemoveMetaData is exported Remove metaid of a metadata
func (*ContainersConfigCache) SetAvailableNodesChanged ¶
func (cache *ContainersConfigCache) SetAvailableNodesChanged(metaid string, changed bool)
SetAvailableNodesChanged is exported
func (*ContainersConfigCache) SetImageTag ¶
func (cache *ContainersConfigCache) SetImageTag(metaid string, imagetag string) bool
SetImageTag is exported Return set tag result
type Engine ¶
type Engine struct { sync.RWMutex ID string `json:"ID"` Name string `json:"Name"` IP string `json:"IP"` APIAddr string `json:"APIAddr"` Cpus int64 `json:"Cpus"` Memory int64 `json:"Memory"` StorageDirver string `json:"StorageDirver"` KernelVersion string `json:"KernelVersion"` Architecture string `json:"Architecture"` OperatingSystem string `json:"OperatingSystem"` OSType string `json:"OSType"` EngineLabels map[string]string `json:"EngineLabels"` NodeLabels map[string]string `json:"NodeLabels"` AppVersion string `json:"AppVersion"` DockerVersion string `json:"DockerVersion"` AvailabilityText string `json:"AvailabilityText"` StateText string `json:"StateText"` // contains filtered or unexported fields }
Engine is exported
func NewEngine ¶
func NewEngine(nodeData *types.NodeData, overcommitRatio float64, removeDelay time.Duration, configCache *ContainersConfigCache) (*Engine, error)
NewEngine is exported
func NewWatchEngine ¶
func NewWatchEngine(ip string, name string, state EngineState) *Engine
NewWatchEngine is exported
func (*Engine) Close ¶
func (engine *Engine) Close()
Close is exported Engine stop refresh containers loop
func (*Engine) Containers ¶
func (engine *Engine) Containers(metaid string) Containers
Containers is exported Return engine containers. if metaid is empty string so return engine's all containers
func (*Engine) CreateContainer ¶
CreateContainer is exported Engine create a container
func (*Engine) EngineLabelsPairs ¶
EngineLabelsPairs is exported
func (*Engine) ForceUpgradeContainer ¶
func (engine *Engine) ForceUpgradeContainer(operate models.ContainerOperate) (*Container, error)
ForceUpgradeContainer is exported Engine force upgrade a container.
func (*Engine) HasContainer ¶
HasContainer is exported find containerid in engine containers
func (*Engine) IsDisconnected ¶
IsDisconnected is exported Determine if the engine is in disconnected state
func (*Engine) NodeLabelsPairs ¶
NodeLabelsPairs is exported
func (*Engine) Open ¶
func (engine *Engine) Open()
Open is exported Engine start refresh containers loop
func (*Engine) OperateContainer ¶
func (engine *Engine) OperateContainer(operate models.ContainerOperate) error
OperateContainer is exported Engine operate a container.
func (*Engine) RefreshContainers ¶
RefreshContainers is exported Engine refresh all containers.
func (*Engine) RemoveContainer ¶
RemoveContainer is exported Engine remove a container.
func (*Engine) SetNodeLabelsPairs ¶
SetNodeLabelsPairs is exported
func (*Engine) SetState ¶
func (engine *Engine) SetState(state EngineState)
SetState is exported Set engine state.
func (*Engine) TotalMemory ¶
TotalMemory is exported Return engine total memory size.
func (*Engine) UpgradeContainer ¶
func (engine *Engine) UpgradeContainer(operate models.ContainerOperate) (*Container, error)
UpgradeContainer is exported Engine upgrade a container.
func (*Engine) UsedMemory ¶
UsedMemory is exported Return engine all containers used memory size.
func (*Engine) ValidateContainers ¶
func (engine *Engine) ValidateContainers()
ValidateContainers is exported clear cluster engine invalid containers
type EnginePriorities ¶
EnginePriorities is exported
func NewEnginePriorities ¶
func NewEnginePriorities(metaData *MetaData, engines []*Engine) *EnginePriorities
NewEnginePriorities is exported
func (*EnginePriorities) Add ¶
func (priorities *EnginePriorities) Add(containerid string, engine *Engine)
Add is exported
func (*EnginePriorities) EngineStrings ¶
func (priorities *EnginePriorities) EngineStrings() []string
EngineStrings is exported
func (*EnginePriorities) Remove ¶
func (priorities *EnginePriorities) Remove(containerid string)
Remove is exported
func (*EnginePriorities) Select ¶
func (priorities *EnginePriorities) Select() *Engine
Select is exported
type EngineState ¶
type EngineState int
EngineState define
const ( //StatePending, engine added to cluster engines pool, but not been validated. StatePending EngineState = iota //StateUnhealthy, engine is unreachable. StateUnhealthy //StateHealthy, engine is ready reachable. StateHealthy //StateDisconnected, engine is removed from discovery StateDisconnected )
State enum value
type EnginesFilter ¶
EnginesFilter is exported
func (*EnginesFilter) AllocEngines ¶
func (filter *EnginesFilter) AllocEngines() []*Engine
AllocEngines is exported
func (*EnginesFilter) FailEngines ¶
func (filter *EnginesFilter) FailEngines() []*Engine
FailEngines is exported
func (*EnginesFilter) Filter ¶
func (filter *EnginesFilter) Filter(engines []*Engine) []*Engine
Filter is exported
func (*EnginesFilter) SetAllocEngine ¶
func (filter *EnginesFilter) SetAllocEngine(engine *Engine)
SetAllocEngine is exported
func (*EnginesFilter) SetFailEngine ¶
func (filter *EnginesFilter) SetFailEngine(engine *Engine)
SetFailEngine is exported
type EnginesPool ¶
EnginesPool is exported
func (*EnginesPool) AddEngine ¶
func (pool *EnginesPool) AddEngine(ip string, name string)
AddEngine is exported
func (*EnginesPool) InitEngineNodeLabels ¶
func (pool *EnginesPool) InitEngineNodeLabels(engine *Engine)
InitEngineNodeLabels is exported
func (*EnginesPool) RemoveEngine ¶
func (pool *EnginesPool) RemoveEngine(ip string, name string)
RemoveEngine is exported
func (*EnginesPool) SetCluster ¶
func (pool *EnginesPool) SetCluster(cluster *Cluster)
SetCluster is exported
type Group ¶
type Group struct { ID string `json:"ID"` Name string `json:"Name"` IsCluster bool `json:"IsCluster"` Location string `json:"ClusterLocation"` Servers []Server `json:"Servers"` ContactInfo string `json:"ContactInfo"` }
Group is exported Servers: cluster group's servers. ContactInfo: cluster manager contactinfo.
type Hook ¶
type Hook struct { Timestamp int64 `json:"Timestamp"` Event string `json:"Event"` MetaBase MetaBase `json:"MetaBase"` HookContainers // contains filtered or unexported fields }
Hook is exported
type HookContainer ¶
type HookContainer struct { IP string `json:"IP"` Name string `json:"Name"` Container models.Container `json:"Container"` }
HookContainer is exported
type HooksProcessor ¶
type HooksProcessor struct {
// contains filtered or unexported fields
}
HooksProcessor is exported
func (*HooksProcessor) Close ¶
func (processor *HooksProcessor) Close()
func (*HooksProcessor) Start ¶
func (processor *HooksProcessor) Start()
func (*HooksProcessor) SubmitHook ¶
func (processor *HooksProcessor) SubmitHook(metaBase MetaBase, hookContainers HookContainers, hookEvent HookEvent)
SubmitHook is exported
type MetaBase ¶
type MetaBase struct { GroupID string `json:"GroupId"` MetaID string `json:"MetaId"` IsRemoveDelay bool `json:"IsRemoveDelay"` IsRecovery bool `json:"IsRecovery"` Instances int `json:"Instances"` WebHooks types.WebHooks `json:"WebHooks"` Placement types.Placement `json:"Placement"` ImageTag string `json:"ImageTag"` Config models.Container `json:"Config"` CreateAt int64 `json:"CreateAt"` LastUpdateAt int64 `json:"LastUpdateAt"` AvailableNodesChanged bool `json:"AvailableNodesChanged"` }
MetaBase is exported
type MetaData ¶
type MetaData struct { MetaBase BaseConfigs []*ContainerBaseConfig `json:"BaseConfigs"` }
MetaData is exported
type MigrateContainer ¶
MigrateContainer is exported
func NewMigrateContainer ¶
func NewMigrateContainer(containerid string, baseConfig *ContainerBaseConfig) *MigrateContainer
NewMigrateContainer is exported
func (*MigrateContainer) Execute ¶
func (mContainer *MigrateContainer) Execute(cluster *Cluster)
Execute is exported
func (*MigrateContainer) GetState ¶
func (mContainer *MigrateContainer) GetState() MigrateState
GetState is exported
func (*MigrateContainer) SetState ¶
func (mContainer *MigrateContainer) SetState(state MigrateState)
SetState is exported
type MigrateContainersCache ¶
type MigrateContainersCache struct { sync.RWMutex MigratorHandler Cluster *Cluster // contains filtered or unexported fields }
MigrateContainersCache is exported
func NewMigrateContainersCache ¶
func NewMigrateContainersCache(migrateDelay time.Duration) *MigrateContainersCache
NewMigrateContainersCache is exported
func (*MigrateContainersCache) Cancel ¶
func (cache *MigrateContainersCache) Cancel(engine *Engine)
Cancel is exported engine online, cancel migrate containers of state is MigrateReady. engine parameter is online engine pointer.
func (*MigrateContainersCache) Contains ¶
func (cache *MigrateContainersCache) Contains(metaid string) bool
Contains is exported
func (*MigrateContainersCache) OnMigratorNotifyHandleFunc ¶
func (cache *MigrateContainersCache) OnMigratorNotifyHandleFunc(migrator *Migrator, err error)
OnMigratorNotifyHandleFunc is exported
func (*MigrateContainersCache) OnMigratorQuitHandleFunc ¶
func (cache *MigrateContainersCache) OnMigratorQuitHandleFunc(migrator *Migrator)
OnMigratorQuitHandleFunc is exported
func (*MigrateContainersCache) RemoveGroup ¶
func (cache *MigrateContainersCache) RemoveGroup(groupid string)
RemoveGroup is exported cancel group all metadata migrate.
func (*MigrateContainersCache) SetCluster ¶
func (cache *MigrateContainersCache) SetCluster(cluster *Cluster)
SetCluster is exported
func (*MigrateContainersCache) Start ¶
func (cache *MigrateContainersCache) Start(engine *Engine)
Start is exported engine offline, start migrate containers. engine parameter is offline engine pointer.
type MigrateState ¶
type MigrateState int
MigrateState is exported
func (MigrateState) String ¶
func (state MigrateState) String() string
type Migrator ¶
type Migrator struct { sync.RWMutex MetaID string Cluster *Cluster // contains filtered or unexported fields }
Migrator is exported
func NewMigrator ¶
func NewMigrator(metaid string, containers Containers, cluster *Cluster, migrateDelay time.Duration, handler MigratorHandler) *Migrator
NewMigrator is exported
func (*Migrator) Cancel ¶
func (migrator *Migrator) Cancel(metaid string, containers Containers)
Cancel is exported
func (*Migrator) Container ¶
func (migrator *Migrator) Container(containerid string) *MigrateContainer
Container is exported
func (*Migrator) Containers ¶
func (migrator *Migrator) Containers() []*MigrateContainer
Containers is exported
func (*Migrator) Update ¶
func (migrator *Migrator) Update(metaid string, containers Containers)
Update is exported
type MigratorHandler ¶
type MigratorHandler interface { OnMigratorQuitHandleFunc(migrator *Migrator) OnMigratorNotifyHandleFunc(migrator *Migrator, err error) }
MigratorHandler is exported
type MigratorNotifyHandleFunc ¶
MigratorNotifyHandleFunc is exported
func (MigratorNotifyHandleFunc) OnMigratorNotifyHandleFunc ¶
func (fn MigratorNotifyHandleFunc) OnMigratorNotifyHandleFunc(migrator *Migrator, err error)
OnMigratorNotifyHandleFunc is exported
type MigratorQuitHandleFunc ¶
type MigratorQuitHandleFunc func(migrator *Migrator)
MigratorQuitHandleFunc is exported
func (MigratorQuitHandleFunc) OnMigratorQuitHandleFunc ¶
func (fn MigratorQuitHandleFunc) OnMigratorQuitHandleFunc(migrator *Migrator)
OnMigratorQuitHandleFunc is exported
type ReduceEngine ¶
type ReduceEngine struct {
// contains filtered or unexported fields
}
ReduceEngine is exported
func (*ReduceEngine) Containers ¶
func (reduce *ReduceEngine) Containers() Containers
Containers is exported Return engine's containers of metaid
func (*ReduceEngine) ReduceContainer ¶
func (reduce *ReduceEngine) ReduceContainer() *Container
ReduceContainer is exported
type RemoveContainer ¶
type RemoveContainer struct {
// contains filtered or unexported fields
}
RemoveContainer is exported remove pool container info.
type RemovePool ¶
RemovePool is exported
type SortContainerBaseConfigs ¶
type SortContainerBaseConfigs []*ContainerBaseConfig
SortContainerBaseConfigs is exported
func (SortContainerBaseConfigs) Len ¶
func (containers SortContainerBaseConfigs) Len() int
func (SortContainerBaseConfigs) Less ¶
func (containers SortContainerBaseConfigs) Less(i, j int) bool
func (SortContainerBaseConfigs) Swap ¶
func (containers SortContainerBaseConfigs) Swap(i, j int)
type UpgradeContainer ¶
type UpgradeContainer struct { Original *Container New *Container State UpgradeState }
UpgradeContainer is exported
func (*UpgradeContainer) Execute ¶
func (upgradeContainer *UpgradeContainer) Execute(newImageTag string) error
Execute is exported upgrade originalContainer to image new tag
func (*UpgradeContainer) Recovery ¶
func (upgradeContainer *UpgradeContainer) Recovery(originalImageTag string) error
Recovery is exported upgrade container failure, recovery completed containers to original image tag
type UpgradeContainersCache ¶
type UpgradeContainersCache struct { sync.RWMutex Cluster *Cluster // contains filtered or unexported fields }
UpgradeContainersCache is exported
func NewUpgradeContainersCache ¶
func NewUpgradeContainersCache(upgradeDelay time.Duration) *UpgradeContainersCache
NewUpgradeContainersCache is exported
func (*UpgradeContainersCache) Contains ¶
func (cache *UpgradeContainersCache) Contains(metaid string) bool
Contains is exported
func (*UpgradeContainersCache) SetCluster ¶
func (cache *UpgradeContainersCache) SetCluster(cluster *Cluster)
SetCluster is exported
func (*UpgradeContainersCache) Upgrade ¶
func (cache *UpgradeContainersCache) Upgrade(upgradeCh chan<- bool, metaid string, newTag string, containers Containers)
Upgrade is exported
func (*UpgradeContainersCache) UpgraderHandleFunc ¶
func (cache *UpgradeContainersCache) UpgraderHandleFunc(upgrader *Upgrader, errMsgs []string)
UpgraderHandleFunc is exported
type Upgrader ¶
type Upgrader struct { sync.RWMutex MetaID string OriginalTag string NewTag string // contains filtered or unexported fields }
Upgrader is exported
func NewUpgrader ¶
func NewUpgrader(metaid string, originalTag string, newTag string, containers Containers, upgradeDelay time.Duration, configCache *ContainersConfigCache, callback UpgraderHandleFunc) *Upgrader
NewUpgrader is exported
type UpgraderHandleFunc ¶
UpgraderHandleFunc exported
type WeightedEngine ¶
type WeightedEngine struct {
// contains filtered or unexported fields
}
WeightedEngine is exported
func (*WeightedEngine) Containers ¶
func (weighted *WeightedEngine) Containers() Containers
Containers is exported Return engine's containers