Skip to content
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

Bump golangci-lint dependency #4612

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions controllers/awsmachine_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,8 @@ func TestAWSMachineReconciler(t *testing.T) {
ID: "myMachine",
State: infrav1.InstanceStatePending,
}

//nolint:gosec
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"

objectStoreSvc.EXPECT().Create(gomock.Any(), gomock.Any()).Return(presigned, nil).Times(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func TestWebhookCreate(t *testing.T) {
},
}
if tc.eksVersion != "" {
mcp.Spec.Version = &tc.eksVersion
mcp.Spec.Version = aws.String(tc.eksVersion)
}
if tc.hasAddons {
testAddons := []Addon{
Expand Down Expand Up @@ -363,7 +363,7 @@ func TestWebhookCreate(t *testing.T) {
func TestWebhookCreateIPv6Details(t *testing.T) {
tests := []struct {
name string
addons []Addon
addons *[]Addon
kubeVersion string
networkSpec infrav1.NetworkSpec
err string
Expand Down Expand Up @@ -391,7 +391,7 @@ func TestWebhookCreateIPv6Details(t *testing.T) {
{
name: "ipv6 with addons but cni version is lower than supported version",
kubeVersion: "v1.22",
addons: []Addon{
addons: &[]Addon{
{
Name: vpcCniAddon,
Version: "1.9.3",
Expand All @@ -407,7 +407,7 @@ func TestWebhookCreateIPv6Details(t *testing.T) {
{
name: "ipv6 with addons and correct cni and cluster version",
kubeVersion: "v1.22",
addons: []Addon{
addons: &[]Addon{
{
Name: vpcCniAddon,
Version: "1.11.0",
Expand Down Expand Up @@ -484,9 +484,9 @@ func TestWebhookCreateIPv6Details(t *testing.T) {
},
Spec: AWSManagedControlPlaneSpec{
EKSClusterName: "test-cluster",
Addons: &tc.addons,
Addons: tc.addons,
NetworkSpec: tc.networkSpec,
Version: &tc.kubeVersion,
Version: aws.String(tc.kubeVersion),
},
}
err := testEnv.Create(ctx, mcp)
Expand Down Expand Up @@ -779,7 +779,7 @@ func TestValidatingWebhookCreateSecondaryCidr(t *testing.T) {
},
}
if tc.cidrRange != "" {
mcp.Spec.SecondaryCidrBlock = &tc.cidrRange
mcp.Spec.SecondaryCidrBlock = aws.String(tc.cidrRange)
}
warn, err := mcp.ValidateCreate()

Expand Down Expand Up @@ -844,7 +844,7 @@ func TestValidatingWebhookUpdateSecondaryCidr(t *testing.T) {
newMCP := &AWSManagedControlPlane{
Spec: AWSManagedControlPlaneSpec{
EKSClusterName: "default_cluster1",
SecondaryCidrBlock: &tc.cidrRange,
SecondaryCidrBlock: aws.String(tc.cidrRange),
},
}
oldMCP := &AWSManagedControlPlane{
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ifeq ($(OS), windows)
MDBOOK_EXTRACT_COMMAND := unzip -d /tmp
endif

GOLANGCI_LINT_VERSION := v1.53.3
GOLANGCI_LINT_VERSION := v1.55.2
## --------------------------------------
## Tooling Binaries
## --------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloud/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
// Session represents an AWS session.
type Session interface {
Session() awsclient.ConfigProvider
ServiceLimiter(string) *throttle.ServiceLimiter
ServiceLimiter(service string) *throttle.ServiceLimiter
}

// ScopeUsage is used to indicate which controller is using a scope.
Expand Down
58 changes: 29 additions & 29 deletions pkg/cloud/services/ec2/instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func TestInstanceIfExists(t *testing.T) {
s := NewService(scope)
s.EC2Client = ec2Mock

instance, err := s.InstanceIfExists(&tc.instanceID)
instance, err := s.InstanceIfExists(aws.String(tc.instanceID))
tc.check(instance, err)
})
}
Expand Down Expand Up @@ -298,15 +298,15 @@ func TestCreateInstance(t *testing.T) {

testcases := []struct {
name string
machine clusterv1.Machine
machine *clusterv1.Machine
machineConfig *infrav1.AWSMachineSpec
awsCluster *infrav1.AWSCluster
expect func(m *mocks.MockEC2APIMockRecorder)
check func(instance *infrav1.Instance, err error)
}{
{
name: "simple",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -419,7 +419,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with availability zone",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -550,7 +550,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with ImageLookupOrg specified at the machine level",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -700,7 +700,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with ImageLookupOrg specified at the cluster-level",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -850,7 +850,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "AWSMachine ImageLookupOrg overrides AWSCluster ImageLookupOrg",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1001,7 +1001,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "subnet filter and failureDomain defined",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1129,7 +1129,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with subnet ID that belongs to Cluster",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1256,7 +1256,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with subnet ID that does not exist",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1349,7 +1349,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with subnet ID that does not belong to Cluster",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1475,7 +1475,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "subnet id and failureDomain don't match",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1573,7 +1573,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "public IP true and failureDomain doesn't have public subnet",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1656,7 +1656,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "public IP true and public subnet ID given",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1786,7 +1786,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "public IP true and private subnet ID given",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -1885,7 +1885,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "both public IP and subnet filter defined",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -2023,7 +2023,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "public IP true and public subnet exists",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -2141,7 +2141,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "public IP true and no public subnet exists",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -2224,7 +2224,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with multiple block device mappings",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -2347,7 +2347,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with dedicated tenancy cloud-config",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
Namespace: "default",
Expand Down Expand Up @@ -2503,7 +2503,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with custom placement group cloud-config",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
Namespace: "default",
Expand Down Expand Up @@ -2659,7 +2659,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "with dedicated tenancy and placement group ignition",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
Namespace: "default",
Expand Down Expand Up @@ -2819,7 +2819,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "expect the default SSH key when none is provided",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -2948,7 +2948,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "expect to use the cluster level ssh key name when no machine key name is provided",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -3078,7 +3078,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "expect to use the machine level ssh key name when both cluster and machine key names are provided",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -3209,7 +3209,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "expect ssh key to be unset when cluster key name is empty string and machine key name is nil",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -3337,7 +3337,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "expect ssh key to be unset when cluster key name is empty string and machine key name is empty string",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -3465,7 +3465,7 @@ func TestCreateInstance(t *testing.T) {
},
{
name: "expect ssh key to be unset when cluster key name is nil and machine key name is empty string",
machine: clusterv1.Machine{
machine: &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"set": "node"},
},
Expand Down Expand Up @@ -3620,7 +3620,7 @@ func TestCreateInstance(t *testing.T) {
},
}

machine := &tc.machine
machine := tc.machine

awsMachine := &infrav1.AWSMachine{
ObjectMeta: metav1.ObjectMeta{
Expand Down
6 changes: 4 additions & 2 deletions pkg/cloud/services/elb/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package elb
import (
"context"
"fmt"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -186,7 +187,7 @@ func (s *Service) getAPIServerLBSpec(elbName string) (*infrav1.LoadBalancer, err
VpcID: s.scope.VPC().ID,
HealthCheck: &infrav1.TargetGroupHealthCheck{
Protocol: aws.String(string(additionalListeners.Protocol)),
Port: aws.String(fmt.Sprintf("%d", additionalListeners.Port)),
Port: aws.String(strconv.FormatInt(additionalListeners.Port, 10)),
},
},
})
Expand All @@ -198,7 +199,8 @@ func (s *Service) getAPIServerLBSpec(elbName string) (*infrav1.LoadBalancer, err
}

if s.scope.ControlPlaneLoadBalancer() != nil {
res.ELBAttributes[infrav1.LoadBalancerAttributeEnableLoadBalancingCrossZone] = aws.String(fmt.Sprintf("%t", s.scope.ControlPlaneLoadBalancer().CrossZoneLoadBalancing))
isCrossZoneLB := s.scope.ControlPlaneLoadBalancer().CrossZoneLoadBalancing
res.ELBAttributes[infrav1.LoadBalancerAttributeEnableLoadBalancingCrossZone] = aws.String(strconv.FormatBool(isCrossZoneLB))
}

res.Tags = infrav1.Build(infrav1.BuildParams{
Expand Down
Loading