Skip to content

Commit 1b12c05

Browse files
committed
fix lints
Signed-off-by: Carlos Panato <[email protected]>
1 parent 17fc0f6 commit 1b12c05

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

cloud/scope/cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ func NewClusterScope(ctx context.Context, params ClusterScopeParams) (*ClusterSc
5050
return nil, errors.New("failed to generate new scope from nil GCPCluster")
5151
}
5252

53-
if params.GCPServices.Compute == nil {
53+
if params.Compute == nil {
5454
computeSvc, err := newComputeService(ctx, params.GCPCluster.Spec.CredentialsRef, params.Client, params.GCPCluster.Spec.ServiceEndpoints)
5555
if err != nil {
5656
return nil, errors.Errorf("failed to create gcp compute client: %v", err)
5757
}
5858

59-
params.GCPServices.Compute = computeSvc
59+
params.Compute = computeSvc
6060
}
6161

6262
helper, err := patch.NewHelper(params.GCPCluster, params.Client)

cloud/scope/managedcluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ func NewManagedClusterScope(ctx context.Context, params ManagedClusterScopeParam
5151
return nil, errors.New("failed to generate new scope from nil GCPManagedCluster")
5252
}
5353

54-
if params.GCPServices.Compute == nil {
54+
if params.Compute == nil {
5555
computeSvc, err := newComputeService(ctx, params.GCPManagedCluster.Spec.CredentialsRef, params.Client, params.GCPManagedCluster.Spec.ServiceEndpoints)
5656
if err != nil {
5757
return nil, errors.Errorf("failed to create gcp compute client: %v", err)
5858
}
5959

60-
params.GCPServices.Compute = computeSvc
60+
params.Compute = computeSvc
6161
}
6262

6363
helper, err := patch.NewHelper(params.GCPManagedCluster, params.Client)

cloud/services/compute/firewalls/reconcile_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func TestService_Reconcile(t *testing.T) {
155155
Objects: map[meta.Key]*cloud.MockFirewallsObj{},
156156
},
157157
assert: func(ctx context.Context, t testCase) error {
158-
key := meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.ObjectMeta.Name))
158+
key := meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.Name))
159159
fwRule, err := t.mockFirewalls.Get(ctx, key)
160160
if err != nil {
161161
return err
@@ -173,7 +173,7 @@ func TestService_Reconcile(t *testing.T) {
173173
mockFirewalls: &cloud.MockFirewalls{
174174
ProjectRouter: &cloud.SingleProjectRouter{ID: "my-proj"},
175175
Objects: map[meta.Key]*cloud.MockFirewallsObj{
176-
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.ObjectMeta.Name)): {},
176+
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.Name)): {},
177177
},
178178
},
179179
},
@@ -196,7 +196,7 @@ func TestService_Reconcile(t *testing.T) {
196196
ProjectRouter: &cloud.SingleProjectRouter{ID: "my-proj"},
197197
Objects: map[meta.Key]*cloud.MockFirewallsObj{},
198198
InsertError: map[meta.Key]error{
199-
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.ObjectMeta.Name)): &googleapi.Error{Code: http.StatusBadRequest},
199+
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.Name)): &googleapi.Error{Code: http.StatusBadRequest},
200200
},
201201
},
202202
wantErr: true,
@@ -207,7 +207,7 @@ func TestService_Reconcile(t *testing.T) {
207207
mockFirewalls: &cloud.MockFirewalls{
208208
ProjectRouter: &cloud.SingleProjectRouter{ID: "my-proj"},
209209
Objects: map[meta.Key]*cloud.MockFirewallsObj{
210-
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.ObjectMeta.Name)): {},
210+
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.Name)): {},
211211
},
212212
},
213213
},
@@ -269,7 +269,7 @@ func TestService_Delete(t *testing.T) {
269269
mockFirewalls: &cloud.MockFirewalls{
270270
ProjectRouter: &cloud.SingleProjectRouter{ID: "my-proj"},
271271
DeleteError: map[meta.Key]error{
272-
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.ObjectMeta.Name)): &googleapi.Error{Code: http.StatusNotFound},
272+
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.Name)): &googleapi.Error{Code: http.StatusNotFound},
273273
},
274274
},
275275
},
@@ -279,7 +279,7 @@ func TestService_Delete(t *testing.T) {
279279
mockFirewalls: &cloud.MockFirewalls{
280280
ProjectRouter: &cloud.SingleProjectRouter{ID: "my-proj"},
281281
DeleteError: map[meta.Key]error{
282-
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.ObjectMeta.Name)): &googleapi.Error{Code: http.StatusBadRequest},
282+
*meta.GlobalKey(fmt.Sprintf("allow-%s-healthchecks", fakeGCPCluster.Name)): &googleapi.Error{Code: http.StatusBadRequest},
283283
},
284284
},
285285
wantErr: true,

controllers/gcpmachine_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (r *GCPMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request)
173173
Namespace: gcpMachine.Namespace,
174174
Name: cluster.Spec.InfrastructureRef.Name,
175175
}
176-
if err := r.Client.Get(ctx, gcpClusterKey, gcpCluster); err != nil {
176+
if err := r.Get(ctx, gcpClusterKey, gcpCluster); err != nil {
177177
log.Info("GCPCluster is not available yet")
178178
return ctrl.Result{}, nil
179179
}
@@ -207,7 +207,7 @@ func (r *GCPMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request)
207207
}()
208208

209209
// Handle deleted machines
210-
if !gcpMachine.ObjectMeta.DeletionTimestamp.IsZero() {
210+
if !gcpMachine.DeletionTimestamp.IsZero() {
211211
return ctrl.Result{}, r.reconcileDelete(ctx, machineScope)
212212
}
213213

exp/controllers/gcpmanagedcluster_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func (r *GCPManagedClusterReconciler) managedControlPlaneMapper() handler.MapFun
275275

276276
log = log.WithValues("objectMapper", "cpTomc", "gcpmanagedcontrolplane", klog.KRef(gcpManagedControlPlane.Namespace, gcpManagedControlPlane.Name))
277277

278-
if !gcpManagedControlPlane.ObjectMeta.DeletionTimestamp.IsZero() {
278+
if !gcpManagedControlPlane.DeletionTimestamp.IsZero() {
279279
log.Info("GCPManagedControlPlane has a deletion timestamp, skipping mapping")
280280
return nil
281281
}
@@ -319,7 +319,7 @@ func (r *GCPManagedClusterReconciler) dependencyCount(ctx context.Context, clust
319319
}
320320

321321
managedMachinePools := &infrav1exp.GCPManagedMachinePoolList{}
322-
if err := r.Client.List(ctx, managedMachinePools, listOptions...); err != nil {
322+
if err := r.List(ctx, managedMachinePools, listOptions...); err != nil {
323323
return 0, fmt.Errorf("failed to list managed machine pools for cluster %s/%s: %w", clusterNamespace, clusterName, err)
324324
}
325325

exp/controllers/gcpmanagedcontrolplane_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (r *GCPManagedControlPlaneReconciler) Reconcile(ctx context.Context, req ct
9292

9393
// Get the control plane instance
9494
gcpManagedControlPlane := &infrav1exp.GCPManagedControlPlane{}
95-
if err := r.Client.Get(ctx, req.NamespacedName, gcpManagedControlPlane); err != nil {
95+
if err := r.Get(ctx, req.NamespacedName, gcpManagedControlPlane); err != nil {
9696
if apierrors.IsNotFound(err) {
9797
return ctrl.Result{}, nil
9898
}
@@ -121,7 +121,7 @@ func (r *GCPManagedControlPlaneReconciler) Reconcile(ctx context.Context, req ct
121121
Namespace: gcpManagedControlPlane.Namespace,
122122
Name: cluster.Spec.InfrastructureRef.Name,
123123
}
124-
if err := r.Client.Get(ctx, key, managedCluster); err != nil {
124+
if err := r.Get(ctx, key, managedCluster); err != nil {
125125
log.Error(err, "Failed to retrieve GCPManagedCluster from the API Server")
126126
return ctrl.Result{}, err
127127
}

exp/controllers/gcpmanagedmachinepool_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func managedControlPlaneToManagedMachinePoolMapFunc(c client.Client, gvk schema.
112112
panic(fmt.Sprintf("Expected a GCPManagedControlPlane but got a %T", o))
113113
}
114114

115-
if !gcpManagedControlPlane.ObjectMeta.DeletionTimestamp.IsZero() {
115+
if !gcpManagedControlPlane.DeletionTimestamp.IsZero() {
116116
return nil
117117
}
118118

@@ -231,7 +231,7 @@ func (r *GCPManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr
231231

232232
// Get the managed machine pool
233233
gcpManagedMachinePool := &infrav1exp.GCPManagedMachinePool{}
234-
if err := r.Client.Get(ctx, req.NamespacedName, gcpManagedMachinePool); err != nil {
234+
if err := r.Get(ctx, req.NamespacedName, gcpManagedMachinePool); err != nil {
235235
if apierrors.IsNotFound(err) {
236236
return ctrl.Result{}, nil
237237
}
@@ -266,7 +266,7 @@ func (r *GCPManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr
266266
Name: cluster.Spec.InfrastructureRef.Name,
267267
}
268268
gcpManagedCluster := &infrav1exp.GCPManagedCluster{}
269-
if err := r.Client.Get(ctx, gcpManagedClusterKey, gcpManagedCluster); err != nil {
269+
if err := r.Get(ctx, gcpManagedClusterKey, gcpManagedCluster); err != nil {
270270
log.Error(err, "Failed to retrieve GCPManagedCluster from the API Server")
271271
return ctrl.Result{}, err
272272
}
@@ -276,7 +276,7 @@ func (r *GCPManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr
276276
Name: cluster.Spec.ControlPlaneRef.Name,
277277
}
278278
gcpManagedControlPlane := &infrav1exp.GCPManagedControlPlane{}
279-
if err := r.Client.Get(ctx, gcpManagedControlPlaneKey, gcpManagedControlPlane); err != nil {
279+
if err := r.Get(ctx, gcpManagedControlPlaneKey, gcpManagedControlPlane); err != nil {
280280
log.Info("Failed to retrieve ManagedControlPlane from ManagedMachinePool")
281281
return reconcile.Result{}, nil
282282
}

0 commit comments

Comments
 (0)