Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.

Commit 8963c3a

Browse files
committed
Linter fixes
1 parent c8f92c5 commit 8963c3a

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

internal/cniconfig/cniconfig.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ type Address struct {
4949
}
5050

5151
func CNIConfigForVPCAttachment(vpc galacticv1alpha.VPC, vpcAttachment galacticv1alpha.VPCAttachment) (NetConfList, error) {
52-
var terminations []Termination
53-
var addresses []Address
54-
var routes []Route
52+
terminations := make([]Termination, 0, 10)
53+
addresses := make([]Address, 0, 10)
54+
routes := make([]Route, 0, 10)
5555

56-
var netAddresses []net.IP // to check if a route is local
56+
netAddresses := make([]net.IP, 0, 10) // to check if a route is local
5757

5858
for _, address := range vpcAttachment.Spec.Interface.Addresses {
5959
netAddress, network, err := net.ParseCIDR(address)

internal/controller/vpcattachment_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ func (r *VPCAttachmentReconciler) Reconcile(ctx context.Context, req ctrl.Reques
8484

8585
nad := &nadv1.NetworkAttachmentDefinition{
8686
ObjectMeta: metav1.ObjectMeta{
87-
Name: vpcAttachment.ObjectMeta.Name,
88-
Namespace: vpcAttachment.ObjectMeta.Namespace,
87+
Name: vpcAttachment.Name,
88+
Namespace: vpcAttachment.Namespace,
8989
},
9090
Spec: nadv1.NetworkAttachmentDefinitionSpec{
9191
Config: string(cniPluginConfigJson),
@@ -112,8 +112,8 @@ func vpcAttachmentsToIdentifiers(vpc galacticv1alpha.VPC, vpcAttachments galacti
112112
identifiers := make([]string, 0, len(vpcAttachments.Items))
113113
for _, vpcAttachment := range vpcAttachments.Items {
114114
if vpcAttachment.Status.Identifier != "" &&
115-
vpcAttachment.Spec.VPC.Name == vpc.ObjectMeta.Name &&
116-
vpcAttachment.Spec.VPC.Namespace == vpc.ObjectMeta.Namespace {
115+
vpcAttachment.Spec.VPC.Name == vpc.Name &&
116+
vpcAttachment.Spec.VPC.Namespace == vpc.Namespace {
117117
identifiers = append(identifiers, vpcAttachment.Status.Identifier)
118118
}
119119
}

internal/controller/vpcattachment_controller_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ var _ = Describe("VPCAttachment Controller", func() {
110110
_, err := vpcControllerReconciler.Reconcile(ctx, reconcile.Request{
111111
NamespacedName: vpcTypeNamespacedName,
112112
})
113+
Expect(err).NotTo(HaveOccurred())
113114
vpcAttachmentControllerReconciler := &VPCAttachmentReconciler{
114115
Client: k8sClient,
115116
Scheme: k8sClient.Scheme(),

internal/webhook/v1/pod_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ func (v *PodCustomValidator) ValidateDelete(ctx context.Context, obj runtime.Obj
106106
return nil, nil
107107
}
108108

109-
func vpcAttachmentByName(client client.Client, ctx context.Context, name, namespace string) (*galacticv1alpha.VPCAttachment, error) {
109+
func vpcAttachmentByName(k8sClient client.Client, ctx context.Context, name, namespace string) (*galacticv1alpha.VPCAttachment, error) {
110110
typeNamespacedName := types.NamespacedName{
111111
Name: name,
112112
Namespace: namespace,
113113
}
114114
var vpcAttachment galacticv1alpha.VPCAttachment
115-
if err := client.Get(ctx, typeNamespacedName, &vpcAttachment); err != nil {
115+
if err := k8sClient.Get(ctx, typeNamespacedName, &vpcAttachment); err != nil {
116116
return nil, err
117117
}
118118
return &vpcAttachment, nil

0 commit comments

Comments
 (0)