update github.com/containernetworking/cni (#1537)
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
This commit is contained in:
Родитель
6ef6319dbd
Коммит
2417b7effc
|
@ -13,10 +13,9 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/ipam"
|
"github.com/Azure/azure-container-networking/ipam"
|
||||||
"github.com/Azure/azure-container-networking/log"
|
"github.com/Azure/azure-container-networking/log"
|
||||||
"github.com/Azure/azure-container-networking/platform"
|
"github.com/Azure/azure-container-networking/platform"
|
||||||
|
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ipamV6 = "azure-vnet-ipamv6"
|
const ipamV6 = "azure-vnet-ipamv6"
|
||||||
|
@ -215,16 +214,10 @@ func (plugin *ipamPlugin) Add(args *cniSkel.CmdArgs) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
version := "4"
|
|
||||||
if ipAddress.IP.To4() == nil {
|
|
||||||
version = "6"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Populate result.
|
// Populate result.
|
||||||
result = &cniTypesCurr.Result{
|
result = &cniTypesCurr.Result{
|
||||||
IPs: []*cniTypesCurr.IPConfig{
|
IPs: []*cniTypesCurr.IPConfig{
|
||||||
{
|
{
|
||||||
Version: version,
|
|
||||||
Address: *ipAddress,
|
Address: *ipAddress,
|
||||||
Gateway: apInfo.Gateway,
|
Gateway: apInfo.Gateway,
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/cni"
|
"github.com/Azure/azure-container-networking/cni"
|
||||||
"github.com/Azure/azure-container-networking/cns"
|
"github.com/Azure/azure-container-networking/cns"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IPAMInvoker is used by the azure-vnet CNI plugin to call different sources for IPAM.
|
// IPAMInvoker is used by the azure-vnet CNI plugin to call different sources for IPAM.
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/platform"
|
"github.com/Azure/azure-container-networking/platform"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AzureIPAMInvoker struct {
|
type AzureIPAMInvoker struct {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/network"
|
"github.com/Azure/azure-container-networking/network"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/network/networkutils"
|
"github.com/Azure/azure-container-networking/network/networkutils"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -119,7 +119,6 @@ func (invoker *CNSIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, erro
|
||||||
addResult.ipv4Result = &cniTypesCurr.Result{
|
addResult.ipv4Result = &cniTypesCurr.Result{
|
||||||
IPs: []*cniTypesCurr.IPConfig{
|
IPs: []*cniTypesCurr.IPConfig{
|
||||||
{
|
{
|
||||||
Version: "4",
|
|
||||||
Address: resultIPnet,
|
Address: resultIPnet,
|
||||||
Gateway: ncgw,
|
Gateway: ncgw,
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/network"
|
"github.com/Azure/azure-container-networking/network"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -97,7 +97,6 @@ func TestCNSIPAMInvoker_Add(t *testing.T) {
|
||||||
want: &cniTypesCurr.Result{
|
want: &cniTypesCurr.Result{
|
||||||
IPs: []*cniTypesCurr.IPConfig{
|
IPs: []*cniTypesCurr.IPConfig{
|
||||||
{
|
{
|
||||||
Version: "4",
|
|
||||||
Address: *getCIDRNotationForAddress("10.0.1.10/24"),
|
Address: *getCIDRNotationForAddress("10.0.1.10/24"),
|
||||||
Gateway: net.ParseIP("10.0.0.1"),
|
Gateway: net.ParseIP("10.0.0.1"),
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/Azure/azure-container-networking/cni"
|
"github.com/Azure/azure-container-networking/cni"
|
||||||
"github.com/containernetworking/cni/pkg/skel"
|
"github.com/containernetworking/cni/pkg/skel"
|
||||||
"github.com/containernetworking/cni/pkg/types/current"
|
current "github.com/containernetworking/cni/pkg/types/100"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -53,7 +53,7 @@ func (invoker *MockIpamInvoker) Add(opt IPAMAddConfig) (ipamAddResult IPAMAddRes
|
||||||
ip := net.ParseIP(ipv4Str)
|
ip := net.ParseIP(ipv4Str)
|
||||||
ipnet := net.IPNet{IP: ip, Mask: net.CIDRMask(subnetBits, ipv4Bits)}
|
ipnet := net.IPNet{IP: ip, Mask: net.CIDRMask(subnetBits, ipv4Bits)}
|
||||||
gwIP := net.ParseIP("10.240.0.1")
|
gwIP := net.ParseIP("10.240.0.1")
|
||||||
ipConfig := ¤t.IPConfig{Address: ipnet, Gateway: gwIP, Version: "4"}
|
ipConfig := ¤t.IPConfig{Address: ipnet, Gateway: gwIP}
|
||||||
ipamAddResult.ipv4Result = ¤t.Result{}
|
ipamAddResult.ipv4Result = ¤t.Result{}
|
||||||
ipamAddResult.ipv4Result.IPs = append(ipamAddResult.ipv4Result.IPs, ipConfig)
|
ipamAddResult.ipv4Result.IPs = append(ipamAddResult.ipv4Result.IPs, ipConfig)
|
||||||
invoker.ipMap[ipnet.String()] = true
|
invoker.ipMap[ipnet.String()] = true
|
||||||
|
@ -70,7 +70,7 @@ func (invoker *MockIpamInvoker) Add(opt IPAMAddConfig) (ipamAddResult IPAMAddRes
|
||||||
ip := net.ParseIP(ipv6Str)
|
ip := net.ParseIP(ipv6Str)
|
||||||
ipnet := net.IPNet{IP: ip, Mask: net.CIDRMask(subnetv6Bits, ipv6Bits)}
|
ipnet := net.IPNet{IP: ip, Mask: net.CIDRMask(subnetv6Bits, ipv6Bits)}
|
||||||
gwIP := net.ParseIP("fc00::1")
|
gwIP := net.ParseIP("fc00::1")
|
||||||
ipConfig := ¤t.IPConfig{Address: ipnet, Gateway: gwIP, Version: "6"}
|
ipConfig := ¤t.IPConfig{Address: ipnet, Gateway: gwIP}
|
||||||
ipamAddResult.ipv6Result = ¤t.Result{}
|
ipamAddResult.ipv6Result = ¤t.Result{}
|
||||||
ipamAddResult.ipv6Result.IPs = append(ipamAddResult.ipv6Result.IPs, ipConfig)
|
ipamAddResult.ipv6Result.IPs = append(ipamAddResult.ipv6Result.IPs, ipConfig)
|
||||||
invoker.ipMap[ipnet.String()] = true
|
invoker.ipMap[ipnet.String()] = true
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/log"
|
"github.com/Azure/azure-container-networking/log"
|
||||||
"github.com/Azure/azure-container-networking/network"
|
"github.com/Azure/azure-container-networking/network"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -243,10 +243,8 @@ func convertToCniResult(networkConfig *cns.GetNetworkContainerResponse, ifName s
|
||||||
ipAddr := net.ParseIP(ipconfig.IPSubnet.IPAddress)
|
ipAddr := net.ParseIP(ipconfig.IPSubnet.IPAddress)
|
||||||
|
|
||||||
if ipAddr.To4() != nil {
|
if ipAddr.To4() != nil {
|
||||||
resultIpconfig.Version = "4"
|
|
||||||
resultIpconfig.Address = net.IPNet{IP: ipAddr, Mask: net.CIDRMask(int(ipconfig.IPSubnet.PrefixLength), 32)}
|
resultIpconfig.Address = net.IPNet{IP: ipAddr, Mask: net.CIDRMask(int(ipconfig.IPSubnet.PrefixLength), 32)}
|
||||||
} else {
|
} else {
|
||||||
resultIpconfig.Version = "6"
|
|
||||||
resultIpconfig.Address = net.IPNet{IP: ipAddr, Mask: net.CIDRMask(int(ipconfig.IPSubnet.PrefixLength), 128)}
|
resultIpconfig.Address = net.IPNet{IP: ipAddr, Mask: net.CIDRMask(int(ipconfig.IPSubnet.PrefixLength), 128)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/cni"
|
"github.com/Azure/azure-container-networking/cni"
|
||||||
"github.com/Azure/azure-container-networking/cns"
|
"github.com/Azure/azure-container-networking/cns"
|
||||||
"github.com/Azure/azure-container-networking/network"
|
"github.com/Azure/azure-container-networking/network"
|
||||||
"github.com/containernetworking/cni/pkg/types/current"
|
current "github.com/containernetworking/cni/pkg/types/100"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MockMultitenancy struct {
|
type MockMultitenancy struct {
|
||||||
|
@ -46,7 +46,8 @@ func (m *MockMultitenancy) GetContainerNetworkConfiguration(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
nwCfg *cni.NetworkConfig,
|
nwCfg *cni.NetworkConfig,
|
||||||
podName string,
|
podName string,
|
||||||
podNamespace string) (*cns.GetNetworkContainerResponse, net.IPNet, error) {
|
podNamespace string,
|
||||||
|
) (*cns.GetNetworkContainerResponse, net.IPNet, error) {
|
||||||
if m.fail {
|
if m.fail {
|
||||||
return nil, net.IPNet{}, errMockMulAdd
|
return nil, net.IPNet{}, errMockMulAdd
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/cns"
|
"github.com/Azure/azure-container-networking/cns"
|
||||||
"github.com/Azure/azure-container-networking/network"
|
"github.com/Azure/azure-container-networking/network"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -304,7 +304,6 @@ func TestGetMultiTenancyCNIResult(t *testing.T) {
|
||||||
},
|
},
|
||||||
IPs: []*cniTypesCurr.IPConfig{
|
IPs: []*cniTypesCurr.IPConfig{
|
||||||
{
|
{
|
||||||
Version: "4",
|
|
||||||
Address: getIPNet(net.IPv4(10, 1, 0, 5), net.CIDRMask(16, 32)),
|
Address: getIPNet(net.IPv4(10, 1, 0, 5), net.CIDRMask(16, 32)),
|
||||||
Gateway: net.ParseIP("10.1.0.1"),
|
Gateway: net.ParseIP("10.1.0.1"),
|
||||||
},
|
},
|
||||||
|
@ -354,7 +353,6 @@ func TestGetMultiTenancyCNIResult(t *testing.T) {
|
||||||
want3: &cniTypesCurr.Result{
|
want3: &cniTypesCurr.Result{
|
||||||
IPs: []*cniTypesCurr.IPConfig{
|
IPs: []*cniTypesCurr.IPConfig{
|
||||||
{
|
{
|
||||||
Version: "4",
|
|
||||||
Address: net.IPNet{
|
Address: net.IPNet{
|
||||||
IP: net.ParseIP("10.240.0.5"),
|
IP: net.ParseIP("10.240.0.5"),
|
||||||
Mask: net.CIDRMask(24, 32),
|
Mask: net.CIDRMask(24, 32),
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/telemetry"
|
"github.com/Azure/azure-container-networking/telemetry"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ const (
|
||||||
dockerNetworkOption = "com.docker.network.generic"
|
dockerNetworkOption = "com.docker.network.generic"
|
||||||
opModeTransparent = "transparent"
|
opModeTransparent = "transparent"
|
||||||
// Supported IP version. Currently support only IPv4
|
// Supported IP version. Currently support only IPv4
|
||||||
ipVersion = "4"
|
|
||||||
ipamV6 = "azure-vnet-ipamv6"
|
ipamV6 = "azure-vnet-ipamv6"
|
||||||
defaultRequestTimeout = 15 * time.Second
|
defaultRequestTimeout = 15 * time.Second
|
||||||
)
|
)
|
||||||
|
@ -841,7 +840,6 @@ func (plugin *NetPlugin) Get(args *cniSkel.CmdArgs) error {
|
||||||
|
|
||||||
for _, ipAddresses := range epInfo.IPAddresses {
|
for _, ipAddresses := range epInfo.IPAddresses {
|
||||||
ipConfig := &cniTypesCurr.IPConfig{
|
ipConfig := &cniTypesCurr.IPConfig{
|
||||||
Version: ipVersion,
|
|
||||||
Interface: &epInfo.IfIndex,
|
Interface: &epInfo.IfIndex,
|
||||||
Address: ipAddresses,
|
Address: ipAddresses,
|
||||||
}
|
}
|
||||||
|
@ -1224,7 +1222,6 @@ func convertNnsToCniResult(
|
||||||
ipConfig := &cniTypesCurr.IPConfig{
|
ipConfig := &cniTypesCurr.IPConfig{
|
||||||
Address: *ipNet,
|
Address: *ipNet,
|
||||||
Gateway: gateway,
|
Gateway: gateway,
|
||||||
Version: ip.Version,
|
|
||||||
Interface: &intIndex,
|
Interface: &intIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/Azure/azure-container-networking/network/policy"
|
"github.com/Azure/azure-container-networking/network/policy"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -23,7 +23,8 @@ const snatConfigFileName = "/tmp/snatConfig"
|
||||||
|
|
||||||
// handleConsecutiveAdd is a dummy function for Linux platform.
|
// handleConsecutiveAdd is a dummy function for Linux platform.
|
||||||
func (plugin *NetPlugin) handleConsecutiveAdd(args *cniSkel.CmdArgs, endpointID string, networkID string,
|
func (plugin *NetPlugin) handleConsecutiveAdd(args *cniSkel.CmdArgs, endpointID string, networkID string,
|
||||||
nwInfo *network.NetworkInfo, nwCfg *cni.NetworkConfig) (*cniTypesCurr.Result, error) {
|
nwInfo *network.NetworkInfo, nwCfg *cni.NetworkConfig,
|
||||||
|
) (*cniTypesCurr.Result, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +88,8 @@ func setupInfraVnetRoutingForMultitenancy(
|
||||||
nwCfg *cni.NetworkConfig,
|
nwCfg *cni.NetworkConfig,
|
||||||
azIpamResult *cniTypesCurr.Result,
|
azIpamResult *cniTypesCurr.Result,
|
||||||
epInfo *network.EndpointInfo,
|
epInfo *network.EndpointInfo,
|
||||||
result *cniTypesCurr.Result) {
|
result *cniTypesCurr.Result,
|
||||||
|
) {
|
||||||
if epInfo.EnableInfraVnet {
|
if epInfo.EnableInfraVnet {
|
||||||
_, ipNet, _ := net.ParseCIDR(nwCfg.InfraVnetAddressSpace)
|
_, ipNet, _ := net.ParseCIDR(nwCfg.InfraVnetAddressSpace)
|
||||||
epInfo.Routes = append(epInfo.Routes, network.RouteInfo{Dst: *ipNet, Gw: azIpamResult.IPs[0].Gateway, DevName: infraInterface})
|
epInfo.Routes = append(epInfo.Routes, network.RouteInfo{Dst: *ipNet, Gw: azIpamResult.IPs[0].Gateway, DevName: infraInterface})
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
"github.com/Azure/azure-container-networking/cns"
|
"github.com/Azure/azure-container-networking/cns"
|
||||||
"github.com/Azure/azure-container-networking/network"
|
"github.com/Azure/azure-container-networking/network"
|
||||||
"github.com/containernetworking/cni/pkg/types/current"
|
current "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
hnsv2 "github.com/Microsoft/hcsshim/hcn"
|
hnsv2 "github.com/Microsoft/hcsshim/hcn"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/sys/windows/registry"
|
"golang.org/x/sys/windows/registry"
|
||||||
)
|
)
|
||||||
|
@ -70,7 +70,6 @@ func (plugin *NetPlugin) handleConsecutiveAdd(args *cniSkel.CmdArgs, endpointId
|
||||||
result := &cniTypesCurr.Result{
|
result := &cniTypesCurr.Result{
|
||||||
IPs: []*cniTypesCurr.IPConfig{
|
IPs: []*cniTypesCurr.IPConfig{
|
||||||
{
|
{
|
||||||
Version: "4",
|
|
||||||
Address: address,
|
Address: address,
|
||||||
Gateway: net.ParseIP(hnsEndpoint.GatewayAddress),
|
Gateway: net.ParseIP(hnsEndpoint.GatewayAddress),
|
||||||
},
|
},
|
||||||
|
@ -85,7 +84,6 @@ func (plugin *NetPlugin) handleConsecutiveAdd(args *cniSkel.CmdArgs, endpointId
|
||||||
|
|
||||||
if nwCfg.IPV6Mode != "" && len(epInfo.IPAddresses) > 1 {
|
if nwCfg.IPV6Mode != "" && len(epInfo.IPAddresses) > 1 {
|
||||||
ipv6Config := &cniTypesCurr.IPConfig{
|
ipv6Config := &cniTypesCurr.IPConfig{
|
||||||
Version: "6",
|
|
||||||
Address: epInfo.IPAddresses[1],
|
Address: epInfo.IPAddresses[1],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,17 @@ package network
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Azure/azure-container-networking/network/hnswrapper"
|
|
||||||
"net"
|
"net"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Azure/azure-container-networking/cni"
|
"github.com/Azure/azure-container-networking/cni"
|
||||||
"github.com/Azure/azure-container-networking/cns"
|
"github.com/Azure/azure-container-networking/cns"
|
||||||
"github.com/Azure/azure-container-networking/network"
|
"github.com/Azure/azure-container-networking/network"
|
||||||
|
"github.com/Azure/azure-container-networking/network/hnswrapper"
|
||||||
"github.com/Azure/azure-container-networking/network/policy"
|
"github.com/Azure/azure-container-networking/network/policy"
|
||||||
"github.com/Azure/azure-container-networking/telemetry"
|
"github.com/Azure/azure-container-networking/telemetry"
|
||||||
"github.com/containernetworking/cni/pkg/skel"
|
"github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -24,6 +24,7 @@ func init() {
|
||||||
network.Hnsv2 = hnswrapper.NewHnsv2wrapperFake()
|
network.Hnsv2 = hnswrapper.NewHnsv2wrapperFake()
|
||||||
network.Hnsv1 = hnswrapper.NewHnsv1wrapperFake()
|
network.Hnsv1 = hnswrapper.NewHnsv1wrapperFake()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test windows network policies is set
|
// Test windows network policies is set
|
||||||
func TestAddWithRunTimeNetPolicies(t *testing.T) {
|
func TestAddWithRunTimeNetPolicies(t *testing.T) {
|
||||||
_, ipnetv4, _ := net.ParseCIDR("10.240.0.0/12")
|
_, ipnetv4, _ := net.ParseCIDR("10.240.0.0/12")
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
cniInvoke "github.com/containernetworking/cni/pkg/invoke"
|
cniInvoke "github.com/containernetworking/cni/pkg/invoke"
|
||||||
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
cniSkel "github.com/containernetworking/cni/pkg/skel"
|
||||||
cniTypes "github.com/containernetworking/cni/pkg/types"
|
cniTypes "github.com/containernetworking/cni/pkg/types"
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
cniVers "github.com/containernetworking/cni/pkg/version"
|
cniVers "github.com/containernetworking/cni/pkg/version"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -11,7 +11,7 @@ require (
|
||||||
github.com/Microsoft/hcsshim v0.8.23
|
github.com/Microsoft/hcsshim v0.8.23
|
||||||
github.com/avast/retry-go/v3 v3.1.1
|
github.com/avast/retry-go/v3 v3.1.1
|
||||||
github.com/billgraziano/dpapi v0.4.0
|
github.com/billgraziano/dpapi v0.4.0
|
||||||
github.com/containernetworking/cni v0.8.1
|
github.com/containernetworking/cni v1.1.2
|
||||||
github.com/docker/libnetwork v0.8.0-dev.2.0.20210525090646-64b7a4574d14
|
github.com/docker/libnetwork v0.8.0-dev.2.0.20210525090646-64b7a4574d14
|
||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
|
|
6
go.sum
6
go.sum
|
@ -231,6 +231,8 @@ github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ
|
||||||
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
||||||
github.com/containernetworking/cni v0.8.1 h1:7zpDnQ3T3s4ucOuJ/ZCLrYBxzkg0AELFfII3Epo9TmI=
|
github.com/containernetworking/cni v0.8.1 h1:7zpDnQ3T3s4ucOuJ/ZCLrYBxzkg0AELFfII3Epo9TmI=
|
||||||
github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
|
||||||
|
github.com/containernetworking/cni v1.1.2 h1:wtRGZVv7olUHMOqouPpn3cXJWpJgM6+EUl31EQbXALQ=
|
||||||
|
github.com/containernetworking/cni v1.1.2/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=
|
||||||
github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM=
|
github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM=
|
||||||
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
|
github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8=
|
||||||
github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc=
|
github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc=
|
||||||
|
@ -365,6 +367,7 @@ github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh
|
||||||
github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=
|
github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=
|
||||||
github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||||
github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
||||||
github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
||||||
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
|
@ -462,6 +465,7 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
|
||||||
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
|
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
@ -655,6 +659,7 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
|
||||||
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||||
github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
|
github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
|
||||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||||
|
github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
|
||||||
github.com/onsi/gomega v1.10.0 h1:Gwkk+PTu/nfOwNMtUB/mRUv0X7ewW5dO4AERT1ThVKo=
|
github.com/onsi/gomega v1.10.0 h1:Gwkk+PTu/nfOwNMtUB/mRUv0X7ewW5dO4AERT1ThVKo=
|
||||||
github.com/onsi/gomega v1.10.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
github.com/onsi/gomega v1.10.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
||||||
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||||
|
@ -1219,6 +1224,7 @@ golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4X
|
||||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
|
|
@ -10,11 +10,10 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
|
"github.com/Azure/azure-container-networking/common"
|
||||||
|
cniTypesCurr "github.com/containernetworking/cni/pkg/types/100"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/Azure/azure-container-networking/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Загрузка…
Ссылка в новой задаче