Implement CNI plugin via weaveutil

This commit is contained in:
Bryan Boreham committed 2016-11-03 17:42:39 +00:00
1 parent 40b3a49c90
commit 5630a01a8c
4 files changed
+56 -4

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package main
import (
"os"
cni "github.com/appc/cni/pkg/skel"
weaveapi "github.com/weaveworks/weave/api"
"github.com/weaveworks/weave/common"
ipamplugin "github.com/weaveworks/weave/plugin/ipam"
netplugin "github.com/weaveworks/weave/plugin/net"
)
func cniNet(args []string) error {
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
n := netplugin.NewCNIPlugin(weave)
cni.PluginMain(n.CmdAdd, n.CmdDel)
return nil
}
func cniIPAM(args []string) error {
weave := weaveapi.NewClient(os.Getenv("WEAVE_HTTP_ADDR"), common.Log)
i := ipamplugin.NewIpam(weave)
cni.PluginMain(i.CmdAdd, i.CmdDel)
return nil
}