mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
update to support latest swarm changes
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
189f89301e
commit
f50a65ff0c
4 changed files with 14 additions and 7 deletions
|
@ -30,10 +30,10 @@ import (
|
|||
type containerAdapter struct {
|
||||
backend executorpkg.Backend
|
||||
container *containerConfig
|
||||
secrets exec.SecretProvider
|
||||
secrets exec.SecretGetter
|
||||
}
|
||||
|
||||
func newContainerAdapter(b executorpkg.Backend, task *api.Task, secrets exec.SecretProvider) (*containerAdapter, error) {
|
||||
func newContainerAdapter(b executorpkg.Backend, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) {
|
||||
ctnr, err := newContainerConfig(task)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -20,7 +20,7 @@ type networkAttacherController struct {
|
|||
closed chan struct{}
|
||||
}
|
||||
|
||||
func newNetworkAttacherController(b executorpkg.Backend, task *api.Task, secrets exec.SecretProvider) (*networkAttacherController, error) {
|
||||
func newNetworkAttacherController(b executorpkg.Backend, task *api.Task, secrets exec.SecretGetter) (*networkAttacherController, error) {
|
||||
adapter, err := newContainerAdapter(b, task, secrets)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -33,7 +33,7 @@ type controller struct {
|
|||
var _ exec.Controller = &controller{}
|
||||
|
||||
// NewController returns a docker exec runner for the provided task.
|
||||
func newController(b executorpkg.Backend, task *api.Task, secrets exec.SecretProvider) (*controller, error) {
|
||||
func newController(b executorpkg.Backend, task *api.Task, secrets exec.SecretGetter) (*controller, error) {
|
||||
adapter, err := newContainerAdapter(b, task, secrets)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -10,18 +10,21 @@ import (
|
|||
clustertypes "github.com/docker/docker/daemon/cluster/provider"
|
||||
networktypes "github.com/docker/libnetwork/types"
|
||||
"github.com/docker/swarmkit/agent/exec"
|
||||
"github.com/docker/swarmkit/agent/secrets"
|
||||
"github.com/docker/swarmkit/api"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type executor struct {
|
||||
backend executorpkg.Backend
|
||||
secrets exec.SecretsManager
|
||||
}
|
||||
|
||||
// NewExecutor returns an executor from the docker client.
|
||||
func NewExecutor(b executorpkg.Backend) exec.Executor {
|
||||
return &executor{
|
||||
backend: b,
|
||||
secrets: secrets.NewManager(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,12 +123,12 @@ func (e *executor) Configure(ctx context.Context, node *api.Node) error {
|
|||
}
|
||||
|
||||
// Controller returns a docker container runner.
|
||||
func (e *executor) Controller(t *api.Task, secrets exec.SecretProvider) (exec.Controller, error) {
|
||||
func (e *executor) Controller(t *api.Task) (exec.Controller, error) {
|
||||
if t.Spec.GetAttachment() != nil {
|
||||
return newNetworkAttacherController(e.backend, t, secrets)
|
||||
return newNetworkAttacherController(e.backend, t, e.secrets)
|
||||
}
|
||||
|
||||
ctlr, err := newController(e.backend, t, secrets)
|
||||
ctlr, err := newController(e.backend, t, e.secrets)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -150,6 +153,10 @@ func (e *executor) SetNetworkBootstrapKeys(keys []*api.EncryptionKey) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (e *executor) Secrets() exec.SecretsManager {
|
||||
return e.secrets
|
||||
}
|
||||
|
||||
type sortedPlugins []api.PluginDescription
|
||||
|
||||
func (sp sortedPlugins) Len() int { return len(sp) }
|
||||
|
|
Loading…
Reference in a new issue