Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion manager/scheduler/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ func (f *PluginFilter) Check(n *NodeInfo) bool {
}
}

if f.t.Spec.LogDriver != nil {
// It's possible that the LogDriver object does not carry a name, just some
// configuration options. In that case, the plugin filter shouldn't fail to
// schedule the task
if f.t.Spec.LogDriver != nil && f.t.Spec.LogDriver.Name != "none" && f.t.Spec.LogDriver.Name != "" {
// If there are no log driver types in the list at all, most likely this is
// an older daemon that did not report this information. In this case don't filter
if typeFound, exists := f.pluginExistsOnNode("Log", f.t.Spec.LogDriver.Name, nodePlugins); !exists && typeFound {
Expand Down
60 changes: 60 additions & 0 deletions manager/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,46 @@ func TestSchedulerPluginConstraint(t *testing.T) {
},
}

// no logging
t6 := &api.Task{
ID: "task6_ID",
DesiredState: api.TaskStateRunning,
Spec: api.TaskSpec{
Runtime: &api.TaskSpec_Container{
Container: &api.ContainerSpec{},
},
LogDriver: &api.Driver{Name: "none"},
},
ServiceAnnotations: api.Annotations{
Name: "task6",
},
Status: api.TaskStatus{
State: api.TaskStatePending,
},
}

// log driver with no name
t7 := &api.Task{
ID: "task7_ID",
DesiredState: api.TaskStateRunning,
Spec: api.TaskSpec{
Runtime: &api.TaskSpec_Container{
Container: &api.ContainerSpec{},
},
LogDriver: &api.Driver{
Options: map[string]string{
"max-size": "50k",
},
},
},
ServiceAnnotations: api.Annotations{
Name: "task7",
},
Status: api.TaskStatus{
State: api.TaskStatePending,
},
}

s := store.NewMemoryStore(nil)
assert.NotNil(t, s)
defer s.Close()
Expand Down Expand Up @@ -2668,6 +2708,26 @@ func TestSchedulerPluginConstraint(t *testing.T) {
assignment4 := watchAssignment(t, watch)
assert.Equal(t, assignment4.ID, "task5_ID")
assert.Equal(t, assignment4.NodeID, "node4_ID")

// check that t6 gets assigned to some node
err = s.Update(func(tx store.Tx) error {
assert.NoError(t, store.CreateTask(tx, t6))
return nil
})
assert.NoError(t, err)
assignment5 := watchAssignment(t, watch)
assert.Equal(t, assignment5.ID, "task6_ID")
assert.NotEqual(t, assignment5.NodeID, "")

// check that t7 gets assigned to some node
err = s.Update(func(tx store.Tx) error {
assert.NoError(t, store.CreateTask(tx, t7))
return nil
})
assert.NoError(t, err)
assignment6 := watchAssignment(t, watch)
assert.Equal(t, assignment6.ID, "task7_ID")
assert.NotEqual(t, assignment6.NodeID, "")
}

func BenchmarkScheduler1kNodes1kTasks(b *testing.B) {
Expand Down
60 changes: 0 additions & 60 deletions vendor/github.com/docker/docker/hack/README.md

This file was deleted.

This file was deleted.

This file was deleted.