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
2 changes: 1 addition & 1 deletion manager/scheduler/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (f *PluginFilter) Check(n *NodeInfo) bool {
}
}

if f.t.Spec.LogDriver != nil {
if f.t.Spec.LogDriver != nil && f.t.Spec.LogDriver.Name != "none" {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpuguy83 do we need to check for "None" too or is this a case-sensitive keyword?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could check lower, but it is case sensitive in docker at least.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, in that case we can leave it as is for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wondered if nil and "none" are the same, but I think they have a different meaning (nil being: use the default?) If not, and the are equal then ideally we should change "none" to nil in the spec

// 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
27 changes: 27 additions & 0 deletions manager/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2565,6 +2565,24 @@ 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,
},
}

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

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, "")
}

func BenchmarkScheduler1kNodes1kTasks(b *testing.B) {
Expand Down