@@ -20,12 +20,13 @@ import (
2020 "github.com/aws/aws-sdk-go-v2/service/ec2"
2121 ec2_types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
2222
23+ operatorOption "github.com/cilium/cilium/operator/option"
2324 "github.com/cilium/cilium/pkg/api/helpers"
2425 eniTypes "github.com/cilium/cilium/pkg/aws/eni/types"
2526 "github.com/cilium/cilium/pkg/aws/types"
2627 "github.com/cilium/cilium/pkg/defaults"
2728 ipPkg "github.com/cilium/cilium/pkg/ip"
28- "github.com/cilium/cilium/pkg/ipam/option"
29+ ipamOption "github.com/cilium/cilium/pkg/ipam/option"
2930 ipamTypes "github.com/cilium/cilium/pkg/ipam/types"
3031 "github.com/cilium/cilium/pkg/logging/logfields"
3132 "github.com/cilium/cilium/pkg/spanstat"
@@ -214,14 +215,16 @@ func DetectEKSClusterName(ctx context.Context, cfg aws.Config) (string, error) {
214215func (c * Client ) GetDetachedNetworkInterfaces (ctx context.Context , tags ipamTypes.Tags , maxResults int32 ) ([]string , error ) {
215216 result := make ([]string , 0 , int (maxResults ))
216217 input := & ec2.DescribeNetworkInterfacesInput {
217- Filters : NewTagsFilter (tags ),
218- MaxResults : aws .Int32 (defaults .ENIMaxResultsPerApiCall ),
218+ Filters : NewTagsFilter (tags ),
219219 }
220220 for _ , subnetFilter := range c .subnetsFilters {
221221 if aws .ToString (subnetFilter .Name ) == "subnet-id" {
222222 input .Filters = append (input .Filters , subnetFilter )
223223 }
224224 }
225+ if operatorOption .Config .AWSPaginationEnabled {
226+ input .MaxResults = aws .Int32 (maxResults )
227+ }
225228
226229 input .Filters = append (input .Filters , ec2_types.Filter {
227230 Name : aws .String ("status" ),
@@ -259,7 +262,9 @@ func (c *Client) describeNetworkInterfaces(ctx context.Context, subnets ipamType
259262 Values : []string {"*" },
260263 },
261264 },
262- MaxResults : aws .Int32 (defaults .ENIMaxResultsPerApiCall ),
265+ }
266+ if operatorOption .Config .AWSPaginationEnabled {
267+ input .MaxResults = aws .Int32 (defaults .ENIMaxResultsPerApiCall )
263268 }
264269 if len (c .subnetsFilters ) > 0 {
265270 subnetsIDs := make ([]string , 0 , len (subnets ))
@@ -296,7 +301,6 @@ func (c *Client) describeNetworkInterfacesByInstance(ctx context.Context, instan
296301 Values : []string {instanceID },
297302 },
298303 },
299- MaxResults : aws .Int32 (defaults .ENIMaxResultsPerApiCall ),
300304 }
301305 paginator := ec2 .NewDescribeNetworkInterfacesPaginator (c .ec2Client , input )
302306 for paginator .HasMorePages () {
@@ -358,7 +362,7 @@ func (c *Client) describeNetworkInterfacesFromInstances(ctx context.Context) ([]
358362 }
359363 if len (enisListFromInstances ) > 0 {
360364 ENIAttrs .NetworkInterfaceIds = enisListFromInstances
361- } else {
365+ } else if operatorOption . Config . AWSPaginationEnabled {
362366 // MaxResults is incompatible with NetworkInterfaceIds
363367 ENIAttrs .MaxResults = aws .Int32 (defaults .ENIMaxResultsPerApiCall )
364368 }
@@ -697,7 +701,7 @@ func (c *Client) CreateNetworkInterface(ctx context.Context, toAllocate int32, s
697701 Groups : groups ,
698702 }
699703 if allocatePrefixes {
700- prefixCount := ipPkg .PrefixCeil (int (toAllocate ), option .ENIPDBlockSizeIPv4 )
704+ prefixCount := ipPkg .PrefixCeil (int (toAllocate ), ipamOption .ENIPDBlockSizeIPv4 )
701705 input .Ipv4PrefixCount = aws .Int32 (int32 (prefixCount ))
702706 c .logger .Debug ("Creating interface with prefixes" ,
703707 logfields .PrefixCount , prefixCount ,
0 commit comments