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