-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,12 @@ import ( | |
"testing" | ||
"time" | ||
|
||
"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" | ||
"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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 |
||
) | ||
|
||
func TestConfigDefault(t *testing.T) { | ||
|
@@ -124,7 +125,7 @@ func TestConfigFromFile(t *testing.T) { | |
assert.Equal(t, testPauseImageName, cfg.PauseContainerImageName, "should read PauseContainerImageName") | ||
assert.Equal(t, testPauseTag, cfg.PauseContainerTag, "should read PauseContainerTag") | ||
assert.Equal(t, 1, len(cfg.AWSVPCAdditionalLocalRoutes), "should have one additional local route") | ||
expectedLocalRoute, err := cnitypes.ParseCIDR("169.254.172.1/32") | ||
expectedLocalRoute, err := cniTypes.ParseCIDR("169.254.172.1/32") | ||
assert.NoError(t, err) | ||
assert.Equal(t, expectedLocalRoute.IP, cfg.AWSVPCAdditionalLocalRoutes[0].IP, "should match expected route IP") | ||
assert.Equal(t, expectedLocalRoute.Mask, cfg.AWSVPCAdditionalLocalRoutes[0].Mask, "should match expected route Mask") | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,12 @@ import ( | |
"sync" | ||
"time" | ||
|
||
"github.com/aws/amazon-ecs-agent/ecs-agent/logger" | ||
"github.com/cihub/seelog" | ||
"github.com/containernetworking/cni/libcni" | ||
"github.com/containernetworking/cni/pkg/types/current" | ||
cniTypesCurrent "github.com/containernetworking/cni/pkg/types/100" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
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 commentThe 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. |
||
) | ||
|
||
// CNIClient defines the method of setting/cleaning up container namespace | ||
|
@@ -40,7 +37,7 @@ type CNIClient interface { | |
// Capabilities returns the capabilities supported by a plugin | ||
Capabilities(string) ([]string, error) | ||
// SetupNS sets up the namespace of container | ||
SetupNS(context.Context, *Config, time.Duration) (*current.Result, error) | ||
SetupNS(context.Context, *Config, time.Duration) (*cniTypesCurrent.Result, error) | ||
// CleanupNS cleans up the container namespace | ||
CleanupNS(context.Context, *Config, time.Duration) error | ||
// ReleaseIPResource marks the ip available in the ipam db | ||
|
@@ -96,7 +93,7 @@ func (client *cniClient) init() { | |
func (client *cniClient) SetupNS( | ||
ctx context.Context, | ||
cfg *Config, | ||
timeout time.Duration) (*current.Result, error) { | ||
timeout time.Duration) (*cniTypesCurrent.Result, error) { | ||
ctx, cancel := context.WithTimeout(ctx, timeout) | ||
defer cancel() | ||
return client.setupNS(ctx, cfg) | ||
|
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.