flannel: set the cniVersion on the delegated config

Fixes: #23
This commit is contained in:
Casey Callendrello 2017-06-16 19:04:07 +02:00
parent 5bbff37294
commit 8c5e754617
2 changed files with 9 additions and 1 deletions

View File

@ -224,6 +224,9 @@ func cmdAdd(args *skel.CmdArgs) error {
n.Delegate["isGateway"] = true
}
}
if n.CNIVersion != "" {
n.Delegate["cniVersion"] = n.CNIVersion
}
n.Delegate["ipam"] = map[string]interface{}{
"type": "host-local",

View File

@ -19,6 +19,7 @@ import (
"os"
"github.com/containernetworking/cni/pkg/skel"
"github.com/containernetworking/cni/pkg/types/current"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/testutils"
@ -102,7 +103,7 @@ FLANNEL_IPMASQ=true
defer GinkgoRecover()
By("calling ADD")
_, _, err := testutils.CmdAddWithResult(targetNs.Path(), IFNAME, []byte(input), func() error {
resI, _, err := testutils.CmdAddWithResult(targetNs.Path(), IFNAME, []byte(input), func() error {
return cmdAdd(args)
})
Expect(err).NotTo(HaveOccurred())
@ -132,6 +133,10 @@ FLANNEL_IPMASQ=true
`
Expect(netConfBytes).Should(MatchJSON(expected))
result, err := current.NewResultFromResult(resI)
Expect(err).NotTo(HaveOccurred())
Expect(result.IPs).To(HaveLen(1))
By("calling DEL")
err = testutils.CmdDelWithResult(targetNs.Path(), IFNAME, func() error {
return cmdDel(args)