1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

bump swarmkit 18e7e58ea1a5ec016625a636d0d52500eea123bc

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-03-26 14:57:19 +01:00
parent 5635c248cd
commit a356c4eaee
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 42 additions and 15 deletions

View file

@ -131,7 +131,7 @@ github.com/containerd/ttrpc f02858b1457c5ca3aaec3a0803eb0d59f96e41d6
github.com/gogo/googleapis 08a7655d27152912db7aaf4f983275eaf8d128ef github.com/gogo/googleapis 08a7655d27152912db7aaf4f983275eaf8d128ef
# cluster # cluster
github.com/docker/swarmkit 415dc72789e2b733ea884f09188c286ca187d8ec github.com/docker/swarmkit 18e7e58ea1a5ec016625a636d0d52500eea123bc
github.com/gogo/protobuf v1.2.0 github.com/gogo/protobuf v1.2.0
github.com/cloudflare/cfssl 1.3.2 github.com/cloudflare/cfssl 1.3.2
github.com/fernet/fernet-go 1b2437bc582b3cfbb341ee5a29f8ef5b42912ff2 github.com/fernet/fernet-go 1b2437bc582b3cfbb341ee5a29f8ef5b42912ff2

View file

@ -254,25 +254,23 @@ func (s *Server) UpdateNode(ctx context.Context, request *api.UpdateNodeRequest)
}, nil }, nil
} }
func removeNodeAttachments(tx store.Tx, nodeID string) error { func orphanNodeTasks(tx store.Tx, nodeID string) error {
// orphan the node's attached containers. if we don't do this, the // when a node is deleted, all of its tasks are irrecoverably removed.
// network these attachments are connected to will never be removeable // additionally, the Dispatcher can no longer be relied on to update the
// task status. Therefore, when the node is removed, we must additionally
// move all of its assigned tasks to the Orphaned state, so that their
// resources can be cleaned up.
tasks, err := store.FindTasks(tx, store.ByNodeID(nodeID)) tasks, err := store.FindTasks(tx, store.ByNodeID(nodeID))
if err != nil { if err != nil {
return err return err
} }
for _, task := range tasks { for _, task := range tasks {
// if the task is an attachment, then we just delete it. the allocator task.Status = api.TaskStatus{
// will do the heavy lifting. basically, GetAttachment will return the Timestamp: gogotypes.TimestampNow(),
// attachment if that's the kind of runtime, or nil if it's not. State: api.TaskStateOrphaned,
if task.Spec.GetAttachment() != nil { Message: "Task belonged to a node that has been deleted",
// don't delete the task. instead, update it to `ORPHANED` so that
// the taskreaper will clean it up.
task.Status.State = api.TaskStateOrphaned
if err := store.UpdateTask(tx, task); err != nil {
return err
}
} }
store.UpdateTask(tx, task)
} }
return nil return nil
} }
@ -342,7 +340,7 @@ func (s *Server) RemoveNode(ctx context.Context, request *api.RemoveNodeRequest)
return err return err
} }
if err := removeNodeAttachments(tx, request.NodeID); err != nil { if err := orphanNodeTasks(tx, request.NodeID); err != nil {
return err return err
} }

View file

@ -392,6 +392,21 @@ func validateConfigRefsSpec(spec api.TaskSpec) error {
return nil return nil
} }
// check if we're using a config as a CredentialSpec -- if so, we need to
// verify
var (
credSpecConfig string
credSpecConfigFound bool
)
if p := container.Privileges; p != nil {
if cs := p.CredentialSpec; cs != nil {
// if there is no config in the credspec, then this will just be
// assigned to emptystring anyway, so we don't need to check
// existence.
credSpecConfig = cs.GetConfig()
}
}
// Keep a map to track all the targets that will be exposed // Keep a map to track all the targets that will be exposed
// The string returned is only used for logging. It could as well be struct{}{} // The string returned is only used for logging. It could as well be struct{}{}
existingTargets := make(map[string]string) existingTargets := make(map[string]string)
@ -421,6 +436,20 @@ func validateConfigRefsSpec(spec api.TaskSpec) error {
existingTargets[fileName] = configRef.ConfigName existingTargets[fileName] = configRef.ConfigName
} }
if configRef.GetRuntime() != nil {
if configRef.ConfigID == credSpecConfig {
credSpecConfigFound = true
}
}
}
if credSpecConfig != "" && !credSpecConfigFound {
return status.Errorf(
codes.InvalidArgument,
"CredentialSpec references config '%s', but that config isn't in config references with RuntimeTarget",
credSpecConfig,
)
} }
return nil return nil