Skip to content

Commit

Permalink
Merge pull request #9 from darkowlzz/cni-100
Browse files Browse the repository at this point in the history
Update CNI dependencies to v1.0.0
  • Loading branch information
kzys committed Oct 22, 2021
2 parents a030097 + f0b7268 commit ccb32b9
Show file tree
Hide file tree
Showing 8 changed files with 930 additions and 29 deletions.
7 changes: 3 additions & 4 deletions cmd/tc-redirect-tap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ package main

import (
"encoding/json"
pluginargs "github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap/args"
"os"
"strconv"
"strings"

"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/cni/pkg/version"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containernetworking/plugins/pkg/utils/buildversion"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"

pluginargs "github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap/args"
"github.com/awslabs/tc-redirect-tap/internal"
)

func main() {
skel.PluginMain(add, check, del,
// support CNI versions that support plugin chaining
version.PluginSupports("0.3.0", "0.3.1", version.Current()),
version.PluginSupports("0.3.0", "0.3.1", "0.4.0", version.Current()),
buildversion.BuildString("tc-redirect-tap"),
)
}
Expand Down Expand Up @@ -288,7 +288,6 @@ func (p plugin) add() error {
// Add the IP configuration that should be applied to the VM internally by
// associating the IPConfig with the vmIface. We use the redirectIface's IP.
p.currentResult.IPs = append(p.currentResult.IPs, &current.IPConfig{
Version: redirectIP.Version,
Address: redirectIP.Address,
Gateway: redirectIP.Gateway,
Interface: &vmIfaceIndex,
Expand Down
3 changes: 1 addition & 2 deletions cmd/tc-redirect-tap/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"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/cni/pkg/version"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -98,7 +98,6 @@ func defaultTestPlugin() *plugin {
Mac: redirectMac.String(),
}},
IPs: []*current.IPConfig{{
Version: "4",
Interface: &redirectIfacesIndex,
Address: net.IPNet{
IP: net.IPv4(10, 0, 0, 2),
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/awslabs/tc-redirect-tap
go 1.11

require (
github.com/containernetworking/cni v0.7.1
github.com/containernetworking/plugins v0.8.6
github.com/containernetworking/cni v1.0.0
github.com/containernetworking/plugins v1.0.0
github.com/hashicorp/go-multierror v1.1.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.3.0
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
github.com/stretchr/testify v1.6.1
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
)
927 changes: 917 additions & 10 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/cniutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package internal
import (
"fmt"

"github.com/containernetworking/cni/pkg/types/current"
current "github.com/containernetworking/cni/pkg/types/100"
"github.com/pkg/errors"
)

Expand Down
5 changes: 1 addition & 4 deletions internal/cniutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"net"
"testing"

"github.com/containernetworking/cni/pkg/types/current"
current "github.com/containernetworking/cni/pkg/types/100"
"github.com/containernetworking/cni/pkg/version"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -51,7 +51,6 @@ func TestInterfaceIPs(t *testing.T) {
},
IPs: []*current.IPConfig{
{
Version: "4",
Interface: &vethIndex,
Address: net.IPNet{
IP: net.IPv4(10, 0, 0, 2),
Expand All @@ -60,7 +59,6 @@ func TestInterfaceIPs(t *testing.T) {
Gateway: net.IPv4(10, 0, 0, 1),
},
{
Version: "4",
Interface: &vmIndex,
Address: net.IPNet{
IP: net.IPv4(10, 0, 1, 2),
Expand All @@ -69,7 +67,6 @@ func TestInterfaceIPs(t *testing.T) {
Gateway: net.IPv4(10, 0, 1, 1),
},
{
Version: "4",
Interface: &vethIndex,
Address: net.IPNet{
IP: net.IPv4(192, 168, 0, 2),
Expand Down
2 changes: 1 addition & 1 deletion vmconf/vmconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"strings"

"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/ns"
"github.com/pkg/errors"

Expand Down
3 changes: 1 addition & 2 deletions vmconf/vmconf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"testing"

"github.com/containernetworking/cni/pkg/types"
"github.com/containernetworking/cni/pkg/types/current"
current "github.com/containernetworking/cni/pkg/types/100"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/vishvananda/netlink"
Expand Down Expand Up @@ -69,7 +69,6 @@ func TestIPBootParams(t *testing.T) {
VMIfName: "eth0",
VMMTU: 1337,
VMIPConfig: &current.IPConfig{
Version: "4",
Address: net.IPNet{
IP: net.IPv4(10, 0, 0, 2),
Mask: net.IPv4Mask(255, 255, 255, 0),
Expand Down

0 comments on commit ccb32b9

Please sign in to comment.