Skip to content

Commit

Permalink
update cni version to 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Mar 28, 2022
1 parent df83c5f commit 9587ad4
Show file tree
Hide file tree
Showing 6 changed files with 294 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-arm64-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.17.5
go-version: 1.17.8
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.17.5
go-version: 1.17.8
id: go

- name: Check out code into the Go module directory
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
run: |
sh -c 'while :; do if [ $(kubectl get --no-headers subnet | wc -l) -eq 2 ]; then break; fi; sleep 5; done'
sh dist/images/cleanup.sh
- name: Check Node Network
run: |
sh -c '
Expand Down
10 changes: 4 additions & 6 deletions cmd/cni/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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"

kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
Expand Down Expand Up @@ -63,12 +63,12 @@ func cmdAdd(args *skel.CmdArgs) error {
return err
}

result := generateCNIResult(cniVersion, response)
result := generateCNIResult(response)
return types.PrintResult(&result, cniVersion)
}

func generateCNIResult(cniVersion string, cniResponse *request.CniResponse) current.Result {
result := current.Result{CNIVersion: cniVersion}
func generateCNIResult(cniResponse *request.CniResponse) current.Result {
result := current.Result{CNIVersion: current.ImplementedSpecVersion}
_, mask, _ := net.ParseCIDR(cniResponse.CIDR)
podIface := current.Interface{
Name: cniResponse.PodNicName,
Expand Down Expand Up @@ -202,7 +202,6 @@ func parseValueFromArgs(key, argString string) (string, error) {

func assignV4Address(ipAddress, gateway string, mask *net.IPNet) (current.IPConfig, types.Route) {
ip := current.IPConfig{
Version: "4",
Address: net.IPNet{IP: net.ParseIP(ipAddress).To4(), Mask: mask.Mask},
Gateway: net.ParseIP(gateway).To4(),
}
Expand All @@ -217,7 +216,6 @@ func assignV4Address(ipAddress, gateway string, mask *net.IPNet) (current.IPConf

func assignV6Address(ipAddress, gateway string, mask *net.IPNet) (current.IPConfig, types.Route) {
ip := current.IPConfig{
Version: "6",
Address: net.IPNet{IP: net.ParseIP(ipAddress).To16(), Mask: mask.Mask},
Gateway: net.ParseIP(gateway).To16(),
}
Expand Down
12 changes: 6 additions & 6 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

##### Prerequisites:

1. Kube-OVN is developed by [Go](https://golang.org/) 1.16 and uses [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependency. Make sure `GO111MODULE="on"`.
1. Kube-OVN is developed by [Go](https://golang.org/) 1.17 and uses [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependency. Make sure `GO111MODULE="on"`.

2. We also use [gosec](https://github.com/securego/gosec) to inspects source code for security problems.
2. We also use [gosec](https://github.com/securego/gosec) to inspects source code for security problems.

```shell
go get github.com/securego/gosec/v2/cmd/gosec
```

3. To minimize image size we use docker experimental buildx features.
3. To minimize image size we use docker experimental buildx features.

​ For version < Docker 19.03, please enable it manually through the [reference](https://docs.docker.com/develop/develop-images/build_enhancements/).
​ For version < Docker 19.03, please enable it manually through the [reference](https://docs.docker.com/develop/develop-images/build_enhancements/).

​ Buildx could also be installed from official [doc](https://github.com/docker/buildx/).

Expand All @@ -24,7 +24,7 @@ go get github.com/securego/gosec/v2/cmd/gosec
docker buildx create --use
```

##### Make:
##### Make:

```shell
git clone https://github.com/kubeovn/kube-ovn.git
Expand All @@ -35,7 +35,7 @@ make release

## How to run e2e tests

Kube-OVN uses [KIND](https://kind.sigs.k8s.io/) to setup a local Kubernetes cluster and [j2cli](https://github.com/kolypto/j2cli) to render template
Kube-OVN uses [KIND](https://kind.sigs.k8s.io/) to setup a local Kubernetes cluster and [j2cli](https://github.com/kolypto/j2cli) to render template
and [Ginkgo](https://onsi.github.io/ginkgo/) as the test framework to run the e2e tests.

```shell
Expand Down
25 changes: 13 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ require (
github.com/Mellanox/sriovnet v1.0.3
github.com/alauda/felix v3.6.6-0.20201207121355-187332daf314+incompatible
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08
github.com/containernetworking/cni v0.8.1
github.com/containernetworking/plugins v0.9.1
github.com/containernetworking/cni v1.0.1
github.com/containernetworking/plugins v1.1.1
github.com/coreos/go-iptables v0.6.0
github.com/emicklei/go-restful/v3 v3.7.3
github.com/emicklei/go-restful/v3 v3.7.4
github.com/golang/protobuf v1.5.2
github.com/greenpau/ovsdb v0.0.0-20181114004433-3582b85e8968
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.1.1-0.20210510153419-66a699ae3b05
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.2.0
github.com/mdlayher/arp v0.0.0-20191213142603-f72070a231fc
github.com/neverlee/keymutex v0.0.0-20171121013845-f593aa834bf9
github.com/oilbeater/go-ping v0.0.0-20200413021620-332b7197c5b5
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.17.0
github.com/onsi/gomega v1.18.1
github.com/osrg/gobgp v0.0.0-20190401195721-805d02fdfbc5
github.com/parnurzeal/gorequest v0.2.16
github.com/prometheus/client_golang v1.11.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/vishvananda/netlink v1.1.1-0.20211101163509-b10eb8fe5cf6
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8
google.golang.org/grpc v1.40.0
gopkg.in/k8snetworkplumbingwg/multus-cni.v3 v3.7.2
k8s.io/api v0.23.1
k8s.io/apimachinery v0.23.1
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog/v2 v2.30.0
k8s.io/klog/v2 v2.40.1
k8s.io/kubernetes v1.23.1
k8s.io/sample-controller v0.23.1
kubevirt.io/client-go v0.50.0
Expand All @@ -53,7 +53,7 @@ require (
github.com/go-ini/ini v1.42.0 // indirect
github.com/go-kit/kit v0.9.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
Expand Down Expand Up @@ -101,9 +101,9 @@ require (
github.com/stretchr/objx v0.3.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
Expand All @@ -120,15 +120,15 @@ require (
k8s.io/cluster-bootstrap v0.0.0 // indirect
k8s.io/component-base v0.23.1 // indirect
k8s.io/component-helpers v0.23.1 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect
k8s.io/kube-proxy v0.0.0 // indirect
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
kubevirt.io/api v0.50.0 // indirect
kubevirt.io/containerized-data-importer-api v1.42.0 // indirect
kubevirt.io/controller-lifecycle-operator-sdk v0.2.1 // indirect
moul.io/http2curl v1.0.0 // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

Expand All @@ -139,6 +139,7 @@ replace (
github.com/openshift/api => github.com/openshift/api v0.0.0-20210428205234-a8389931bee7
github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20210112165513-ebc401615f47
github.com/openshift/library-go => github.com/mhenriks/library-go v0.0.0-20210511195009-51ba86622560
gopkg.in/k8snetworkplumbingwg/multus-cni.v3 => github.com/k8snetworkplumbingwg/multus-cni v0.0.0-20220308162416-497ddfe315a9
k8s.io/api => k8s.io/api v0.23.1
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.23.1
k8s.io/apimachinery => k8s.io/apimachinery v0.23.1
Expand Down

0 comments on commit 9587ad4

Please sign in to comment.