Skip to content

Commit 90a14b0

Browse files
authored
Merge pull request #4612 from Ankitasw/bump-deps
Bump golangci-lint dependency
2 parents 2c502e9 + 29b0ace commit 90a14b0

File tree

9 files changed

+58
-51
lines changed

9 files changed

+58
-51
lines changed

controllers/awsmachine_controller_unit_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,8 @@ func TestAWSMachineReconciler(t *testing.T) {
13251325
ID: "myMachine",
13261326
State: infrav1.InstanceStatePending,
13271327
}
1328+
1329+
//nolint:gosec
13281330
presigned := "https://cluster-api-aws.s3.us-west-2.amazonaws.com/bootstrap-data.yaml?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA3SGQVQG7FGA6KKA6%2F20221104%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20221104T140227Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=b228dbec8c1008c80c162e1210e4503dceead1e4d4751b4d9787314fd6da4d55"
13291331

13301332
objectStoreSvc.EXPECT().Create(gomock.Any(), gomock.Any()).Return(presigned, nil).Times(1)

controlplane/eks/api/v1beta2/awsmanagedcontrolplane_webhook_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ func TestWebhookCreate(t *testing.T) {
330330
},
331331
}
332332
if tc.eksVersion != "" {
333-
mcp.Spec.Version = &tc.eksVersion
333+
mcp.Spec.Version = aws.String(tc.eksVersion)
334334
}
335335
if tc.hasAddons {
336336
testAddons := []Addon{
@@ -363,7 +363,7 @@ func TestWebhookCreate(t *testing.T) {
363363
func TestWebhookCreateIPv6Details(t *testing.T) {
364364
tests := []struct {
365365
name string
366-
addons []Addon
366+
addons *[]Addon
367367
kubeVersion string
368368
networkSpec infrav1.NetworkSpec
369369
err string
@@ -391,7 +391,7 @@ func TestWebhookCreateIPv6Details(t *testing.T) {
391391
{
392392
name: "ipv6 with addons but cni version is lower than supported version",
393393
kubeVersion: "v1.22",
394-
addons: []Addon{
394+
addons: &[]Addon{
395395
{
396396
Name: vpcCniAddon,
397397
Version: "1.9.3",
@@ -407,7 +407,7 @@ func TestWebhookCreateIPv6Details(t *testing.T) {
407407
{
408408
name: "ipv6 with addons and correct cni and cluster version",
409409
kubeVersion: "v1.22",
410-
addons: []Addon{
410+
addons: &[]Addon{
411411
{
412412
Name: vpcCniAddon,
413413
Version: "1.11.0",
@@ -484,9 +484,9 @@ func TestWebhookCreateIPv6Details(t *testing.T) {
484484
},
485485
Spec: AWSManagedControlPlaneSpec{
486486
EKSClusterName: "test-cluster",
487-
Addons: &tc.addons,
487+
Addons: tc.addons,
488488
NetworkSpec: tc.networkSpec,
489-
Version: &tc.kubeVersion,
489+
Version: aws.String(tc.kubeVersion),
490490
},
491491
}
492492
err := testEnv.Create(ctx, mcp)
@@ -779,7 +779,7 @@ func TestValidatingWebhookCreateSecondaryCidr(t *testing.T) {
779779
},
780780
}
781781
if tc.cidrRange != "" {
782-
mcp.Spec.SecondaryCidrBlock = &tc.cidrRange
782+
mcp.Spec.SecondaryCidrBlock = aws.String(tc.cidrRange)
783783
}
784784
warn, err := mcp.ValidateCreate()
785785

@@ -844,7 +844,7 @@ func TestValidatingWebhookUpdateSecondaryCidr(t *testing.T) {
844844
newMCP := &AWSManagedControlPlane{
845845
Spec: AWSManagedControlPlaneSpec{
846846
EKSClusterName: "default_cluster1",
847-
SecondaryCidrBlock: &tc.cidrRange,
847+
SecondaryCidrBlock: aws.String(tc.cidrRange),
848848
},
849849
}
850850
oldMCP := &AWSManagedControlPlane{

hack/tools/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ifeq ($(OS), windows)
4545
MDBOOK_EXTRACT_COMMAND := unzip -d /tmp
4646
endif
4747

48-
GOLANGCI_LINT_VERSION := v1.53.3
48+
GOLANGCI_LINT_VERSION := v1.55.2
4949
## --------------------------------------
5050
## Tooling Binaries
5151
## --------------------------------------

pkg/cloud/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
// Session represents an AWS session.
3131
type Session interface {
3232
Session() awsclient.ConfigProvider
33-
ServiceLimiter(string) *throttle.ServiceLimiter
33+
ServiceLimiter(service string) *throttle.ServiceLimiter
3434
}
3535

3636
// ScopeUsage is used to indicate which controller is using a scope.

pkg/cloud/services/ec2/instances_test.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func TestInstanceIfExists(t *testing.T) {
196196
s := NewService(scope)
197197
s.EC2Client = ec2Mock
198198

199-
instance, err := s.InstanceIfExists(&tc.instanceID)
199+
instance, err := s.InstanceIfExists(aws.String(tc.instanceID))
200200
tc.check(instance, err)
201201
})
202202
}
@@ -298,15 +298,15 @@ func TestCreateInstance(t *testing.T) {
298298

299299
testcases := []struct {
300300
name string
301-
machine clusterv1.Machine
301+
machine *clusterv1.Machine
302302
machineConfig *infrav1.AWSMachineSpec
303303
awsCluster *infrav1.AWSCluster
304304
expect func(m *mocks.MockEC2APIMockRecorder)
305305
check func(instance *infrav1.Instance, err error)
306306
}{
307307
{
308308
name: "simple",
309-
machine: clusterv1.Machine{
309+
machine: &clusterv1.Machine{
310310
ObjectMeta: metav1.ObjectMeta{
311311
Labels: map[string]string{"set": "node"},
312312
},
@@ -419,7 +419,7 @@ func TestCreateInstance(t *testing.T) {
419419
},
420420
{
421421
name: "with availability zone",
422-
machine: clusterv1.Machine{
422+
machine: &clusterv1.Machine{
423423
ObjectMeta: metav1.ObjectMeta{
424424
Labels: map[string]string{"set": "node"},
425425
},
@@ -550,7 +550,7 @@ func TestCreateInstance(t *testing.T) {
550550
},
551551
{
552552
name: "with ImageLookupOrg specified at the machine level",
553-
machine: clusterv1.Machine{
553+
machine: &clusterv1.Machine{
554554
ObjectMeta: metav1.ObjectMeta{
555555
Labels: map[string]string{"set": "node"},
556556
},
@@ -700,7 +700,7 @@ func TestCreateInstance(t *testing.T) {
700700
},
701701
{
702702
name: "with ImageLookupOrg specified at the cluster-level",
703-
machine: clusterv1.Machine{
703+
machine: &clusterv1.Machine{
704704
ObjectMeta: metav1.ObjectMeta{
705705
Labels: map[string]string{"set": "node"},
706706
},
@@ -850,7 +850,7 @@ func TestCreateInstance(t *testing.T) {
850850
},
851851
{
852852
name: "AWSMachine ImageLookupOrg overrides AWSCluster ImageLookupOrg",
853-
machine: clusterv1.Machine{
853+
machine: &clusterv1.Machine{
854854
ObjectMeta: metav1.ObjectMeta{
855855
Labels: map[string]string{"set": "node"},
856856
},
@@ -1001,7 +1001,7 @@ func TestCreateInstance(t *testing.T) {
10011001
},
10021002
{
10031003
name: "subnet filter and failureDomain defined",
1004-
machine: clusterv1.Machine{
1004+
machine: &clusterv1.Machine{
10051005
ObjectMeta: metav1.ObjectMeta{
10061006
Labels: map[string]string{"set": "node"},
10071007
},
@@ -1129,7 +1129,7 @@ func TestCreateInstance(t *testing.T) {
11291129
},
11301130
{
11311131
name: "with subnet ID that belongs to Cluster",
1132-
machine: clusterv1.Machine{
1132+
machine: &clusterv1.Machine{
11331133
ObjectMeta: metav1.ObjectMeta{
11341134
Labels: map[string]string{"set": "node"},
11351135
},
@@ -1256,7 +1256,7 @@ func TestCreateInstance(t *testing.T) {
12561256
},
12571257
{
12581258
name: "with subnet ID that does not exist",
1259-
machine: clusterv1.Machine{
1259+
machine: &clusterv1.Machine{
12601260
ObjectMeta: metav1.ObjectMeta{
12611261
Labels: map[string]string{"set": "node"},
12621262
},
@@ -1349,7 +1349,7 @@ func TestCreateInstance(t *testing.T) {
13491349
},
13501350
{
13511351
name: "with subnet ID that does not belong to Cluster",
1352-
machine: clusterv1.Machine{
1352+
machine: &clusterv1.Machine{
13531353
ObjectMeta: metav1.ObjectMeta{
13541354
Labels: map[string]string{"set": "node"},
13551355
},
@@ -1475,7 +1475,7 @@ func TestCreateInstance(t *testing.T) {
14751475
},
14761476
{
14771477
name: "subnet id and failureDomain don't match",
1478-
machine: clusterv1.Machine{
1478+
machine: &clusterv1.Machine{
14791479
ObjectMeta: metav1.ObjectMeta{
14801480
Labels: map[string]string{"set": "node"},
14811481
},
@@ -1573,7 +1573,7 @@ func TestCreateInstance(t *testing.T) {
15731573
},
15741574
{
15751575
name: "public IP true and failureDomain doesn't have public subnet",
1576-
machine: clusterv1.Machine{
1576+
machine: &clusterv1.Machine{
15771577
ObjectMeta: metav1.ObjectMeta{
15781578
Labels: map[string]string{"set": "node"},
15791579
},
@@ -1656,7 +1656,7 @@ func TestCreateInstance(t *testing.T) {
16561656
},
16571657
{
16581658
name: "public IP true and public subnet ID given",
1659-
machine: clusterv1.Machine{
1659+
machine: &clusterv1.Machine{
16601660
ObjectMeta: metav1.ObjectMeta{
16611661
Labels: map[string]string{"set": "node"},
16621662
},
@@ -1786,7 +1786,7 @@ func TestCreateInstance(t *testing.T) {
17861786
},
17871787
{
17881788
name: "public IP true and private subnet ID given",
1789-
machine: clusterv1.Machine{
1789+
machine: &clusterv1.Machine{
17901790
ObjectMeta: metav1.ObjectMeta{
17911791
Labels: map[string]string{"set": "node"},
17921792
},
@@ -1885,7 +1885,7 @@ func TestCreateInstance(t *testing.T) {
18851885
},
18861886
{
18871887
name: "both public IP and subnet filter defined",
1888-
machine: clusterv1.Machine{
1888+
machine: &clusterv1.Machine{
18891889
ObjectMeta: metav1.ObjectMeta{
18901890
Labels: map[string]string{"set": "node"},
18911891
},
@@ -2023,7 +2023,7 @@ func TestCreateInstance(t *testing.T) {
20232023
},
20242024
{
20252025
name: "public IP true and public subnet exists",
2026-
machine: clusterv1.Machine{
2026+
machine: &clusterv1.Machine{
20272027
ObjectMeta: metav1.ObjectMeta{
20282028
Labels: map[string]string{"set": "node"},
20292029
},
@@ -2141,7 +2141,7 @@ func TestCreateInstance(t *testing.T) {
21412141
},
21422142
{
21432143
name: "public IP true and no public subnet exists",
2144-
machine: clusterv1.Machine{
2144+
machine: &clusterv1.Machine{
21452145
ObjectMeta: metav1.ObjectMeta{
21462146
Labels: map[string]string{"set": "node"},
21472147
},
@@ -2224,7 +2224,7 @@ func TestCreateInstance(t *testing.T) {
22242224
},
22252225
{
22262226
name: "with multiple block device mappings",
2227-
machine: clusterv1.Machine{
2227+
machine: &clusterv1.Machine{
22282228
ObjectMeta: metav1.ObjectMeta{
22292229
Labels: map[string]string{"set": "node"},
22302230
},
@@ -2347,7 +2347,7 @@ func TestCreateInstance(t *testing.T) {
23472347
},
23482348
{
23492349
name: "with dedicated tenancy cloud-config",
2350-
machine: clusterv1.Machine{
2350+
machine: &clusterv1.Machine{
23512351
ObjectMeta: metav1.ObjectMeta{
23522352
Labels: map[string]string{"set": "node"},
23532353
Namespace: "default",
@@ -2503,7 +2503,7 @@ func TestCreateInstance(t *testing.T) {
25032503
},
25042504
{
25052505
name: "with custom placement group cloud-config",
2506-
machine: clusterv1.Machine{
2506+
machine: &clusterv1.Machine{
25072507
ObjectMeta: metav1.ObjectMeta{
25082508
Labels: map[string]string{"set": "node"},
25092509
Namespace: "default",
@@ -2659,7 +2659,7 @@ func TestCreateInstance(t *testing.T) {
26592659
},
26602660
{
26612661
name: "with dedicated tenancy and placement group ignition",
2662-
machine: clusterv1.Machine{
2662+
machine: &clusterv1.Machine{
26632663
ObjectMeta: metav1.ObjectMeta{
26642664
Labels: map[string]string{"set": "node"},
26652665
Namespace: "default",
@@ -2819,7 +2819,7 @@ func TestCreateInstance(t *testing.T) {
28192819
},
28202820
{
28212821
name: "expect the default SSH key when none is provided",
2822-
machine: clusterv1.Machine{
2822+
machine: &clusterv1.Machine{
28232823
ObjectMeta: metav1.ObjectMeta{
28242824
Labels: map[string]string{"set": "node"},
28252825
},
@@ -2948,7 +2948,7 @@ func TestCreateInstance(t *testing.T) {
29482948
},
29492949
{
29502950
name: "expect to use the cluster level ssh key name when no machine key name is provided",
2951-
machine: clusterv1.Machine{
2951+
machine: &clusterv1.Machine{
29522952
ObjectMeta: metav1.ObjectMeta{
29532953
Labels: map[string]string{"set": "node"},
29542954
},
@@ -3078,7 +3078,7 @@ func TestCreateInstance(t *testing.T) {
30783078
},
30793079
{
30803080
name: "expect to use the machine level ssh key name when both cluster and machine key names are provided",
3081-
machine: clusterv1.Machine{
3081+
machine: &clusterv1.Machine{
30823082
ObjectMeta: metav1.ObjectMeta{
30833083
Labels: map[string]string{"set": "node"},
30843084
},
@@ -3209,7 +3209,7 @@ func TestCreateInstance(t *testing.T) {
32093209
},
32103210
{
32113211
name: "expect ssh key to be unset when cluster key name is empty string and machine key name is nil",
3212-
machine: clusterv1.Machine{
3212+
machine: &clusterv1.Machine{
32133213
ObjectMeta: metav1.ObjectMeta{
32143214
Labels: map[string]string{"set": "node"},
32153215
},
@@ -3337,7 +3337,7 @@ func TestCreateInstance(t *testing.T) {
33373337
},
33383338
{
33393339
name: "expect ssh key to be unset when cluster key name is empty string and machine key name is empty string",
3340-
machine: clusterv1.Machine{
3340+
machine: &clusterv1.Machine{
33413341
ObjectMeta: metav1.ObjectMeta{
33423342
Labels: map[string]string{"set": "node"},
33433343
},
@@ -3465,7 +3465,7 @@ func TestCreateInstance(t *testing.T) {
34653465
},
34663466
{
34673467
name: "expect ssh key to be unset when cluster key name is nil and machine key name is empty string",
3468-
machine: clusterv1.Machine{
3468+
machine: &clusterv1.Machine{
34693469
ObjectMeta: metav1.ObjectMeta{
34703470
Labels: map[string]string{"set": "node"},
34713471
},
@@ -3620,7 +3620,7 @@ func TestCreateInstance(t *testing.T) {
36203620
},
36213621
}
36223622

3623-
machine := &tc.machine
3623+
machine := tc.machine
36243624

36253625
awsMachine := &infrav1.AWSMachine{
36263626
ObjectMeta: metav1.ObjectMeta{

pkg/cloud/services/elb/loadbalancer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package elb
1919
import (
2020
"context"
2121
"fmt"
22+
"strconv"
2223
"strings"
2324
"time"
2425

@@ -186,7 +187,7 @@ func (s *Service) getAPIServerLBSpec(elbName string) (*infrav1.LoadBalancer, err
186187
VpcID: s.scope.VPC().ID,
187188
HealthCheck: &infrav1.TargetGroupHealthCheck{
188189
Protocol: aws.String(string(additionalListeners.Protocol)),
189-
Port: aws.String(fmt.Sprintf("%d", additionalListeners.Port)),
190+
Port: aws.String(strconv.FormatInt(additionalListeners.Port, 10)),
190191
},
191192
},
192193
})
@@ -198,7 +199,8 @@ func (s *Service) getAPIServerLBSpec(elbName string) (*infrav1.LoadBalancer, err
198199
}
199200

200201
if s.scope.ControlPlaneLoadBalancer() != nil {
201-
res.ELBAttributes[infrav1.LoadBalancerAttributeEnableLoadBalancingCrossZone] = aws.String(fmt.Sprintf("%t", s.scope.ControlPlaneLoadBalancer().CrossZoneLoadBalancing))
202+
isCrossZoneLB := s.scope.ControlPlaneLoadBalancer().CrossZoneLoadBalancing
203+
res.ELBAttributes[infrav1.LoadBalancerAttributeEnableLoadBalancingCrossZone] = aws.String(strconv.FormatBool(isCrossZoneLB))
202204
}
203205

204206
res.Tags = infrav1.Build(infrav1.BuildParams{

0 commit comments

Comments
 (0)