Skip to content

Commit

Permalink
Support MTU representation in NetworkStatus
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Sch <sebassch@gmail.com>
  • Loading branch information
SchSeba committed Mar 24, 2024
1 parent 509898b commit 9725049
Show file tree
Hide file tree
Showing 355 changed files with 3,524 additions and 961 deletions.
16 changes: 6 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ module github.com/k8snetworkplumbingwg/network-attachment-definition-client
go 1.21

require (
github.com/containernetworking/cni v1.0.1
github.com/emicklei/go-restful v2.16.0+incompatible // indirect
github.com/containernetworking/cni v1.2.0-rc1
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.29.0
golang.org/x/tools v0.12.0 // indirect
github.com/onsi/gomega v1.30.0
golang.org/x/tools v0.14.0 // indirect
k8s.io/api v0.29.0
k8s.io/apimachinery v0.29.0
k8s.io/client-go v0.29.0
Expand All @@ -18,8 +16,7 @@ require (
)

require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
Expand All @@ -44,14 +41,13 @@ require (
github.com/nxadm/tail v1.4.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
423 changes: 27 additions & 396 deletions go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pkg/apis/k8s.cni.cncf.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type NetworkStatus struct {
Interface string `json:"interface,omitempty"`
IPs []string `json:"ips,omitempty"`
Mac string `json:"mac,omitempty"`
Mtu int `json:"mtu,omitempty"`
Default bool `json:"default,omitempty"`
DNS DNS `json:"dns,omitempty"`
DeviceInfo *DeviceInfo `json:"device-info,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/net-attach-def.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func CreateNetworkStatus(r cnitypes.Result, networkName string, defaultNetwork b
if ifs.Sandbox != "" {
netStatus.Interface = ifs.Name
netStatus.Mac = ifs.Mac
netStatus.Mtu = ifs.Mtu
}
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/utils/net-attach-def_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ var _ = Describe("Netwok Attachment Definition manipulations", func() {
Interface: "eth0",
IPs: []string{"10.244.1.2"},
Mac: "92:79:27:01:7c:ce",
Mtu: 1500,
},
{
Name: "test-net-attach-def-1",
Expand Down Expand Up @@ -112,6 +113,7 @@ var _ = Describe("Netwok Attachment Definition manipulations", func() {
Name: "net1",
Mac: "92:79:27:01:7c:cf",
Sandbox: "/proc/1123/ns/net",
Mtu: 9000,
},
},
IPs: []*cni100.IPConfig{
Expand All @@ -131,6 +133,7 @@ var _ = Describe("Netwok Attachment Definition manipulations", func() {
It("create network status from cni result", func() {
Expect(networkStatus.Name).To(Equal("test-net-attach-def"))
Expect(networkStatus.Interface).To(Equal("net1"))
Expect(networkStatus.Mtu).To(Equal(9000))
Expect(networkStatus.Mac).To(Equal("92:79:27:01:7c:cf"))
Expect(networkStatus.IPs).To(Equal([]string{"1.1.1.3", "2001::1"}))
})
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/Masterminds/semver/v3/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions vendor/github.com/Masterminds/semver/v3/.golangci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

214 changes: 214 additions & 0 deletions vendor/github.com/Masterminds/semver/v3/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions vendor/github.com/Masterminds/semver/v3/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions vendor/github.com/Masterminds/semver/v3/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9725049

Please sign in to comment.