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 containernetworking/cni dependency to v1.1.2 and the vpc-cni plugin version #3702

Merged
merged 2 commits into from
Jun 15, 2023

Conversation

ohsoo
Copy link
Contributor

@ohsoo ohsoo commented May 17, 2023

Summary

Update the CNI dependency to v1.1.2 and the amazon-vpc-cni-plugin submodule

Implementation details

  • CNI Spec Version used will now be 1.0.0, version convert logic simplified, and unnecessary constant currentCNISpec removed.
  • go.mod updated to use the newer version
  • Remove references to github.com/containernetworking/cni/pkg/types/current and instead refer to github.com/containernetworking/cni/pkg/types/100
  • Regenerate relevant mock files
  • Pull in the newest commits of the vpc cni plugin that include an upgrade to its CNI dependency to v1.1.2 and new support for CNI spec version 1.0.0.

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.

@ohsoo ohsoo added the bot/test label May 17, 2023
@ohsoo ohsoo changed the base branch from master to dev May 17, 2023 23:40
@ohsoo ohsoo force-pushed the update-cni-current-dep branch 4 times, most recently from 065763e to 9e8cc30 Compare May 18, 2023 14:50
@ohsoo ohsoo added bot/test and removed bot/test labels May 18, 2023
@ohsoo ohsoo marked this pull request as ready for review May 18, 2023 15:00
@ohsoo ohsoo requested a review from a team as a code owner May 18, 2023 15:00
danehlim
danehlim previously approved these changes May 24, 2023
Copy link
Contributor

@danehlim danehlim left a 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?

@@ -16,9 +16,10 @@ package ecscni
import (
"context"

current "github.com/containernetworking/cni/pkg/types/100"
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.) ✅

@ohsoo ohsoo requested a review from ofiliz May 25, 2023 22:28
agent/engine/docker_task_engine_linux_test.go Show resolved Hide resolved
"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"
Copy link
Contributor

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.

Copy link
Contributor Author

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.

"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"
Copy link
Contributor

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.

@ohsoo ohsoo changed the title Update containernetworking/cni dependency to v1.1.2 Update containernetworking/cni dependency to v1.1.2 and the vpc-cni plugin Jun 13, 2023
@ohsoo ohsoo changed the title Update containernetworking/cni dependency to v1.1.2 and the vpc-cni plugin Update containernetworking/cni dependency to v1.1.2 and the vpc-cni plugin version Jun 13, 2023
"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"
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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"
Copy link
Contributor

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".

Copy link
Contributor Author

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"
Copy link
Contributor

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.

@fierlion fierlion merged commit 7565a9a into aws:dev Jun 15, 2023
@prateekchaudhry prateekchaudhry mentioned this pull request Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants