2018-02-05 16:05:59 -05:00
|
|
|
package executor // import "github.com/docker/docker/daemon/cluster/executor"
|
2016-06-13 22:52:49 -04:00
|
|
|
|
|
|
|
import (
|
2018-04-19 18:30:59 -04:00
|
|
|
"context"
|
2016-06-13 22:52:49 -04:00
|
|
|
"io"
|
2016-06-27 21:08:56 -04:00
|
|
|
"time"
|
2016-06-13 22:52:49 -04:00
|
|
|
|
2016-11-08 12:32:29 -05:00
|
|
|
"github.com/docker/distribution"
|
2017-01-25 19:54:18 -05:00
|
|
|
"github.com/docker/distribution/reference"
|
2016-09-06 14:18:12 -04:00
|
|
|
"github.com/docker/docker/api/types"
|
2016-10-26 04:14:15 -04:00
|
|
|
"github.com/docker/docker/api/types/backend"
|
2016-09-06 14:18:12 -04:00
|
|
|
"github.com/docker/docker/api/types/container"
|
|
|
|
"github.com/docker/docker/api/types/events"
|
|
|
|
"github.com/docker/docker/api/types/filters"
|
|
|
|
"github.com/docker/docker/api/types/network"
|
2016-11-15 10:04:36 -05:00
|
|
|
swarmtypes "github.com/docker/docker/api/types/swarm"
|
2017-03-30 16:52:40 -04:00
|
|
|
containerpkg "github.com/docker/docker/container"
|
2016-06-13 22:52:49 -04:00
|
|
|
clustertypes "github.com/docker/docker/daemon/cluster/provider"
|
2017-08-29 02:49:26 -04:00
|
|
|
networkSettings "github.com/docker/docker/daemon/network"
|
2016-12-12 18:05:53 -05:00
|
|
|
"github.com/docker/docker/plugin"
|
2018-03-22 17:11:03 -04:00
|
|
|
volumeopts "github.com/docker/docker/volume/service/opts"
|
2016-07-23 11:11:10 -04:00
|
|
|
"github.com/docker/libnetwork"
|
2016-06-13 22:52:49 -04:00
|
|
|
"github.com/docker/libnetwork/cluster"
|
|
|
|
networktypes "github.com/docker/libnetwork/types"
|
2016-11-15 10:04:36 -05:00
|
|
|
"github.com/docker/swarmkit/agent/exec"
|
2016-06-13 22:52:49 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// Backend defines the executor component for a swarm agent.
|
|
|
|
type Backend interface {
|
|
|
|
CreateManagedNetwork(clustertypes.NetworkCreateRequest) error
|
2017-10-31 15:46:53 -04:00
|
|
|
DeleteManagedNetwork(networkID string) error
|
2018-01-15 12:26:43 -05:00
|
|
|
FindNetwork(idName string) (libnetwork.Network, error)
|
2017-03-31 17:07:55 -04:00
|
|
|
SetupIngress(clustertypes.NetworkCreateRequest, string) (<-chan struct{}, error)
|
|
|
|
ReleaseIngress() (<-chan struct{}, error)
|
2016-11-30 13:22:07 -05:00
|
|
|
CreateManagedContainer(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error)
|
|
|
|
ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
|
2016-06-06 23:29:05 -04:00
|
|
|
ContainerStop(name string, seconds *int) error
|
2017-07-19 10:20:13 -04:00
|
|
|
ContainerLogs(context.Context, string, *types.ContainerLogsOptions) (msgs <-chan *backend.LogMessage, tty bool, err error)
|
2016-06-13 22:52:49 -04:00
|
|
|
ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
|
2016-09-18 02:30:39 -04:00
|
|
|
ActivateContainerServiceBinding(containerName string) error
|
|
|
|
DeactivateContainerServiceBinding(containerName string) error
|
2016-06-13 22:52:49 -04:00
|
|
|
UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
|
|
|
|
ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)
|
2017-03-30 23:01:41 -04:00
|
|
|
ContainerWait(ctx context.Context, name string, condition containerpkg.WaitCondition) (<-chan containerpkg.StateStatus, error)
|
2016-06-13 22:52:49 -04:00
|
|
|
ContainerRm(name string, config *types.ContainerRmConfig) error
|
|
|
|
ContainerKill(name string, sig uint64) error
|
2017-03-16 17:23:33 -04:00
|
|
|
SetContainerDependencyStore(name string, store exec.DependencyGetter) error
|
2016-11-15 10:04:36 -05:00
|
|
|
SetContainerSecretReferences(name string, refs []*swarmtypes.SecretReference) error
|
2017-03-16 17:23:33 -04:00
|
|
|
SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
|
2016-06-13 22:52:49 -04:00
|
|
|
SystemInfo() (*types.Info, error)
|
2016-08-20 08:14:26 -04:00
|
|
|
Containers(config *types.ContainerListOptions) ([]*types.Container, error)
|
2016-06-13 22:52:49 -04:00
|
|
|
SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
|
2017-01-13 23:14:03 -05:00
|
|
|
DaemonJoinsCluster(provider cluster.Provider)
|
|
|
|
DaemonLeavesCluster()
|
2016-06-14 12:13:53 -04:00
|
|
|
IsSwarmCompatible() error
|
2016-06-27 21:08:56 -04:00
|
|
|
SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
|
|
|
|
UnsubscribeFromEvents(listener chan interface{})
|
2016-08-23 19:50:15 -04:00
|
|
|
UpdateAttachment(string, string, string, *network.NetworkingConfig) error
|
|
|
|
WaitForDetachment(context.Context, string, string, string, string) error
|
2016-12-12 18:05:53 -05:00
|
|
|
PluginManager() *plugin.Manager
|
2017-01-19 20:09:37 -05:00
|
|
|
PluginGetter() *plugin.Store
|
2017-09-22 02:04:34 -04:00
|
|
|
GetAttachmentStore() *networkSettings.AttachmentStore
|
2016-06-13 22:52:49 -04:00
|
|
|
}
|
2018-02-02 17:18:46 -05:00
|
|
|
|
2018-03-22 17:11:03 -04:00
|
|
|
// VolumeBackend is used by an executor to perform volume operations
|
|
|
|
type VolumeBackend interface {
|
|
|
|
Create(ctx context.Context, name, driverName string, opts ...volumeopts.CreateOption) (*types.Volume, error)
|
|
|
|
}
|
|
|
|
|
2018-02-07 15:52:47 -05:00
|
|
|
// ImageBackend is used by an executor to perform image operations
|
2018-02-02 17:18:46 -05:00
|
|
|
type ImageBackend interface {
|
|
|
|
PullImage(ctx context.Context, image, tag, platform string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
|
|
|
|
GetRepository(context.Context, reference.Named, *types.AuthConfig) (distribution.Repository, bool, error)
|
|
|
|
LookupImage(name string) (*types.ImageInspect, error)
|
|
|
|
}
|