Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CNI Plugins to v1.1.1 #1997

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ multi-arch-cni-init-build-push: ## Build VPC CNI plugin Init container image
--push \
.
# Fetch the CNI plugins
plugins: FETCH_VERSION=0.9.0
plugins: FETCH_VERSION=1.1.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good idea. This is going to bring few changes.

index 21ab04f7..36adb6b1 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.18
 require (
        github.com/aws/aws-sdk-go v1.43.29
        github.com/containernetworking/cni v0.8.1
-       github.com/containernetworking/plugins v0.9.0
+       github.com/containernetworking/plugins v1.1.1
        github.com/coreos/go-iptables v0.4.5
        github.com/golang/mock v1.4.1
        github.com/golang/protobuf v1.4.3

And

$ go mod tidy
go: downloading github.com/containernetworking/plugins v1.1.1
go: downloading github.com/onsi/gomega v1.15.0
go: downloading github.com/containernetworking/cni v1.0.1
go: downloading github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
go: downloading github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1
go: downloading github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f
go: finding module for package github.com/containernetworking/cni/pkg/types/current
go: downloading github.com/containernetworking/cni v1.1.1
github.com/aws/amazon-vpc-cni-k8s/cmd/egress-v4-cni-plugin imports
	github.com/containernetworking/cni/pkg/types/current: module github.com/containernetworking/cni@latest found (v1.1.1), but does not contain package github.com/containernetworking/cni/pkg/types/current

the resolution seems like places we are using types/current (around 5 files) It should be updated.
Ref https://www.cni.dev/docs/spec-upgrades/#libcni-changes-in-cni-v10

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit in CNI introduces a breaking change for us as it removes Version field.

By removing current type in CNI, the CNI has broken the backwards compatibility too.

I am evaluating if it is a good idea to upgrade it by making necessary changes. The other option is only upgrade the binary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah maybe binary makes sense for now considering the criticality? @achevuru or @M00nF1sh any thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried to upgrade the library. We shall bring it separately. as removing of Version field fails make binaries.
We also have find a reliable way to different v4 and v6 addresses without that field.

# Updating to latest version.

$ make
go build  -buildmode=pie -ldflags '-s -w -X pkg/version/info.Version=v1.6.4-rc1-379-gc17158ef-dirty -X pkg/awsutils/awssession.version=v1.6.4-rc1-379-gc17158ef-dirty' -o aws-k8s-agent     ./cmd/aws-k8s-agent
go build  -buildmode=pie -ldflags '-s -w -X pkg/version/info.Version=v1.6.4-rc1-379-gc17158ef-dirty -X pkg/awsutils/awssession.version=v1.6.4-rc1-379-gc17158ef-dirty' -o aws-cni           ./cmd/routed-eni-cni-plugin
# github.com/aws/amazon-vpc-cni-k8s/cmd/routed-eni-cni-plugin
cmd/routed-eni-cni-plugin/cni.go:268:4: unknown field 'Version' in struct literal of type types100.IPConfig
make: *** [build-linux] Error 2

# Removing Version field as it was redundant

$ make
go build  -buildmode=pie -ldflags '-s -w -X pkg/version/info.Version=v1.6.4-rc1-379-gc17158ef-dirty -X pkg/awsutils/awssession.version=v1.6.4-rc1-379-gc17158ef-dirty' -o aws-k8s-agent     ./cmd/aws-k8s-agent
go build  -buildmode=pie -ldflags '-s -w -X pkg/version/info.Version=v1.6.4-rc1-379-gc17158ef-dirty -X pkg/awsutils/awssession.version=v1.6.4-rc1-379-gc17158ef-dirty' -o aws-cni           ./cmd/routed-eni-cni-plugin
go build  -buildmode=pie -ldflags '-s -w -X pkg/version/info.Version=v1.6.4-rc1-379-gc17158ef-dirty -X pkg/awsutils/awssession.version=v1.6.4-rc1-379-gc17158ef-dirty' -o grpc-health-probe ./cmd/grpc-health-probe
go build  -buildmode=pie -ldflags '-s -w -X pkg/version/info.Version=v1.6.4-rc1-379-gc17158ef-dirty -X pkg/awsutils/awssession.version=v1.6.4-rc1-379-gc17158ef-dirty' -o egress-v4-cni     ./cmd/egress-v4-cni-plugin
# github.com/aws/amazon-vpc-cni-k8s/cmd/egress-v4-cni-plugin
cmd/egress-v4-cni-plugin/cni.go:124:57: not enough arguments in call to ip.SetupVeth
	have (string, int, ns.NetNS)
	want (string, int, string, ns.NetNS)
cmd/egress-v4-cni-plugin/cni.go:166:11: ipc.Version undefined (type *types100.IPConfig has no field or method Version)
cmd/egress-v4-cni-plugin/cni.go:325:11: ipc.Version undefined (type *types100.IPConfig has no field or method Version)
make: *** [build-linux] Error 2


#  Without Version field we will have to find a reliable to to different IPV4 and IPV6 in the cmds we use.
[senthilx@88665a371033:~]$

plugins: FETCH_URL=https://github.com/containernetworking/plugins/releases/download/v$(FETCH_VERSION)/cni-plugins-$(GOOS)-$(GOARCH)-v$(FETCH_VERSION).tgz
plugins: VISIT_URL=https://github.com/containernetworking/plugins/tree/v$(FETCH_VERSION)/plugins/
plugins: ## Fetch the CNI plugins
Expand Down