Skip to content

Commit f6885cd

Browse files
committed
Add AttachNetworkInterfaceWithQueues to EC2API interface
1 parent 6e84ddd commit f6885cd

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

pkg/aws/ec2/mock/mock.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ func (e *API) DeleteNetworkInterface(ctx context.Context, eniID string) error {
369369
}
370370

371371
func (e *API) AttachNetworkInterface(ctx context.Context, index int32, instanceID, eniID string) (string, error) {
372+
return e.AttachNetworkInterfaceWithQueues(ctx, index, instanceID, eniID, nil)
373+
}
374+
375+
func (e *API) AttachNetworkInterfaceWithQueues(ctx context.Context, index int32, instanceID, eniID string, enaQueueCount *int32) (string, error) {
372376
e.rateLimit()
373377
e.delaySim.Delay(AttachNetworkInterface)
374378

pkg/aws/eni/instances.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type EC2API interface {
3535
GetDetachedNetworkInterfaces(ctx context.Context, tags ipamTypes.Tags, maxResults int32) ([]string, error)
3636
CreateNetworkInterface(ctx context.Context, toAllocate int32, subnetID, desc string, groups []string, allocatePrefixes bool) (string, *eniTypes.ENI, error)
3737
AttachNetworkInterface(ctx context.Context, index int32, instanceID, eniID string) (string, error)
38+
AttachNetworkInterfaceWithQueues(ctx context.Context, index int32, instanceID, eniID string, enaQueueCount *int32) (string, error)
3839
DeleteNetworkInterface(ctx context.Context, eniID string) error
3940
ModifyNetworkInterface(ctx context.Context, eniID, attachmentID string, deleteOnTermination bool) error
4041
AssignPrivateIpAddresses(ctx context.Context, eniID string, addresses int32) ([]string, error)

pkg/aws/eni/node.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,9 @@ func (n *Node) CreateInterface(ctx context.Context, allocation *ipam.AllocationA
536536

537537
var attachmentID string
538538
for range maxAttachRetries {
539-
// Check if the EC2 API client supports ENA queue configuration
540-
if ec2APIWithQueues, ok := n.manager.api.(*ec2.Client); ok && enaQueueCount != nil {
541-
attachmentID, err = ec2APIWithQueues.AttachNetworkInterfaceWithQueues(ctx, index, n.node.InstanceID(), eniID, enaQueueCount)
539+
// TODO fold this into a single interface method
540+
if enaQueueCount != nil {
541+
attachmentID, err = n.manager.api.AttachNetworkInterfaceWithQueues(ctx, index, n.node.InstanceID(), eniID, enaQueueCount)
542542
} else {
543543
attachmentID, err = n.manager.api.AttachNetworkInterface(ctx, index, n.node.InstanceID(), eniID)
544544
}

0 commit comments

Comments
 (0)