Documentation ¶
Index ¶
- Constants
- Variables
- func CalcNetworkRate(stats [2]*docker.Stats) (rRate, sRate uint64)
- func EncodeRegistryAuth(authInfo *rauth.RegistryAuth) (string, error)
- func GetServicesNamespace(spec swarm.ServiceSpec) string
- func NewGoDockerClientTls(endpoint string, config *config.Config) (*docker.Client, error)
- func NewHttpClient() (*httpclient.Client, error)
- func NewHttpClientTls(config *config.Config) (*httpclient.Client, error)
- func PortConflictToString(pc swarm.PortConfig) string
- func SharedClientCertFiles(config *config.Config) (string, string, string)
- func ToCraneError(err error) error
- func ValidateCraneServiceSpec(spec *model.CraneServiceSpec) error
- type CraneDockerClient
- func (client *CraneDockerClient) CheckServicePortConflicts(spec *model.CraneServiceSpec, serviceId string) error
- func (client *CraneDockerClient) ConnectNetwork(id string, opts docker.NetworkConnectionOptions) error
- func (client *CraneDockerClient) ConnectNodeNetwork(ctx context.Context, networkID string, opts docker.NetworkConnectionOptions) error
- func (client *CraneDockerClient) CreateNetwork(opts docker.CreateNetworkOptions) (*docker.Network, error)
- func (client *CraneDockerClient) CreateNode(joiningNode model.JoiningNode) error
- func (client *CraneDockerClient) CreateNodeNetwork(ctx context.Context, opts docker.CreateNetworkOptions) (*docker.Network, error)
- func (client *CraneDockerClient) CreateService(service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
- func (client *CraneDockerClient) CreateVolume(ctx context.Context, opts docker.CreateVolumeOptions) (*docker.Volume, error)
- func (client *CraneDockerClient) DeployStack(bundle *model.Bundle) error
- func (client *CraneDockerClient) DiffContainer(ctx context.Context, containerID string) ([]docker.Change, error)
- func (client *CraneDockerClient) DisconnectNetwork(id string, opts docker.NetworkConnectionOptions) error
- func (client *CraneDockerClient) DisconnectNodeNetwork(ctx context.Context, networkID string, opts docker.NetworkConnectionOptions) error
- func (client *CraneDockerClient) FilterServiceByStack(namespace string, opts types.ServiceListOptions) ([]swarm.Service, error)
- func (client *CraneDockerClient) GetDaemonUrlById(nodeId string) (*url.URL, error)
- func (client *CraneDockerClient) GetServiceNetworkNames(networkAttachmentConfigs []swarm.NetworkAttachmentConfig) []string
- func (client *CraneDockerClient) GetServicesStatus(services []swarm.Service) ([]ServiceStatus, error)
- func (client *CraneDockerClient) GetStackGroup(bundle *model.Bundle) (uint64, error)
- func (client *CraneDockerClient) ImageHistory(ctx context.Context, imageID string) ([]docker.ImageHistory, error)
- func (client *CraneDockerClient) Info(ctx context.Context) (*docker.DockerInfo, error)
- func (client *CraneDockerClient) InspectContainer(ctx context.Context, id string) (*docker.Container, error)
- func (client *CraneDockerClient) InspectImage(ctx context.Context, imageID string) (*docker.Image, error)
- func (client *CraneDockerClient) InspectNetwork(id string) (*docker.Network, error)
- func (client *CraneDockerClient) InspectNode(nodeId string) (swarm.Node, error)
- func (client *CraneDockerClient) InspectNodeNetwork(ctx context.Context, networkID string) (*docker.Network, error)
- func (client *CraneDockerClient) InspectServiceWithRaw(serviceID string) (swarm.Service, error)
- func (client *CraneDockerClient) InspectStack(namespace string) (*model.Bundle, error)
- func (client *CraneDockerClient) InspectSwarm() (swarm.Swarm, error)
- func (client *CraneDockerClient) InspectTask(taskID string) (*swarm.Task, error)
- func (client *CraneDockerClient) InspectVolume(ctx context.Context, name string) (*docker.Volume, error)
- func (client *CraneDockerClient) KillContainer(ctx context.Context, opts docker.KillContainerOptions) error
- func (client *CraneDockerClient) ListContainers(ctx context.Context, opts docker.ListContainersOptions) ([]docker.APIContainers, error)
- func (client *CraneDockerClient) ListImages(ctx context.Context, opts docker.ListImagesOptions) ([]docker.APIImages, error)
- func (client *CraneDockerClient) ListNetworks(opts docker.NetworkFilterOpts) ([]docker.Network, error)
- func (client *CraneDockerClient) ListNode(opts types.NodeListOptions) ([]swarm.Node, error)
- func (client *CraneDockerClient) ListNodeNetworks(ctx context.Context, opts docker.NetworkFilterOpts) ([]docker.Network, error)
- func (client *CraneDockerClient) ListService(options types.ServiceListOptions) ([]ServiceStatus, error)
- func (client *CraneDockerClient) ListServiceSpec(options types.ServiceListOptions) ([]swarm.Service, error)
- func (client *CraneDockerClient) ListStack() (Stacks, error)
- func (client *CraneDockerClient) ListStackService(namespace string, opts types.ServiceListOptions) ([]ServiceStatus, error)
- func (client *CraneDockerClient) ListTasks(options types.TaskListOptions) (Tasks, error)
- func (client *CraneDockerClient) ListVolumes(ctx context.Context, opts docker.ListVolumesOptions) ([]docker.Volume, error)
- func (client *CraneDockerClient) LogsContainer(ctx context.Context, containerId string, message chan string)
- func (client *CraneDockerClient) ManagerInfo() (types.Info, error)
- func (client *CraneDockerClient) PauseContainer(ctx context.Context, containerID string) error
- func (client *CraneDockerClient) Ping() error
- func (client *CraneDockerClient) PretreatmentStack(bundle model.Bundle) (map[string]bool, error)
- func (client *CraneDockerClient) RemoveContainer(ctx context.Context, opts docker.RemoveContainerOptions) error
- func (client *CraneDockerClient) RemoveImage(ctx context.Context, imageID string) error
- func (client *CraneDockerClient) RemoveNetwork(id string) error
- func (client *CraneDockerClient) RemoveNode(nodeId string) error
- func (client *CraneDockerClient) RemoveService(serviceID string) error
- func (client *CraneDockerClient) RemoveStack(namespace string) error
- func (client *CraneDockerClient) RemoveVolume(ctx context.Context, name string) error
- func (client *CraneDockerClient) RenameContainer(ctx context.Context, opts docker.RenameContainerOptions) error
- func (client *CraneDockerClient) ResizeContainerTTY(ctx context.Context, containerID string, height, width int) error
- func (client *CraneDockerClient) RestartContainer(ctx context.Context, containerId string, timeout uint) error
- func (client *CraneDockerClient) ScaleService(serviceID string, serviceScale ServiceScale) error
- func (client *CraneDockerClient) ServiceAddLabel(serviceID string, labels map[string]string) error
- func (client *CraneDockerClient) ServiceRemoveLabel(serviceID string, labels []string) error
- func (client *CraneDockerClient) StartContainer(ctx context.Context, containerID string, hostconfig *docker.HostConfig) error
- func (client *CraneDockerClient) StatsContainer(ctx context.Context, opts model.ContainerStatOptions) error
- func (client *CraneDockerClient) StopContainer(ctx context.Context, containerId string, timeout uint) error
- func (client *CraneDockerClient) SwarmManager() *docker.Client
- func (client *CraneDockerClient) SwarmNode(ctx context.Context) (*docker.Client, error)
- func (client *CraneDockerClient) ToCraneServiceSpec(swarmService swarm.ServiceSpec) model.CraneServiceSpec
- func (client *CraneDockerClient) UnpauseContainer(ctx context.Context, containerID string) error
- func (client *CraneDockerClient) UpdateNode(node swarm.Node, opts model.UpdateOptions) error
- func (client *CraneDockerClient) UpdateService(serviceID string, version swarm.Version, service swarm.ServiceSpec, ...) error
- func (client *CraneDockerClient) UpdateServiceAutoOption(serviceID string, version swarm.Version, service swarm.ServiceSpec) error
- func (client *CraneDockerClient) VerifyNodeEndpoint(nodeId string, nodeUrl *url.URL) error
- type DockerClientInterface
- type ServiceScale
- type ServiceStatus
- type Stack
- type Stacks
- type Tasks
Constants ¶
const ( SseTypeContainerLogs = "container-logs" SseTypeContainerStats = "container-stats" SseTypeServiceLogs = "service-logs" SseTypeServiceStats = "service-stats" )
sse event type
const ( //Service error code CodeInvalidServiceNanoCPUs = "503-11404" CodeInvalidServiceDelay = "503-11405" CodeInvalidServiceWindow = "503-11406" CodeInvalidServiceEndpoint = "503-11407" CodeInvalidServicePlacement = "503-11408" CodeInvalidServiceMemoryBytes = "503-11409" CodeInvalidServiceUpdateConfig = "503-11410" CodeInvalidServiceSpec = "503-11411" CodeInvalidServiceName = "503-11412" CodeGetServicePortConflictError = "503-11413" // stack error code CodeInvalidStackName = "503-11502" // node error code CodeErrorUpdateNodeMethod = "503-11302" CodeErrorNodeRole = "503-11303" CodeErrorNodeAvailability = "503-11304" CodeGetNodeInfoError = "503-11305" CodeGetNodeAdvertiseAddrError = "503-11307" CodeJoinNodeError = "503-11308" // network error code CodeNetworkPredefined = "403-11206" CodeNetworkInvalid = "400-11207" CodeNetworkOrContainerInvalid = "400-11208" CodeInvalidNetworkName = "503-11209" //Container error code CodePatchContainerParamError = "400-11002" CodePatchContainerMethodUndefined = "400-11003" CodeContainerInvalid = "400-11006" CodeContainerAlreadyRunning = "400-11007" CodeContainerNotRunning = "400-11008" CodeInvalidImageName = "503-11009" //Go docker client error code CodeConnToNodeError = "503-11701" CodeGetNodeEndpointError = "503-11702" CodeNodeEndpointIpMatchError = "503-11703" CodeVerifyNodeEnpointFailed = "503-11704" CodeGetManagerInfoError = "503-11705" //Volume error code CodeInvalidVolumeName = "503-11602" )
const (
LabelRegistryAuth = "crane.reserved.registry.auth"
)
const (
// service running state format string
TaskRunningState = "running"
)
Variables ¶
var (
ErrPermissionNotExists = errors.New("permission not exists")
)
Functions ¶
func CalcNetworkRate ¶
calculate network receive and send rate
func EncodeRegistryAuth ¶ added in v1.0.6
func EncodeRegistryAuth(authInfo *rauth.RegistryAuth) (string, error)
func GetServicesNamespace ¶
func GetServicesNamespace(spec swarm.ServiceSpec) string
func NewGoDockerClientTls ¶
func NewHttpClient ¶
func NewHttpClient() (*httpclient.Client, error)
func NewHttpClientTls ¶
func NewHttpClientTls(config *config.Config) (*httpclient.Client, error)
func PortConflictToString ¶
func PortConflictToString(pc swarm.PortConfig) string
func SharedClientCertFiles ¶
func ToCraneError ¶
func ValidateCraneServiceSpec ¶
func ValidateCraneServiceSpec(spec *model.CraneServiceSpec) error
Types ¶
type CraneDockerClient ¶
type CraneDockerClient struct { DockerClientInterface // contains filtered or unexported fields }
func NewCraneDockerClient ¶
func NewCraneDockerClient(config *config.Config) (*CraneDockerClient, error)
initialize crane docker client
func (*CraneDockerClient) CheckServicePortConflicts ¶
func (client *CraneDockerClient) CheckServicePortConflicts(spec *model.CraneServiceSpec, serviceId string) error
func (*CraneDockerClient) ConnectNetwork ¶
func (client *CraneDockerClient) ConnectNetwork(id string, opts docker.NetworkConnectionOptions) error
func (*CraneDockerClient) ConnectNodeNetwork ¶
func (client *CraneDockerClient) ConnectNodeNetwork(ctx context.Context, networkID string, opts docker.NetworkConnectionOptions) error
func (*CraneDockerClient) CreateNetwork ¶
func (client *CraneDockerClient) CreateNetwork(opts docker.CreateNetworkOptions) (*docker.Network, error)
func (*CraneDockerClient) CreateNode ¶
func (client *CraneDockerClient) CreateNode(joiningNode model.JoiningNode) error
create a new node
func (*CraneDockerClient) CreateNodeNetwork ¶
func (client *CraneDockerClient) CreateNodeNetwork(ctx context.Context, opts docker.CreateNetworkOptions) (*docker.Network, error)
func (*CraneDockerClient) CreateService ¶
func (client *CraneDockerClient) CreateService(service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
ServiceCreate creates a new Service.
func (*CraneDockerClient) CreateVolume ¶
func (client *CraneDockerClient) CreateVolume(ctx context.Context, opts docker.CreateVolumeOptions) (*docker.Volume, error)
func (*CraneDockerClient) DeployStack ¶
func (client *CraneDockerClient) DeployStack(bundle *model.Bundle) error
deploy a new stack
func (*CraneDockerClient) DiffContainer ¶
func (*CraneDockerClient) DisconnectNetwork ¶
func (client *CraneDockerClient) DisconnectNetwork(id string, opts docker.NetworkConnectionOptions) error
func (*CraneDockerClient) DisconnectNodeNetwork ¶
func (client *CraneDockerClient) DisconnectNodeNetwork(ctx context.Context, networkID string, opts docker.NetworkConnectionOptions) error
func (*CraneDockerClient) FilterServiceByStack ¶
func (client *CraneDockerClient) FilterServiceByStack(namespace string, opts types.ServiceListOptions) ([]swarm.Service, error)
filter service by stack name
func (*CraneDockerClient) GetDaemonUrlById ¶
func (client *CraneDockerClient) GetDaemonUrlById(nodeId string) (*url.URL, error)
func (*CraneDockerClient) GetServiceNetworkNames ¶
func (client *CraneDockerClient) GetServiceNetworkNames(networkAttachmentConfigs []swarm.NetworkAttachmentConfig) []string
func (*CraneDockerClient) GetServicesStatus ¶
func (client *CraneDockerClient) GetServicesStatus(services []swarm.Service) ([]ServiceStatus, error)
GetServicesStatus list services running status
func (*CraneDockerClient) GetStackGroup ¶
func (client *CraneDockerClient) GetStackGroup(bundle *model.Bundle) (uint64, error)
func (*CraneDockerClient) ImageHistory ¶
func (client *CraneDockerClient) ImageHistory(ctx context.Context, imageID string) ([]docker.ImageHistory, error)
func (*CraneDockerClient) Info ¶
func (client *CraneDockerClient) Info(ctx context.Context) (*docker.DockerInfo, error)
docker info
func (*CraneDockerClient) InspectContainer ¶
func (*CraneDockerClient) InspectImage ¶
func (*CraneDockerClient) InspectNetwork ¶
func (client *CraneDockerClient) InspectNetwork(id string) (*docker.Network, error)
func (*CraneDockerClient) InspectNode ¶
func (client *CraneDockerClient) InspectNode(nodeId string) (swarm.Node, error)
Inspect node returns the single node.
func (*CraneDockerClient) InspectNodeNetwork ¶
func (*CraneDockerClient) InspectServiceWithRaw ¶
func (client *CraneDockerClient) InspectServiceWithRaw(serviceID string) (swarm.Service, error)
InspectServiceWithRaw returns the service information and the raw data.
func (*CraneDockerClient) InspectStack ¶
func (client *CraneDockerClient) InspectStack(namespace string) (*model.Bundle, error)
Inspect stack get stack info
func (*CraneDockerClient) InspectSwarm ¶
func (client *CraneDockerClient) InspectSwarm() (swarm.Swarm, error)
Inspect swarm cluster returns the swarm info
func (*CraneDockerClient) InspectTask ¶
func (client *CraneDockerClient) InspectTask(taskID string) (*swarm.Task, error)
TaskInspect returns the list of tasks.
func (*CraneDockerClient) InspectVolume ¶
func (*CraneDockerClient) KillContainer ¶
func (client *CraneDockerClient) KillContainer(ctx context.Context, opts docker.KillContainerOptions) error
func (*CraneDockerClient) ListContainers ¶
func (client *CraneDockerClient) ListContainers(ctx context.Context, opts docker.ListContainersOptions) ([]docker.APIContainers, error)
func (*CraneDockerClient) ListImages ¶
func (client *CraneDockerClient) ListImages(ctx context.Context, opts docker.ListImagesOptions) ([]docker.APIImages, error)
func (*CraneDockerClient) ListNetworks ¶
func (client *CraneDockerClient) ListNetworks(opts docker.NetworkFilterOpts) ([]docker.Network, error)
func (*CraneDockerClient) ListNode ¶
func (client *CraneDockerClient) ListNode(opts types.NodeListOptions) ([]swarm.Node, error)
NodeList returns the list of nodes.
func (*CraneDockerClient) ListNodeNetworks ¶
func (client *CraneDockerClient) ListNodeNetworks(ctx context.Context, opts docker.NetworkFilterOpts) ([]docker.Network, error)
func (*CraneDockerClient) ListService ¶
func (client *CraneDockerClient) ListService(options types.ServiceListOptions) ([]ServiceStatus, error)
ListService return the list of service staus and core config
func (*CraneDockerClient) ListServiceSpec ¶
func (client *CraneDockerClient) ListServiceSpec(options types.ServiceListOptions) ([]swarm.Service, error)
ServiceList returns the list of services config
func (*CraneDockerClient) ListStack ¶
func (client *CraneDockerClient) ListStack() (Stacks, error)
list all stack
func (*CraneDockerClient) ListStackService ¶
func (client *CraneDockerClient) ListStackService(namespace string, opts types.ServiceListOptions) ([]ServiceStatus, error)
ListStackServices return list of service staus and core config in stack
func (*CraneDockerClient) ListTasks ¶
func (client *CraneDockerClient) ListTasks(options types.TaskListOptions) (Tasks, error)
TaskList returns the list of tasks.
func (*CraneDockerClient) ListVolumes ¶
func (client *CraneDockerClient) ListVolumes(ctx context.Context, opts docker.ListVolumesOptions) ([]docker.Volume, error)
func (*CraneDockerClient) LogsContainer ¶
func (client *CraneDockerClient) LogsContainer(ctx context.Context, containerId string, message chan string)
func (*CraneDockerClient) ManagerInfo ¶
func (client *CraneDockerClient) ManagerInfo() (types.Info, error)
Get Manager information, equal to client cmd `docker info` on the manager node
func (*CraneDockerClient) PauseContainer ¶
func (client *CraneDockerClient) PauseContainer(ctx context.Context, containerID string) error
func (*CraneDockerClient) Ping ¶
func (client *CraneDockerClient) Ping() error
ping to test swarmManager connection
func (*CraneDockerClient) PretreatmentStack ¶
before deploy stack we must verify all service spec params and check port conflict also we need check networks used by all of the servcie if the network is not existed created the network by the default param(network driver --overlay)
func (*CraneDockerClient) RemoveContainer ¶
func (client *CraneDockerClient) RemoveContainer(ctx context.Context, opts docker.RemoveContainerOptions) error
func (*CraneDockerClient) RemoveImage ¶
func (client *CraneDockerClient) RemoveImage(ctx context.Context, imageID string) error
TODO add remove image option
func (*CraneDockerClient) RemoveNetwork ¶
func (client *CraneDockerClient) RemoveNetwork(id string) error
func (*CraneDockerClient) RemoveNode ¶
func (client *CraneDockerClient) RemoveNode(nodeId string) error
Remove a single node
func (*CraneDockerClient) RemoveService ¶
func (client *CraneDockerClient) RemoveService(serviceID string) error
ServiceRemove kills and removes a service.
func (*CraneDockerClient) RemoveStack ¶
func (client *CraneDockerClient) RemoveStack(namespace string) error
remove all service and network in the stack
func (*CraneDockerClient) RemoveVolume ¶
func (client *CraneDockerClient) RemoveVolume(ctx context.Context, name string) error
func (*CraneDockerClient) RenameContainer ¶
func (client *CraneDockerClient) RenameContainer(ctx context.Context, opts docker.RenameContainerOptions) error
func (*CraneDockerClient) ResizeContainerTTY ¶
func (*CraneDockerClient) RestartContainer ¶
func (*CraneDockerClient) ScaleService ¶
func (client *CraneDockerClient) ScaleService(serviceID string, serviceScale ServiceScale) error
ScaleService update service replicas
func (*CraneDockerClient) ServiceAddLabel ¶
func (client *CraneDockerClient) ServiceAddLabel(serviceID string, labels map[string]string) error
grant service permissions
func (*CraneDockerClient) ServiceRemoveLabel ¶
func (client *CraneDockerClient) ServiceRemoveLabel(serviceID string, labels []string) error
revoke service permissions
func (*CraneDockerClient) StartContainer ¶
func (client *CraneDockerClient) StartContainer(ctx context.Context, containerID string, hostconfig *docker.HostConfig) error
func (*CraneDockerClient) StatsContainer ¶
func (client *CraneDockerClient) StatsContainer(ctx context.Context, opts model.ContainerStatOptions) error
func (*CraneDockerClient) StopContainer ¶
func (*CraneDockerClient) SwarmManager ¶
func (client *CraneDockerClient) SwarmManager() *docker.Client
return swarm docker client
func (*CraneDockerClient) SwarmNode ¶
create node client: got endpoint by node label verify if node id matches the endpoint against docker info
func (*CraneDockerClient) ToCraneServiceSpec ¶
func (client *CraneDockerClient) ToCraneServiceSpec(swarmService swarm.ServiceSpec) model.CraneServiceSpec
convert swarm service to bundle service
func (*CraneDockerClient) UnpauseContainer ¶
func (client *CraneDockerClient) UnpauseContainer(ctx context.Context, containerID string) error
func (*CraneDockerClient) UpdateNode ¶
func (client *CraneDockerClient) UpdateNode(node swarm.Node, opts model.UpdateOptions) error
Update a single node
func (*CraneDockerClient) UpdateService ¶
func (client *CraneDockerClient) UpdateService(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) error
ServiceUpdate updates a Service.o
func (*CraneDockerClient) UpdateServiceAutoOption ¶
func (client *CraneDockerClient) UpdateServiceAutoOption(serviceID string, version swarm.Version, service swarm.ServiceSpec) error
func (*CraneDockerClient) VerifyNodeEndpoint ¶
func (client *CraneDockerClient) VerifyNodeEndpoint(nodeId string, nodeUrl *url.URL) error
type DockerClientInterface ¶
type DockerClientInterface interface { Ping() error InspectSwarm() (swarm.Swarm, error) ManagerInfo() (types.Info, error) Info(nodeId string) (types.Info, error) ListNode(opts types.NodeListOptions) ([]swarm.Node, error) InspectNode(nodeId string) (swarm.Node, error) RemoveNode(nodeId string) error CreateNode(joiningNode node.JoiningNode) error UpdateNode(node swarm.Node, opts node.UpdateOptions) error GetDaemonUrlById(nodeId string) (*url.URL, error) InspectContainer(id string) (*docker.Container, error) ListContainers(opts docker.ListContainersOptions) ([]docker.APIContainers, error) RemoveContainer(opts docker.RemoveContainerOptions) error LogsContainer(nodeId, containerId string, message chan string) StatsContainer(nodeId, containerId string, stats chan *model.CraneContainerStat) ConnectNetwork(id string, opts docker.NetworkConnectionOptions) error CreateNetwork(opts docker.CreateNetworkOptions) (*docker.Network, error) DisconnectNetwork(id string, opts docker.NetworkConnectionOptions) error InspectNetwork(id string) (*docker.Network, error) ListNetworks(opts docker.NetworkFilterOpts) ([]docker.Network, error) RemoveNetwork(id string) error CreateNodeNetwork(ctx context.Context, opts docker.CreateNetworkOptions) (*docker.Network, error) ConnectNodeNetwork(ctx context.Context, networkID string, opts docker.NetworkConnectionOptions) error DisconnectNodeNetwork(ctx context.Context, networkID string, opts docker.NetworkConnectionOptions) error InspectNodeNetwork(ctx context.Context, networkID string) (*docker.Network, error) ListNodeNetworks(ctx context.Context, opts docker.NetworkFilterOpts) ([]docker.Network, error) InspectVolume(nodeId, name string) (*docker.Volume, error) ListVolumes(nodeId string, opts docker.ListVolumesOptions) ([]docker.Volume, error) CreateVolume(nodeId string, opts docker.CreateVolumeOptions) (*docker.Volume, error) RemoveVolume(nodeId string, name string) error ListImages(nodeId string, opts docker.ListImagesOptions) ([]docker.APIImages, error) InspectImage(nodeId, imageId string) (*docker.Image, error) ImageHistory(nodeId, imageId string) ([]docker.ImageHistory, error) DeployStack(bundle *model.Bundle) error ListStack() ([]Stack, error) ListStackService(namespace string, opts types.ServiceListOptions) ([]ServiceStatus, error) InspectStack(namespace string) (*model.Bundle, error) RemoveStack(namespace string) error FilterServiceByStack(namespace string, opts types.ServiceListOptions) ([]swarm.Service, error) ToCraneServiceSpec(swarmService swarm.ServiceSpec) model.CraneServiceSpec GetStackGroup(bundle *model.Bundle) (uint64, error) CreateService(service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error) ListServiceSpec(options types.ServiceListOptions) ([]swarm.Service, error) ListService(options types.ServiceListOptions) ([]ServiceStatus, error) GetServicesStatus(services []swarm.Service) ([]ServiceStatus, error) RemoveService(serviceID string) error UpdateService(serviceID string, version swarm.Version, service swarm.ServiceSpec, header map[string][]string) error ScaleService(serviceID string, serviceScale ServiceScale) error InspectServiceWithRaw(serviceID string) (swarm.Service, error) ServiceAddLabel(serviceID string, labels map[string]string) error ServiceRemoveLabel(serviceID string, labels []string) error GetServiceNetworkNames(networkAttachmentConfigs []swarm.NetworkAttachmentConfig) []string }
type ServiceScale ¶
type ServiceScale struct {
NumTasks uint64 `json:"NumTasks"`
}
scale a service request
type ServiceStatus ¶
type ServiceStatus struct { ID string `json:"ID"` Name string `json:"Name"` NumTasksRunning int `json:"NumTasksRunning"` NumTasksTotal int `json:"NumTasksTotal"` Image string `json:"Image"` Command string `json:"Command"` CreatedAt time.Time `json:"CreatedAt"` UpdatedAt time.Time `json:"UpdatedAt"` LimitCpus int64 `json:"LimitCpus"` LimitMems int64 `json:"LimitMems"` ReserveCpus int64 `json:"ReserveCpus"` ReserveMems int64 `json:"ReserveMems"` IPs []string `json:"IPs"` Ports []uint32 `json:"Ports"` }
type Stack ¶
type Stack struct { // Name is the name of the stack Namespace string `json:"Namespace"` // Services is the number of the services ServiceCount int `json:"ServiceCount"` Services []ServiceStatus }