2018-02-05 16:05:59 -05:00
|
|
|
package executor // import "github.com/docker/docker/daemon/cluster/executor"
|
2016-06-13 19:52:49 -07:00
|
|
|
|
|
|
|
import (
|
2018-04-19 15:30:59 -07:00
|
|
|
"context"
|
2016-06-13 19:52:49 -07:00
|
|
|
"io"
|
2016-06-27 18:08:56 -07:00
|
|
|
"time"
|
2016-06-13 19:52:49 -07:00
|
|
|
|
2016-11-08 09:32:29 -08:00
|
|
|
"github.com/docker/distribution"
|
2017-01-25 16:54:18 -08:00
|
|
|
"github.com/docker/distribution/reference"
|
2016-09-06 11:18:12 -07:00
|
|
|
"github.com/docker/docker/api/types"
|
2016-10-26 01:14:15 -07:00
|
|
|
"github.com/docker/docker/api/types/backend"
|
2016-09-06 11:18:12 -07: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 13:52:40 -07:00
|
|
|
containerpkg "github.com/docker/docker/container"
|
2016-06-13 19:52:49 -07:00
|
|
|
clustertypes "github.com/docker/docker/daemon/cluster/provider"
|
2017-08-28 23:49:26 -07: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 10:04:36 -05:00
|
|
|
"github.com/docker/swarmkit/agent/exec"
|
2018-06-26 14:49:33 -07:00
|
|
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
2016-06-13 19:52:49 -07: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 14:07:55 -07:00
|
|
|
SetupIngress(clustertypes.NetworkCreateRequest, string) (<-chan struct{}, error)
|
|
|
|
ReleaseIngress() (<-chan struct{}, error)
|
2016-11-30 19:22:07 +01:00
|
|
|
CreateManagedContainer(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error)
|
|
|
|
ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
|
2016-06-06 20:29:05 -07: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 19:52:49 -07:00
|
|
|
ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
|
2016-09-17 23:30:39 -07:00
|
|
|
ActivateContainerServiceBinding(containerName string) error
|
|
|
|
DeactivateContainerServiceBinding(containerName string) error
|
2016-06-13 19:52:49 -07:00
|
|
|
UpdateContainerServiceConfig(containerName string, serviceConfig *clustertypes.ServiceConfig) error
|
|
|
|
ContainerInspectCurrent(name string, size bool) (*types.ContainerJSON, error)
|
2017-03-30 20:01:41 -07:00
|
|
|
ContainerWait(ctx context.Context, name string, condition containerpkg.WaitCondition) (<-chan containerpkg.StateStatus, error)
|
2016-06-13 19:52:49 -07:00
|
|
|
ContainerRm(name string, config *types.ContainerRmConfig) error
|
|
|
|
ContainerKill(name string, sig uint64) error
|
2017-03-16 14:23:33 -07: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 14:23:33 -07:00
|
|
|
SetContainerConfigReferences(name string, refs []*swarmtypes.ConfigReference) error
|
2019-08-29 07:44:39 +08:00
|
|
|
SystemInfo() *types.Info
|
2016-08-20 14:14:26 +02:00
|
|
|
Containers(config *types.ContainerListOptions) ([]*types.Container, error)
|
2016-06-13 19:52:49 -07:00
|
|
|
SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
|
2017-01-13 20:14:03 -08:00
|
|
|
DaemonJoinsCluster(provider cluster.Provider)
|
|
|
|
DaemonLeavesCluster()
|
2016-06-14 09:13:53 -07:00
|
|
|
IsSwarmCompatible() error
|
2016-06-27 18:08:56 -07:00
|
|
|
SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
|
|
|
|
UnsubscribeFromEvents(listener chan interface{})
|
2016-08-23 16:50:15 -07:00
|
|
|
UpdateAttachment(string, string, string, *network.NetworkingConfig) error
|
|
|
|
WaitForDetachment(context.Context, string, string, string, string) error
|
2016-12-12 15:05:53 -08:00
|
|
|
PluginManager() *plugin.Manager
|
2017-01-19 17:09:37 -08:00
|
|
|
PluginGetter() *plugin.Store
|
2017-09-21 23:04:34 -07:00
|
|
|
GetAttachmentStore() *networkSettings.AttachmentStore
|
2019-02-28 16:52:30 -08:00
|
|
|
HasExperimental() bool
|
2016-06-13 19:52:49 -07:00
|
|
|
}
|
2018-02-02 14:18:46 -08: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 14:18:46 -08:00
|
|
|
type ImageBackend interface {
|
2018-06-26 14:49:33 -07: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 14:18:46 -08:00
|
|
|
LookupImage(name string) (*types.ImageInspect, error)
|
|
|
|
}
|