-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vendor dependency cycle-free swarmkit
Moby imports Swarmkit; Swarmkit no longer imports Moby. In order to accomplish this feat, Swarmkit has introduced a new plugin.Getter interface so it could stop importing our pkg/plugingetter package. This new interface is not entirely compatible with our plugingetter.PluginGetter interface, necessitating a thin adapter. Swarmkit had to jettison the CNM network allocator to stop having to import libnetwork as the cnmallocator package is deeply tied to libnetwork. Move the CNM network allocator into libnetwork, where it belongs. The package had a short an uninteresting Git history in the Swarmkit repository so no effort was made to retain history. Signed-off-by: Cory Snider <csnider@mirantis.com>
- Loading branch information
Showing
113 changed files
with
29,815 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package convert | ||
|
||
import ( | ||
"github.com/docker/docker/pkg/plugingetter" | ||
"github.com/moby/swarmkit/v2/node/plugin" | ||
) | ||
|
||
// SwarmPluginGetter adapts a plugingetter.PluginGetter to a Swarmkit plugin.Getter. | ||
func SwarmPluginGetter(pg plugingetter.PluginGetter) plugin.Getter { | ||
return pluginGetter{pg} | ||
} | ||
|
||
type pluginGetter struct { | ||
pg plugingetter.PluginGetter | ||
} | ||
|
||
var _ plugin.Getter = (*pluginGetter)(nil) | ||
|
||
type swarmPlugin struct { | ||
plugingetter.CompatPlugin | ||
} | ||
|
||
func (p swarmPlugin) Client() plugin.Client { | ||
return p.CompatPlugin.Client() | ||
} | ||
|
||
func (g pluginGetter) Get(name string, capability string) (plugin.Plugin, error) { | ||
p, err := g.pg.Get(name, capability, plugingetter.Lookup) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return swarmPlugin{p}, nil | ||
} | ||
|
||
func (g pluginGetter) GetAllManagedPluginsByCap(capability string) []plugin.Plugin { | ||
pp := g.pg.GetAllManagedPluginsByCap(capability) | ||
ret := make([]plugin.Plugin, len(pp)) | ||
for i, p := range pp { | ||
ret[i] = swarmPlugin{p} | ||
} | ||
return ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cnmallocator | ||
|
||
import ( | ||
"runtime" | ||
"testing" | ||
|
||
"github.com/moby/swarmkit/v2/manager/allocator" | ||
"gotest.tools/v3/skip" | ||
) | ||
|
||
func TestAllocator(t *testing.T) { | ||
skip.If(t, runtime.GOOS == "windows", "Allocator tests are hardcoded to use Linux network driver names") | ||
allocator.RunAllocatorTests(t, NewProvider(nil)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.