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

run make format on unformatted files #1417

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852 h1:cPXZWzzG0NllBLdjWoD1nDfaqu98YMv+OneaKc8sPOA=
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho=
github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7ZovXvuNyL3XQl8UFofeikI1NW1Gypu7k=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae h1:4hwBBUfQCFe3Cym0ZtKyq7L16eZUtYKs+BaHDN6mAns=
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
Expand Down Expand Up @@ -234,6 +236,7 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -262,6 +265,7 @@ golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637 h1:O5hKNaGxIT4A8OTMnuh6UpmBdI3SAPxlZ3g0olDrJVM=
golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
31 changes: 15 additions & 16 deletions pkg/awsutils/awsutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,12 @@ type APIs interface {

//SetCNIunmanaged ENI
SetCNIUnmanagedENIs(eniID []string) error

//isCNIUnmanagedENI
IsCNIUnmanagedENI(eniID string) bool

//RefreshSGIDs
RefreshSGIDs(mac string) error

RefreshSGIDs(mac string) error
}

// EC2InstanceMetadataCache caches instance metadata
Expand Down Expand Up @@ -226,10 +225,10 @@ type TagMap map[string]string

// DescribeAllENIsResult contains the fully
type DescribeAllENIsResult struct {
ENIMetadata []ENIMetadata
TagMap map[string]TagMap
TrunkENI string
EFAENIs map[string]bool
ENIMetadata []ENIMetadata
TagMap map[string]TagMap
TrunkENI string
EFAENIs map[string]bool
MultiCardENIIDs []string
}

Expand Down Expand Up @@ -409,7 +408,7 @@ func (cache *EC2InstanceMetadataCache) initWithEC2Metadata(ctx context.Context)
return err
}
log.Debugf("Found subnet-id: %s ", cache.subnetID)

// We use the ctx here for testing, since we spawn go-routines above which will run forever.
select {
case <-ctx.Done():
Expand Down Expand Up @@ -1070,10 +1069,10 @@ func (cache *EC2InstanceMetadataCache) DescribeAllENIs() (DescribeAllENIsResult,
}
}
return DescribeAllENIsResult{
ENIMetadata: verifiedENIs,
TagMap: tagMap,
TrunkENI: trunkENI,
EFAENIs: efaENIs,
ENIMetadata: verifiedENIs,
TagMap: tagMap,
TrunkENI: trunkENI,
EFAENIs: efaENIs,
MultiCardENIIDs: multiCardENIIDs,
}, nil
}
Expand Down Expand Up @@ -1520,9 +1519,9 @@ func (cache *EC2InstanceMetadataCache) getENIsFromPaginatedDescribeNetworkInterf

//SetCNIUnmanagedENIs Set unmanaged ENI set
func (cache *EC2InstanceMetadataCache) SetCNIUnmanagedENIs(eniID []string) error {
if len(eniID) != 0 {
if len(eniID) != 0 {
cache.cniunmanagedENIs.Set(eniID)
}
}
return nil
}

Expand All @@ -1532,4 +1531,4 @@ func (cache *EC2InstanceMetadataCache) IsCNIUnmanagedENI(eniID string) bool {
return cache.cniunmanagedENIs.Has(eniID)
}
return false
}
}
5 changes: 3 additions & 2 deletions pkg/awsutils/mocks/awsutils_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/ec2wrapper/mocks/ec2wrapper_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/ipamd/ipamd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1343,4 +1343,4 @@ func (c *IPAMContext) SetNodeLabel(key, value string) error {
// GetPod returns the pod matching the name and namespace
func (c *IPAMContext) GetPod(podName, namespace string) (*v1.Pod, error) {
return c.k8sClient.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
}
}
34 changes: 17 additions & 17 deletions pkg/ipamd/ipamd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ func TestNodeInit(t *testing.T) {

eniMetadataSlice := []awsutils.ENIMetadata{eni1, eni2}
resp := awsutils.DescribeAllENIsResult{
ENIMetadata: eniMetadataSlice,
TagMap: map[string]awsutils.TagMap{},
TrunkENI: "",
EFAENIs: make(map[string]bool),
ENIMetadata: eniMetadataSlice,
TagMap: map[string]awsutils.TagMap{},
TrunkENI: "",
EFAENIs: make(map[string]bool),
MultiCardENIIDs: nil,
}
m.awsutils.EXPECT().DescribeAllENIs().Return(resp, nil)
Expand Down Expand Up @@ -375,11 +375,11 @@ func TestNodeIPPoolReconcile(t *testing.T) {
eniMetadataList := []awsutils.ENIMetadata{primaryENIMetadata}
m.awsutils.EXPECT().GetAttachedENIs().Return(eniMetadataList, nil)
resp := awsutils.DescribeAllENIsResult{
ENIMetadata: eniMetadataList,
TagMap: map[string]awsutils.TagMap{},
TrunkENI: "",
EFAENIs: make(map[string]bool),
MultiCardENIIDs : nil,
ENIMetadata: eniMetadataList,
TagMap: map[string]awsutils.TagMap{},
TrunkENI: "",
EFAENIs: make(map[string]bool),
MultiCardENIIDs: nil,
}
m.awsutils.EXPECT().DescribeAllENIs().Return(resp, nil)

Expand Down Expand Up @@ -422,11 +422,11 @@ func TestNodeIPPoolReconcile(t *testing.T) {
m.awsutils.EXPECT().IsUnmanagedENI(secENIid).Times(2).Return(false)
m.awsutils.EXPECT().IsCNIUnmanagedENI(secENIid).Times(2).Return(false)
resp2 := awsutils.DescribeAllENIsResult{
ENIMetadata: twoENIs,
TagMap: map[string]awsutils.TagMap{},
TrunkENI: "",
EFAENIs: make(map[string]bool),
MultiCardENIIDs : nil,
ENIMetadata: twoENIs,
TagMap: map[string]awsutils.TagMap{},
TrunkENI: "",
EFAENIs: make(map[string]bool),
MultiCardENIIDs: nil,
}
m.awsutils.EXPECT().DescribeAllENIs().Return(resp2, nil)
m.network.EXPECT().SetupENINetwork(gomock.Any(), secMAC, secDevice, primarySubnet)
Expand Down Expand Up @@ -632,12 +632,12 @@ func TestIPAMContext_filterUnmanagedENIs(t *testing.T) {
return false

}).AnyTimes()

mockAWSUtils.EXPECT().IsCNIUnmanagedENI(gomock.Any()).DoAndReturn(
func(eni string) (unmanaged bool) {
return false
}).AnyTimes()

}).AnyTimes()

if got := c.filterUnmanagedENIs(tt.enis); !reflect.DeepEqual(got, tt.want) {
t.Errorf("filterUnmanagedENIs() = %v, want %v", got, tt.want)
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkutils/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (n *linuxNetwork) SetupHostNetwork(vpcCIDRs []string, primaryMAC string, pr
}
var allCIDRs []snatCIDR
for _, cidr := range vpcCIDRs {
log.Debugf("Adding %s CIDR to NAT chain", cidr)
log.Debugf("Adding %s CIDR to NAT chain", cidr)
allCIDRs = append(allCIDRs, snatCIDR{cidr: cidr, isExclusion: false})
}
for _, cidr := range n.excludeSNATCIDRs {
Expand Down