libCNI upgraded to v1.1.2
This was all work done previously by @hswong3i in https://github.com/weaveworks/weave/pull/3939 All credit to them
This commit is contained in:
1 parent
2f49b8455a
commit
1bb1f02b1d
167 files changed
+15015
-3146
No files matched your search
+10
-2
@@ -2,12 +2,13 @@ package ipamplugin
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/containernetworking/cni/pkg/skel"
|
||||
"github.com/containernetworking/cni/pkg/types"
|
||||
"github.com/containernetworking/cni/pkg/types/current"
|
||||
current "github.com/containernetworking/cni/pkg/types/100"
|
||||
)
|
||||
|
||||
func (i *Ipam) CmdAdd(args *skel.CmdArgs) error {
|
||||
@@ -22,6 +23,13 @@ func (i *Ipam) CmdAdd(args *skel.CmdArgs) error {
|
||||
return types.PrintResult(result, conf.CNIVersion)
|
||||
}
|
||||
|
||||
func (i *Ipam) CmdCheck(args *skel.CmdArgs) error {
|
||||
// TODO: Figure out how to do a proper CNI check here
|
||||
// For now, return not implemented error
|
||||
|
||||
return errors.New("CNI plugin check not implemented")
|
||||
}
|
||||
|
||||
func (i *Ipam) Allocate(args *skel.CmdArgs) (types.Result, error) {
|
||||
// extract the things we care about
|
||||
conf, err := loadIPAMConf(args.StdinData)
|
||||
@@ -52,8 +60,8 @@ func (i *Ipam) Allocate(args *skel.CmdArgs) (types.Result, error) {
|
||||
return nil, err
|
||||
}
|
||||
result := ¤t.Result{
|
||||
CNIVersion: current.ImplementedSpecVersion,
|
||||
IPs: []*current.IPConfig{{
|
||||
Version: "4",
|
||||
Address: *ipnet,
|
||||
Gateway: conf.Gateway,
|
||||
}},
|
||||
|
||||
+13
-3
@@ -3,15 +3,16 @@ package plugin
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/containernetworking/cni/pkg/ipam"
|
||||
"github.com/containernetworking/cni/pkg/skel"
|
||||
"github.com/containernetworking/cni/pkg/types"
|
||||
"github.com/containernetworking/cni/pkg/types/current"
|
||||
current "github.com/containernetworking/cni/pkg/types/100"
|
||||
"github.com/containernetworking/plugins/pkg/ipam"
|
||||
"github.com/vishvananda/netlink"
|
||||
"github.com/vishvananda/netns"
|
||||
weaveapi "github.com/weaveworks/weave/api"
|
||||
@@ -176,8 +177,17 @@ func setupRoutes(link netlink.Link, name string, ipnet net.IPNet, gw net.IP, rou
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CNIPlugin) CmdCheck(args *skel.CmdArgs) error {
|
||||
// TODO: Figure out how to do a proper CNI check here
|
||||
// For now, return not implemented error
|
||||
|
||||
return errors.New("CNI plugin check not implemented")
|
||||
}
|
||||
|
||||
// As of CNI 0.5 spec:
|
||||
// "Plugins should generally complete a DEL action without error even if some resources are missing"
|
||||
//
|
||||
// "Plugins should generally complete a DEL action without error even if some resources are missing"
|
||||
//
|
||||
// this method should therefore return nil in most, if not all, cases.
|
||||
func (c *CNIPlugin) CmdDel(args *skel.CmdArgs) error {
|
||||
conf, err := loadNetConf(args.StdinData)
|
||||
|
||||
Reference in new issue
Block a user