Only filter on plugins if running with docker engine#2192
Only filter on plugins if running with docker engine#2192aaronlehmann merged 1 commit intomoby:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2192 +/- ##
==========================================
- Coverage 60.06% 59.99% -0.08%
==========================================
Files 119 119
Lines 19847 19849 +2
==========================================
- Hits 11921 11908 -13
- Misses 6568 6583 +15
Partials 1358 1358 |
|
As an alternative solution, I would suggest changing |
|
@aaronlehmann That sounds much better and I think ought to work just fine, I'll make the change. |
5daf3be to
0c955be
Compare
|
Force pushed (a much smaller change now!) and update title + head comment to reflect new commit message. |
manager/scheduler/filter.go
Outdated
| // Check returns true if the task can be scheduled into the given node. | ||
| // TODO(amitshukla): investigate storing Plugins as a map so it can be easily probed | ||
| func (f *PluginFilter) Check(n *NodeInfo) bool { | ||
| if n.Description.Engine == nil { |
There was a problem hiding this comment.
Let's change this to if n.Description == nil || n.Description.Engine == nil.
It looks like not checking for nil here was an oversight that would currently allow a misbehaving or malicious worker to crash the manager.
0c955be to
38a9fca
Compare
manager/scheduler/filter.go
Outdated
| if n.Description == nil || n.Description.Engine == nil { | ||
| // If we are not running on engine then there is no | ||
| // plugin getter and no plugins, assume everything | ||
| // must be built-in. |
There was a problem hiding this comment.
"If the node is not running Engine, plugins are not supported."
|
Is it correct that this is temporary behavior to support #1965? I imagine that eventually we will want to validate the drivers for volumes and networks against some variant of |
38a9fca to
9636223
Compare
If there is no engine description then thus assumes that all drivers etc are built-in and this always available, and when they are not proper errors will be generated and propagated. This avoids the need in moby#1965 to populate a spurious `api.NodeDescription.Engine` field (spurious because there is no engine in this case). Signed-off-by: Ian Campbell <ian.campbell@docker.com>
9636223 to
58aab16
Compare
|
@aaronlehmann that's what I was trying to get at with "built-in and this always available, and when they are not proper errors will be generated and propagated." (oops, Right now in my (unpublished) CNI POC based on the #1965 work the network plugin here is "cni" (at @al's suggestion), so there isn't much to check. The actual cni backend/plugin name is in the CNI JSON config blob, which for the most part of opaque to us, although the relevant field I haven't thought much about storage yet, but if we guess we might go the csi route I would expect something similar there. I had vaguely considered adding a method to the executor interface (or a new interface which the executor could implement) and plumbing the executor through to here so it could be asked, but I guess that falls afoul of using the leader's executor to answer node specific questions. |
|
LGTM |
1 similar comment
|
LGTM |
If there is no engine description then this assumes that all drivers etc are built-in and thus always available, and when they are not proper errors will be generated and propagated.
This avoids the need in #1965 to populate a spurious
api.NodeDescription.Enginefield (spurious because there is no engine in this case).Signed-off-by: Ian Campbell ian.campbell@docker.com
The
api.NodeDescription.Enginefield is https://github.com/ijc25/swarmkit/blob/42f853a3c262666e29d4c0bd3ea301d5e736bc82/agent/exec/containerd/executor.go#L93...L101 in the current PR (but I expect that link to break when I next force push there) it is theexecutor.Describemethod and is just: