|
8 | 8 | "github.com/docker/docker/api/types/network" |
9 | 9 | executorpkg "github.com/docker/docker/daemon/cluster/executor" |
10 | 10 | clustertypes "github.com/docker/docker/daemon/cluster/provider" |
| 11 | + "github.com/docker/docker/plugin" |
11 | 12 | networktypes "github.com/docker/libnetwork/types" |
12 | 13 | "github.com/docker/swarmkit/agent/exec" |
13 | 14 | "github.com/docker/swarmkit/agent/secrets" |
@@ -45,12 +46,39 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) { |
45 | 46 | } |
46 | 47 | } |
47 | 48 |
|
| 49 | + // add v1 plugins |
48 | 50 | addPlugins("Volume", info.Plugins.Volume) |
49 | 51 | // Add builtin driver "overlay" (the only builtin multi-host driver) to |
50 | 52 | // the plugin list by default. |
51 | 53 | addPlugins("Network", append([]string{"overlay"}, info.Plugins.Network...)) |
52 | 54 | addPlugins("Authorization", info.Plugins.Authorization) |
53 | 55 |
|
| 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 | + |
54 | 82 | pluginFields := make([]api.PluginDescription, 0, len(plugins)) |
55 | 83 | for k := range plugins { |
56 | 84 | pluginFields = append(pluginFields, k) |
|
0 commit comments