Skip to content

Commit 1b83b14

Browse files
Migrate node-related code to AWS SDK v2
1 parent 483f3a9 commit 1b83b14

File tree

7 files changed

+16
-32
lines changed

7 files changed

+16
-32
lines changed

bootstrap/eks/internal/userdata/node_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package userdata
1919
import (
2020
"testing"
2121

22-
"github.com/aws/aws-sdk-go/aws"
22+
"github.com/aws/aws-sdk-go-v2/aws"
2323
. "github.com/onsi/gomega"
2424
"github.com/onsi/gomega/format"
2525
"k8s.io/utils/ptr"

pkg/cloud/scope/managednodegroup.go

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"time"
2323

2424
awsv2 "github.com/aws/aws-sdk-go-v2/aws"
25-
awsclient "github.com/aws/aws-sdk-go/aws/client"
2625
"github.com/pkg/errors"
2726
corev1 "k8s.io/api/core/v1"
2827
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -54,7 +53,7 @@ type ManagedMachinePoolScopeParams struct {
5453
MachinePool *expclusterv1.MachinePool
5554
ControllerName string
5655
Endpoints []ServiceEndpoint
57-
Session awsclient.ConfigProvider
56+
Session awsv2.Config
5857
MaxWaitActiveUpdateDelete time.Duration
5958

6059
EnableIAM bool
@@ -88,10 +87,6 @@ func NewManagedMachinePoolScope(params ManagedMachinePoolScopeParams) (*ManagedM
8887
ControlPlane: params.ControlPlane,
8988
controllerName: params.ControllerName,
9089
}
91-
session, serviceLimiters, err := sessionForClusterWithRegion(params.Client, managedScope, params.ControlPlane.Spec.Region, params.Endpoints, params.Logger)
92-
if err != nil {
93-
return nil, errors.Errorf("failed to create aws session: %v", err)
94-
}
9590

9691
sessionv2, serviceLimitersv2, err := sessionForClusterWithRegionV2(params.Client, managedScope, params.ControlPlane.Spec.Region, params.Endpoints, params.Logger)
9792
if err != nil {
@@ -119,10 +114,8 @@ func NewManagedMachinePoolScope(params ManagedMachinePoolScopeParams) (*ManagedM
119114
MachinePool: params.MachinePool,
120115
MaxWaitActiveUpdateDelete: params.MaxWaitActiveUpdateDelete,
121116
EC2Scope: params.InfraCluster,
122-
session: session,
123-
sessionV2: *sessionv2,
124-
serviceLimiters: serviceLimiters,
125-
serviceLimitersV2: serviceLimitersv2,
117+
session: *sessionv2,
118+
serviceLimiters: serviceLimitersv2,
126119
controllerName: params.ControllerName,
127120
enableIAM: params.EnableIAM,
128121
allowAdditionalRoles: params.AllowAdditionalRoles,
@@ -143,11 +136,9 @@ type ManagedMachinePoolScope struct {
143136
EC2Scope EC2Scope
144137
MaxWaitActiveUpdateDelete time.Duration
145138

146-
session awsclient.ConfigProvider
147-
sessionV2 awsv2.Config
148-
serviceLimiters throttle.ServiceLimiters
149-
serviceLimitersV2 throttle.ServiceLimiters
150-
controllerName string
139+
session awsv2.Config
140+
serviceLimiters throttle.ServiceLimiters
141+
controllerName string
151142

152143
enableIAM bool
153144
allowAdditionalRoles bool
@@ -311,16 +302,11 @@ func (s *ManagedMachinePoolScope) ClusterObj() cloud.ClusterObject {
311302
return s.Cluster
312303
}
313304

314-
// Session returns the AWS SDK session. Used for creating clients.
315-
func (s *ManagedMachinePoolScope) Session() awsclient.ConfigProvider {
305+
// Session returns the AWS SDK V2 config. Used for creating clients.
306+
func (s *ManagedMachinePoolScope) Session() awsv2.Config {
316307
return s.session
317308
}
318309

319-
// SessionV2 returns the AWS SDK V2 config. Used for creating clients.
320-
func (s *ManagedMachinePoolScope) SessionV2() awsv2.Config {
321-
return s.sessionV2
322-
}
323-
324310
// ControllerName returns the name of the controller that
325311
// created the ManagedMachinePool.
326312
func (s *ManagedMachinePoolScope) ControllerName() string {

pkg/cloud/services/awsnode/cni_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"testing"
2222

2323
"github.com/aws/amazon-vpc-cni-k8s/pkg/apis/crd/v1alpha1"
24-
"github.com/aws/aws-sdk-go/aws"
24+
"github.com/aws/aws-sdk-go-v2/aws"
2525
"github.com/golang/mock/gomock"
2626
. "github.com/onsi/gomega"
2727
v1 "k8s.io/api/apps/v1"

test/e2e/suites/managed/aws_node_env.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"errors"
2525
"fmt"
2626

27-
"github.com/aws/aws-sdk-go/aws/client"
27+
"github.com/aws/aws-sdk-go-v2/aws"
2828
. "github.com/onsi/ginkgo/v2"
2929
. "github.com/onsi/gomega"
3030
appsv1 "k8s.io/api/apps/v1"
@@ -39,7 +39,7 @@ import (
3939
type UpdateAwsNodeVersionSpecInput struct {
4040
E2EConfig *clusterctl.E2EConfig
4141
BootstrapClusterProxy framework.ClusterProxy
42-
AWSSession client.ConfigProvider
42+
AWSSession aws.Config
4343
Namespace *corev1.Namespace
4444
ClusterName string
4545
}

test/e2e/suites/managed/cluster.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"time"
2727

2828
"github.com/aws/aws-sdk-go-v2/aws"
29-
"github.com/aws/aws-sdk-go/aws/client"
3029
"github.com/onsi/ginkgo/v2"
3130
. "github.com/onsi/gomega"
3231
corev1 "k8s.io/api/core/v1"
@@ -44,7 +43,7 @@ type ManagedClusterSpecInput struct {
4443
E2EConfig *clusterctl.E2EConfig
4544
ConfigClusterFn DefaultConfigClusterFn
4645
BootstrapClusterProxy framework.ClusterProxy
47-
AWSSession client.ConfigProvider
46+
AWSSession aws.Config
4847
AWSSessionV2 *aws.Config
4948
Namespace *corev1.Namespace
5049
ClusterName string

test/e2e/suites/managed/machine_deployment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"context"
2424
"fmt"
2525

26-
"github.com/aws/aws-sdk-go/aws/client"
26+
"github.com/aws/aws-sdk-go-v2/aws"
2727
. "github.com/onsi/ginkgo/v2"
2828
. "github.com/onsi/gomega"
2929
corev1 "k8s.io/api/core/v1"
@@ -40,7 +40,7 @@ type MachineDeploymentSpecInput struct {
4040
E2EConfig *clusterctl.E2EConfig
4141
ConfigClusterFn DefaultConfigClusterFn
4242
BootstrapClusterProxy framework.ClusterProxy
43-
AWSSession client.ConfigProvider
43+
AWSSession aws.Config
4444
Namespace *corev1.Namespace
4545
Replicas int64
4646
ClusterName string

test/e2e/suites/managed/machine_pool.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"strings"
2727

2828
"github.com/aws/aws-sdk-go-v2/aws"
29-
"github.com/aws/aws-sdk-go/aws/client"
3029
"github.com/onsi/ginkgo/v2"
3130
. "github.com/onsi/gomega"
3231
corev1 "k8s.io/api/core/v1"
@@ -42,7 +41,7 @@ type MachinePoolSpecInput struct {
4241
E2EConfig *clusterctl.E2EConfig
4342
ConfigClusterFn DefaultConfigClusterFn
4443
BootstrapClusterProxy framework.ClusterProxy
45-
AWSSession client.ConfigProvider
44+
AWSSession aws.Config
4645
AWSSessionV2 *aws.Config
4746
Namespace *corev1.Namespace
4847
ClusterName string

0 commit comments

Comments
 (0)