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"
|
2022-03-18 11:33:43 -04:00
|
|
|
"github.com/docker/docker/api/types/volume"
|
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"
|
2021-04-05 20:24:47 -04:00
|
|
|
"github.com/docker/docker/libnetwork"
|
|
|
|
"github.com/docker/docker/libnetwork/cluster"
|
|
|
|
networktypes "github.com/docker/docker/libnetwork/types"
|
2021-05-27 20:15:56 -04:00
|
|
|
"github.com/docker/docker/plugin"
|
|
|
|
volumeopts "github.com/docker/docker/volume/service/opts"
|
2022-04-21 17:33:07 -04:00
|
|
|
"github.com/moby/swarmkit/v2/agent/exec"
|
2018-06-26 17:49:33 -04:00
|
|
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
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)
|
2022-03-05 17:58:46 -05:00
|
|
|
CreateManagedContainer(config types.ContainerCreateConfig) (container.CreateResponse, error)
|
2016-11-30 13:22:07 -05:00
|
|
|
ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
|
2021-08-20 18:23:26 -04:00
|
|
|
ContainerStop(ctx context.Context, name string, config container.StopOptions) error
|
|
|
|
ContainerLogs(ctx context.Context, name string, config *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
|
2022-05-01 19:00:09 -04:00
|
|
|
ContainerKill(name string, sig string) 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
|
2019-08-28 19:44:39 -04:00
|
|
|
SystemInfo() *types.Info
|
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
|
2019-02-28 19:52:30 -05:00
|
|
|
HasExperimental() bool
|
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 {
|
2022-03-18 11:33:43 -04:00
|
|
|
Create(ctx context.Context, name, driverName string, opts ...volumeopts.CreateOption) (*volume.Volume, error)
|
2018-03-22 17:11:03 -04:00
|
|
|
}
|
|
|
|
|
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 {
|
2018-06-26 17:49:33 -04:00
|
|
|
PullImage(ctx context.Context, image, tag string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error
|
2019-06-17 21:42:24 -04:00
|
|
|
GetRepository(context.Context, reference.Named, *types.AuthConfig) (distribution.Repository, error)
|
2018-02-02 17:18:46 -05:00
|
|
|
LookupImage(name string) (*types.ImageInspect, error)
|
|
|
|
}
|