Skip to content

Commit 2a97ea9

Browse files
author
Aaron Lehmann
committed
Publish installed v2 plugins to manager
Signed-off-by: Aaron Lehmann <[email protected]>
1 parent 423ba6f commit 2a97ea9

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

daemon/cluster/executor/container/executor.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/docker/docker/api/types/network"
99
executorpkg "github.com/docker/docker/daemon/cluster/executor"
1010
clustertypes "github.com/docker/docker/daemon/cluster/provider"
11+
"github.com/docker/docker/plugin"
1112
networktypes "github.com/docker/libnetwork/types"
1213
"github.com/docker/swarmkit/agent/exec"
1314
"github.com/docker/swarmkit/agent/secrets"
@@ -45,12 +46,39 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
4546
}
4647
}
4748

49+
// add v1 plugins
4850
addPlugins("Volume", info.Plugins.Volume)
4951
// Add builtin driver "overlay" (the only builtin multi-host driver) to
5052
// the plugin list by default.
5153
addPlugins("Network", append([]string{"overlay"}, info.Plugins.Network...))
5254
addPlugins("Authorization", info.Plugins.Authorization)
5355

56+
// add v2 plugins
57+
v2Plugins, err := plugin.GetManager().List()
58+
if err == nil {
59+
for _, plgn := range v2Plugins {
60+
for _, typ := range plgn.Config.Interface.Types {
61+
if typ.Prefix != "docker" || !plgn.Enabled {
62+
continue
63+
}
64+
plgnTyp := typ.Capability
65+
if typ.Capability == "volumedriver" {
66+
plgnTyp = "Volume"
67+
} else if typ.Capability == "networkdriver" {
68+
plgnTyp = "Network"
69+
}
70+
plgnName := plgn.Name
71+
if plgn.Tag != "" {
72+
plgnName += ":" + plgn.Tag
73+
}
74+
plugins[api.PluginDescription{
75+
Type: plgnTyp,
76+
Name: plgnName,
77+
}] = struct{}{}
78+
}
79+
}
80+
}
81+
5482
pluginFields := make([]api.PluginDescription, 0, len(plugins))
5583
for k := range plugins {
5684
pluginFields = append(pluginFields, k)

0 commit comments

Comments
 (0)