-
Notifications
You must be signed in to change notification settings - Fork 742
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
Filter Managed ENI. #2895
Filter Managed ENI. #2895
Changes from all commits
844c0aa
add21ce
0f82f82
e18739f
65a3858
7b3da90
13da0e0
30e9324
fbf5590
20cf0ac
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 |
---|---|---|
|
@@ -27,6 +27,8 @@ import ( | |
"sync" | ||
"time" | ||
|
||
"github.com/aws/amazon-vpc-cni-k8s/pkg/ipamd/datastore" | ||
|
||
"github.com/aws/amazon-vpc-cni-k8s/pkg/awsutils/awssession" | ||
"github.com/aws/amazon-vpc-cni-k8s/pkg/ec2wrapper" | ||
"github.com/aws/amazon-vpc-cni-k8s/pkg/utils/eventrecorder" | ||
|
@@ -168,7 +170,7 @@ type APIs interface { | |
IsPrimaryENI(eniID string) bool | ||
|
||
//RefreshSGIDs | ||
RefreshSGIDs(mac string) error | ||
RefreshSGIDs(mac string, store *datastore.DataStore) error | ||
|
||
//GetInstanceHypervisorFamily returns the hypervisor family for the instance | ||
GetInstanceHypervisorFamily() string | ||
|
@@ -474,7 +476,7 @@ func (cache *EC2InstanceMetadataCache) initWithEC2Metadata(ctx context.Context) | |
} | ||
|
||
// RefreshSGIDs retrieves security groups | ||
func (cache *EC2InstanceMetadataCache) RefreshSGIDs(mac string) error { | ||
func (cache *EC2InstanceMetadataCache) RefreshSGIDs(mac string, store *datastore.DataStore) error { | ||
ctx := context.TODO() | ||
|
||
sgIDs, err := cache.imds.GetSecurityGroupIDs(ctx, mac) | ||
|
@@ -501,14 +503,12 @@ func (cache *EC2InstanceMetadataCache) RefreshSGIDs(mac string) error { | |
cache.securityGroups.Set(sgIDs) | ||
|
||
if !cache.useCustomNetworking && (addedSGsCount != 0 || deletedSGsCount != 0) { | ||
allENIs, err := cache.GetAttachedENIs() | ||
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. We need to fill the ENIs from datastore, else the eniIDs will always be 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. Maybe this - https://github.com/aws/amazon-vpc-cni-k8s/blob/master/pkg/ipamd/datastore/data_store.go#L1192 or any other get function from datastore. Basically we will just use the ENIs from datastore instead of IMDS to sync SGs. 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. @jayanthvn - I have addressed the review comment, and add the test information. PTAL again. Thanks. |
||
if err != nil { | ||
return errors.Wrap(err, "DescribeAllENIs: failed to get local ENI metadata") | ||
} | ||
eniInfos := store.GetENIInfos() | ||
|
||
var eniIDs []string | ||
for _, eni := range allENIs { | ||
eniIDs = append(eniIDs, eni.ENIID) | ||
|
||
for eniID := range eniInfos.ENIs { | ||
eniIDs = append(eniIDs, eniID) | ||
} | ||
|
||
newENIs := StringSet{} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 is a dependency update, it was required to use with my editor to find dependencies correctly. I can bring it separately (or with this PR itself). #2905