-
Notifications
You must be signed in to change notification settings - Fork 613
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 containernetworking/cni dependency to v1.1.2 and the vpc-cni plugin version #3702
Conversation
065763e
to
9e8cc30
Compare
9e8cc30
to
1eb0a87
Compare
1eb0a87
to
0b2a4b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps out of scope of this PR, but would we want to do a similar upgrade with our github.com/containernetworking/plugins
dependency?
agent/ecscni/namespace_helper.go
Outdated
@@ -16,9 +16,10 @@ package ecscni | |||
import ( | |||
"context" | |||
|
|||
current "github.com/containernetworking/cni/pkg/types/100" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aws/amazon-ecs-cni-plugins@f216cc7
We'll need to validate that the updated version doesn't break any of our calls. The above change in the cni-plugins library was reverted because the api contract changed between versions, which meant that the delete function for IPAM cleanup was not being executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. It would be great if you add the Testing Done section to the PR. The DEL command of the CNI plugin can fail silently. It would be nice to make sure there are no failures for an awsvpc task with/without trunking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing has been completed with the latest changes to the PR (both commits), and we have verified that there were no errors with the DEL command (nor any other failures.) ✅
agent/ecscni/plugin_windows_test.go
Outdated
"github.com/golang/mock/gomock" | ||
"github.com/pkg/errors" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/containernetworking/cni/libcni" | ||
current "github.com/containernetworking/cni/pkg/types/100" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Current" is too generic for a package name. Can we please call this "cniTypesCurrent" to remain consistent with how we name it in CNI repos? Multiple instances in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out, I'll update the naming.
agent/ecscni/plugin_windows.go
Outdated
"github.com/cihub/seelog" | ||
"github.com/containernetworking/cni/libcni" | ||
"github.com/containernetworking/cni/pkg/types/current" | ||
cnitypes "github.com/containernetworking/cni/pkg/types" | ||
current "github.com/containernetworking/cni/pkg/types/100" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comment. "cniTypes" and "cniTypesCurrent" might be better names.
0b2a4b7
to
dd1e8b0
Compare
dd1e8b0
to
6733da5
Compare
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/aws/amazon-ecs-agent/agent/dockerclient" | ||
"github.com/aws/amazon-ecs-agent/agent/ec2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: The convention is to list the packages imported from the same repo (github.com/aws/amazon-ecs-agent) first, and then 3rd party repos. Hence the original position seem correct. Were these changes made by your editor, or by you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done by my editor, I have some settings enabled to organize specific groupings but it won't re-order the groups. A lot of the import groupings/ordering throughout the repo aren't conventional/organized so if I touch a file, the imports are almost always automatically modified. A full re-ordering causes a larger diff which isn't important for this PR but I think this is a good step towards correcting these files for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to mention: the original placement was deemed incorrect because they were grouped with 3rd party imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that we don't need a full re-ordering. But if you do touch them (as in here), please make sure you follow the convention of
Group1: Standard go packages (fmt, net, etc.)
Group2: Packages from same repo (anything that starts with amazon-ecs-agent)
Gorup3: Everything else.
"github.com/aws/amazon-ecs-agent/agent/dockerclient" | ||
"github.com/aws/amazon-ecs-agent/agent/ec2" | ||
cnitypes "github.com/containernetworking/cni/pkg/types" | ||
cniTypes "github.com/containernetworking/cni/pkg/types" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Thanks for making these changes. I didn't know that some parts of the agent code already used the alias "cnitypes". My original comment was only about renaming "types" and "current" to "cniTypes" and "cniTypesCurrent". We didn't need to touch code that used "cnitypes", we probably don't care about lowercase vs. uppercase "t".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, we can just leave these as-is since they're here now.
|
||
const ( | ||
currentCNISpec = "0.3.1" | ||
"github.com/aws/amazon-ecs-agent/ecs-agent/logger" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as my comment before. Not sure why we moved the location of the logger package import.
Summary
Update the CNI dependency to v1.1.2 and the amazon-vpc-cni-plugin submodule
Implementation details
currentCNISpec
removed.github.com/containernetworking/cni/pkg/types/current
and instead refer togithub.com/containernetworking/cni/pkg/types/100
Testing
Ran existing tests.
Manual tests were also run to verify that there are no errors with the DEL command (nor any other failures) with any of the different network modes.
New tests cover the changes: no
Description for the changelog
Update the containernetworking/cni dependency to v1.1.2 and the vpc-cni plugin version
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.