Skip to content

Commit 4dda2de

Browse files
authored
Merge pull request #3776 from Skarlso/consistent_logging
Unify the logger interface in CAPA
2 parents cc0a67f + a40460d commit 4dda2de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+552
-461
lines changed

bootstrap/eks/controllers/eksconfig_controller.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
eksbootstrapv1 "sigs.k8s.io/cluster-api-provider-aws/v2/bootstrap/eks/api/v1beta2"
3838
"sigs.k8s.io/cluster-api-provider-aws/v2/bootstrap/eks/internal/userdata"
3939
ekscontrolplanev1 "sigs.k8s.io/cluster-api-provider-aws/v2/controlplane/eks/api/v1beta2"
40+
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
4041
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
4142
bsutil "sigs.k8s.io/cluster-api/bootstrap/util"
4243
expclusterv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
@@ -63,7 +64,7 @@ type EKSConfigReconciler struct {
6364
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;create;update;delete;
6465

6566
func (r *EKSConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, rerr error) {
66-
log := ctrl.LoggerFrom(ctx)
67+
log := logger.FromContext(ctx)
6768

6869
// get EKSConfig
6970
config := &eksbootstrapv1.EKSConfig{}
@@ -142,7 +143,7 @@ func (r *EKSConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
142143
}
143144

144145
func (r *EKSConfigReconciler) joinWorker(ctx context.Context, cluster *clusterv1.Cluster, config *eksbootstrapv1.EKSConfig) (ctrl.Result, error) {
145-
log := ctrl.LoggerFrom(ctx)
146+
log := logger.FromContext(ctx)
146147

147148
if config.Status.DataSecretName != nil {
148149
secretKey := client.ObjectKey{Namespace: config.Namespace, Name: *config.Status.DataSecretName}
@@ -238,7 +239,7 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
238239
b := ctrl.NewControllerManagedBy(mgr).
239240
For(&eksbootstrapv1.EKSConfig{}).
240241
WithOptions(option).
241-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
242+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(logger.FromContext(ctx).GetLogger(), r.WatchFilterValue)).
242243
Watches(
243244
&source.Kind{Type: &clusterv1.Machine{}},
244245
handler.EnqueueRequestsFromMapFunc(r.MachineToBootstrapMapFunc),
@@ -259,7 +260,7 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
259260
err = c.Watch(
260261
&source.Kind{Type: &clusterv1.Cluster{}},
261262
handler.EnqueueRequestsFromMapFunc((r.ClusterToEKSConfigs)),
262-
predicates.ClusterUnpausedAndInfrastructureReady(ctrl.LoggerFrom(ctx)),
263+
predicates.ClusterUnpausedAndInfrastructureReady(logger.FromContext(ctx).GetLogger()),
263264
)
264265
if err != nil {
265266
return errors.Wrap(err, "failed adding watch for Clusters to controller manager")
@@ -271,7 +272,7 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
271272
// storeBootstrapData creates a new secret with the data passed in as input,
272273
// sets the reference in the configuration status and ready to true.
273274
func (r *EKSConfigReconciler) storeBootstrapData(ctx context.Context, cluster *clusterv1.Cluster, config *eksbootstrapv1.EKSConfig, data []byte) error {
274-
log := ctrl.LoggerFrom(ctx)
275+
log := logger.FromContext(ctx)
275276

276277
// as secret creation and scope.Config status patch are not atomic operations
277278
// it is possible that secret creation happens but the config.Status patches are not applied
@@ -296,7 +297,7 @@ func (r *EKSConfigReconciler) storeBootstrapData(ctx context.Context, cluster *c
296297
if updated {
297298
log.Info("updated bootstrap data secret for EKSConfig", "secret", klog.KObj(secret))
298299
} else {
299-
log.V(4).Info("no change in bootstrap data secret for EKSConfig", "secret", klog.KObj(secret))
300+
log.Trace("no change in bootstrap data secret for EKSConfig", "secret", klog.KObj(secret))
300301
}
301302
}
302303

controllers/awscluster_controller.go

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

25-
"github.com/go-logr/logr"
2625
"github.com/google/go-cmp/cmp"
2726
"github.com/pkg/errors"
2827
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -50,6 +49,7 @@ import (
5049
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/network"
5150
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/s3"
5251
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/securitygroup"
52+
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
5353
infrautilconditions "sigs.k8s.io/cluster-api-provider-aws/v2/util/conditions"
5454
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
5555
"sigs.k8s.io/cluster-api/util"
@@ -130,7 +130,7 @@ func (r *AWSClusterReconciler) getSecurityGroupService(scope scope.ClusterScope)
130130
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsclustercontrolleridentities,verbs=get;list;watch;create;
131131

132132
func (r *AWSClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {
133-
log := ctrl.LoggerFrom(ctx)
133+
log := logger.FromContext(ctx)
134134

135135
// Fetch the AWSCluster instance
136136
awsCluster := &infrav1.AWSCluster{}
@@ -180,7 +180,7 @@ func (r *AWSClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
180180
// Create the scope.
181181
clusterScope, err := scope.NewClusterScope(scope.ClusterScopeParams{
182182
Client: r.Client,
183-
Logger: &log,
183+
Logger: log,
184184
Cluster: cluster,
185185
AWSCluster: awsCluster,
186186
ControllerName: "awscluster",
@@ -356,11 +356,11 @@ func (r *AWSClusterReconciler) reconcileNormal(clusterScope *scope.ClusterScope)
356356
}
357357

358358
func (r *AWSClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
359-
log := ctrl.LoggerFrom(ctx)
359+
log := logger.FromContext(ctx)
360360
controller, err := ctrl.NewControllerManagedBy(mgr).
361361
WithOptions(options).
362362
For(&infrav1.AWSCluster{}).
363-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
363+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log.GetLogger(), r.WatchFilterValue)).
364364
WithEventFilter(
365365
predicate.Funcs{
366366
// Avoid reconciling if the event triggering the reconciliation is related to incremental status updates
@@ -383,7 +383,7 @@ func (r *AWSClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
383383
},
384384
},
385385
).
386-
WithEventFilter(predicates.ResourceIsNotExternallyManaged(log)).
386+
WithEventFilter(predicates.ResourceIsNotExternallyManaged(log.GetLogger())).
387387
Build(r)
388388
if err != nil {
389389
return errors.Wrap(err, "error creating controller")
@@ -392,11 +392,11 @@ func (r *AWSClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
392392
return controller.Watch(
393393
&source.Kind{Type: &clusterv1.Cluster{}},
394394
handler.EnqueueRequestsFromMapFunc(r.requeueAWSClusterForUnpausedCluster(ctx, log)),
395-
predicates.ClusterUnpaused(log),
395+
predicates.ClusterUnpaused(log.GetLogger()),
396396
)
397397
}
398398

399-
func (r *AWSClusterReconciler) requeueAWSClusterForUnpausedCluster(ctx context.Context, log logr.Logger) handler.MapFunc {
399+
func (r *AWSClusterReconciler) requeueAWSClusterForUnpausedCluster(ctx context.Context, log logger.Wrapper) handler.MapFunc {
400400
return func(o client.Object) []ctrl.Request {
401401
c, ok := o.(*clusterv1.Cluster)
402402
if !ok {
@@ -407,35 +407,35 @@ func (r *AWSClusterReconciler) requeueAWSClusterForUnpausedCluster(ctx context.C
407407

408408
// Don't handle deleted clusters
409409
if !c.ObjectMeta.DeletionTimestamp.IsZero() {
410-
log.V(4).Info("Cluster has a deletion timestamp, skipping mapping.")
410+
log.Trace("Cluster has a deletion timestamp, skipping mapping.")
411411
return nil
412412
}
413413

414414
// Make sure the ref is set
415415
if c.Spec.InfrastructureRef == nil {
416-
log.V(4).Info("Cluster does not have an InfrastructureRef, skipping mapping.")
416+
log.Trace("Cluster does not have an InfrastructureRef, skipping mapping.")
417417
return nil
418418
}
419419

420420
if c.Spec.InfrastructureRef.GroupVersionKind().Kind != "AWSCluster" {
421-
log.V(4).Info("Cluster has an InfrastructureRef for a different type, skipping mapping.")
421+
log.Trace("Cluster has an InfrastructureRef for a different type, skipping mapping.")
422422
return nil
423423
}
424424

425425
awsCluster := &infrav1.AWSCluster{}
426426
key := types.NamespacedName{Namespace: c.Spec.InfrastructureRef.Namespace, Name: c.Spec.InfrastructureRef.Name}
427427

428428
if err := r.Get(ctx, key, awsCluster); err != nil {
429-
log.V(4).Error(err, "Failed to get AWS cluster")
429+
log.Error(err, "Failed to get AWS cluster")
430430
return nil
431431
}
432432

433433
if capiannotations.IsExternallyManaged(awsCluster) {
434-
log.V(4).Info("AWSCluster is externally managed, skipping mapping.")
434+
log.Trace("AWSCluster is externally managed, skipping mapping.")
435435
return nil
436436
}
437437

438-
log.V(4).Info("Adding request.", "awsCluster", c.Spec.InfrastructureRef.Name)
438+
log.Trace("Adding request.", "awsCluster", c.Spec.InfrastructureRef.Name)
439439
return []ctrl.Request{
440440
{
441441
NamespacedName: client.ObjectKey{Namespace: c.Namespace, Name: c.Spec.InfrastructureRef.Name},

controllers/awscluster_controller_unit_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/scope"
3939
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services"
4040
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/mock_services"
41+
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
4142
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
4243
"sigs.k8s.io/cluster-api/util"
4344
)
@@ -571,7 +572,7 @@ func TestAWSClusterReconciler_RequeueAWSClusterForUnpausedCluster(t *testing.T)
571572
for _, tc := range testCases {
572573
t.Run(tc.name, func(t *testing.T) {
573574
g := NewWithT(t)
574-
log := ctrl.LoggerFrom(ctx)
575+
log := logger.FromContext(ctx)
575576
reconciler := &AWSClusterReconciler{
576577
Client: testEnv.Client,
577578
}

controllers/awsmachine_controller.go

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import (
5353
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/secretsmanager"
5454
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/ssm"
5555
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/userdata"
56+
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
5657
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
5758
"sigs.k8s.io/cluster-api/controllers/noderefutil"
5859
capierrors "sigs.k8s.io/cluster-api/errors"
@@ -140,7 +141,7 @@ func (r *AWSMachineReconciler) getObjectStoreService(scope scope.S3Scope) servic
140141
// +kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;update;patch
141142

142143
func (r *AWSMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {
143-
log := ctrl.LoggerFrom(ctx)
144+
log := logger.FromContext(ctx)
144145

145146
// Fetch the AWSMachine instance.
146147
awsMachine := &infrav1.AWSMachine{}
@@ -226,7 +227,7 @@ func (r *AWSMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request)
226227
}
227228

228229
func (r *AWSMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
229-
log := ctrl.LoggerFrom(ctx)
230+
log := logger.FromContext(ctx)
230231
AWSClusterToAWSMachines := r.AWSClusterToAWSMachines(log)
231232

232233
controller, err := ctrl.NewControllerManagedBy(mgr).
@@ -240,7 +241,7 @@ func (r *AWSMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
240241
&source.Kind{Type: &infrav1.AWSCluster{}},
241242
handler.EnqueueRequestsFromMapFunc(AWSClusterToAWSMachines),
242243
).
243-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
244+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log.GetLogger(), r.WatchFilterValue)).
244245
WithEventFilter(
245246
predicate.Funcs{
246247
// Avoid reconciling if the event triggering the reconciliation is related to incremental status updates
@@ -280,7 +281,7 @@ func (r *AWSMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
280281
return controller.Watch(
281282
&source.Kind{Type: &clusterv1.Cluster{}},
282283
handler.EnqueueRequestsFromMapFunc(requeueAWSMachinesForUnpausedCluster),
283-
predicates.ClusterUnpausedAndInfrastructureReady(log),
284+
predicates.ClusterUnpausedAndInfrastructureReady(log.GetLogger()),
284285
)
285286
}
286287

@@ -308,13 +309,13 @@ func (r *AWSMachineReconciler) reconcileDelete(machineScope *scope.MachineScope,
308309
// and AWSMachine
309310
// 3. Issue a delete
310311
// 4. Scale controller deployment to 1
311-
machineScope.V(2).Info("Unable to locate EC2 instance by ID or tags")
312+
machineScope.Debug("Unable to locate EC2 instance by ID or tags")
312313
r.Recorder.Eventf(machineScope.AWSMachine, corev1.EventTypeWarning, "NoInstanceFound", "Unable to find matching EC2 instance")
313314
controllerutil.RemoveFinalizer(machineScope.AWSMachine, infrav1.MachineFinalizer)
314315
return ctrl.Result{}, nil
315316
}
316317

317-
machineScope.V(3).Info("EC2 instance found matching deleted AWSMachine", "instance-id", instance.ID)
318+
machineScope.Debug("EC2 instance found matching deleted AWSMachine", "instance-id", instance.ID)
318319

319320
if err := r.reconcileLBAttachment(machineScope, elbScope, instance); err != nil {
320321
// We are tolerating AccessDenied error, so this won't block for users with older version of IAM;
@@ -367,7 +368,7 @@ func (r *AWSMachineReconciler) reconcileDelete(machineScope *scope.MachineScope,
367368
return ctrl.Result{}, err
368369
}
369370

370-
machineScope.V(3).Info(
371+
machineScope.Debug(
371372
"Detaching security groups from provided network interface",
372373
"groups", core,
373374
"instanceID", instance.ID,
@@ -430,7 +431,7 @@ func (r *AWSMachineReconciler) findInstance(scope *scope.MachineScope, ec2svc se
430431
}
431432

432433
func (r *AWSMachineReconciler) reconcileNormal(_ context.Context, machineScope *scope.MachineScope, clusterScope cloud.ClusterScoper, ec2Scope scope.EC2Scope, elbScope scope.ELBScope, objectStoreScope scope.S3Scope) (ctrl.Result, error) {
433-
machineScope.V(4).Info("Reconciling AWSMachine")
434+
machineScope.Trace("Reconciling AWSMachine")
434435

435436
// If the AWSMachine is in an error state, return early.
436437
if machineScope.HasFailed() {
@@ -837,7 +838,7 @@ func (r *AWSMachineReconciler) reconcileLBAttachment(machineScope *scope.Machine
837838

838839
// AWSClusterToAWSMachines is a handler.ToRequestsFunc to be used to enqeue requests for reconciliation
839840
// of AWSMachines.
840-
func (r *AWSMachineReconciler) AWSClusterToAWSMachines(log logr.Logger) handler.MapFunc {
841+
func (r *AWSMachineReconciler) AWSClusterToAWSMachines(log logger.Wrapper) handler.MapFunc {
841842
return func(o client.Object) []ctrl.Request {
842843
c, ok := o.(*infrav1.AWSCluster)
843844
if !ok {
@@ -848,14 +849,14 @@ func (r *AWSMachineReconciler) AWSClusterToAWSMachines(log logr.Logger) handler.
848849

849850
// Don't handle deleted AWSClusters
850851
if !c.ObjectMeta.DeletionTimestamp.IsZero() {
851-
log.V(4).Info("AWSCluster has a deletion timestamp, skipping mapping.")
852+
log.Trace("AWSCluster has a deletion timestamp, skipping mapping.")
852853
return nil
853854
}
854855

855856
cluster, err := util.GetOwnerCluster(context.TODO(), r.Client, c.ObjectMeta)
856857
switch {
857858
case apierrors.IsNotFound(err) || cluster == nil:
858-
log.V(4).Info("Cluster for AWSCluster not found, skipping mapping.")
859+
log.Trace("Cluster for AWSCluster not found, skipping mapping.")
859860
return nil
860861
case err != nil:
861862
log.Error(err, "Failed to get owning cluster, skipping mapping.")
@@ -866,7 +867,7 @@ func (r *AWSMachineReconciler) AWSClusterToAWSMachines(log logr.Logger) handler.
866867
}
867868
}
868869

869-
func (r *AWSMachineReconciler) requeueAWSMachinesForUnpausedCluster(log logr.Logger) handler.MapFunc {
870+
func (r *AWSMachineReconciler) requeueAWSMachinesForUnpausedCluster(log logger.Wrapper) handler.MapFunc {
870871
return func(o client.Object) []ctrl.Request {
871872
c, ok := o.(*clusterv1.Cluster)
872873
if !ok {
@@ -877,15 +878,15 @@ func (r *AWSMachineReconciler) requeueAWSMachinesForUnpausedCluster(log logr.Log
877878

878879
// Don't handle deleted clusters
879880
if !c.ObjectMeta.DeletionTimestamp.IsZero() {
880-
log.V(4).Info("Cluster has a deletion timestamp, skipping mapping.")
881+
log.Trace("Cluster has a deletion timestamp, skipping mapping.")
881882
return nil
882883
}
883884

884885
return r.requestsForCluster(log, c.Namespace, c.Name)
885886
}
886887
}
887888

888-
func (r *AWSMachineReconciler) requestsForCluster(log logr.Logger, namespace, name string) []ctrl.Request {
889+
func (r *AWSMachineReconciler) requestsForCluster(log logger.Wrapper, namespace, name string) []ctrl.Request {
889890
labels := map[string]string{clusterv1.ClusterLabelName: name}
890891
machineList := &clusterv1.MachineList{}
891892
if err := r.Client.List(context.TODO(), machineList, client.InNamespace(namespace), client.MatchingLabels(labels)); err != nil {
@@ -898,21 +899,21 @@ func (r *AWSMachineReconciler) requestsForCluster(log logr.Logger, namespace, na
898899
m := m
899900
log.WithValues("machine", klog.KObj(&m))
900901
if m.Spec.InfrastructureRef.GroupVersionKind().Kind != "AWSMachine" {
901-
log.V(4).Info("Machine has an InfrastructureRef for a different type, will not add to reconciliation request.")
902+
log.Trace("Machine has an InfrastructureRef for a different type, will not add to reconciliation request.")
902903
continue
903904
}
904905
if m.Spec.InfrastructureRef.Name == "" {
905-
log.V(4).Info("Machine has an InfrastructureRef with an empty name, will not add to reconciliation request.")
906+
log.Trace("Machine has an InfrastructureRef with an empty name, will not add to reconciliation request.")
906907
continue
907908
}
908909
log.WithValues("awsMachine", klog.KRef(m.Spec.InfrastructureRef.Namespace, m.Spec.InfrastructureRef.Name))
909-
log.V(4).Info("Adding AWSMachine to reconciliation request.")
910+
log.Trace("Adding AWSMachine to reconciliation request.")
910911
result = append(result, ctrl.Request{NamespacedName: client.ObjectKey{Namespace: m.Namespace, Name: m.Spec.InfrastructureRef.Name}})
911912
}
912913
return result
913914
}
914915

915-
func (r *AWSMachineReconciler) getInfraCluster(ctx context.Context, log logr.Logger, cluster *clusterv1.Cluster, awsMachine *infrav1.AWSMachine) (scope.EC2Scope, error) {
916+
func (r *AWSMachineReconciler) getInfraCluster(ctx context.Context, log *logger.Logger, cluster *clusterv1.Cluster, awsMachine *infrav1.AWSMachine) (scope.EC2Scope, error) {
916917
var clusterScope *scope.ClusterScope
917918
var managedControlPlaneScope *scope.ManagedControlPlaneScope
918919
var err error
@@ -931,7 +932,7 @@ func (r *AWSMachineReconciler) getInfraCluster(ctx context.Context, log logr.Log
931932

932933
managedControlPlaneScope, err = scope.NewManagedControlPlaneScope(scope.ManagedControlPlaneScopeParams{
933934
Client: r.Client,
934-
Logger: &log,
935+
Logger: log,
935936
Cluster: cluster,
936937
ControlPlane: controlPlane,
937938
ControllerName: "awsManagedControlPlane",
@@ -959,7 +960,7 @@ func (r *AWSMachineReconciler) getInfraCluster(ctx context.Context, log logr.Log
959960
// Create the cluster scope
960961
clusterScope, err = scope.NewClusterScope(scope.ClusterScopeParams{
961962
Client: r.Client,
962-
Logger: &log,
963+
Logger: log,
963964
Cluster: cluster,
964965
AWSCluster: awsCluster,
965966
ControllerName: "awsmachine",

controllers/awsmachine_controller_unit_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/scope"
4747
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services"
4848
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/mock_services"
49+
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
4950
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
5051
"sigs.k8s.io/cluster-api/controllers/noderefutil"
5152
capierrors "sigs.k8s.io/cluster-api/errors"
@@ -2028,7 +2029,7 @@ func TestAWSMachineReconciler_AWSClusterToAWSMachines(t *testing.T) {
20282029
g.Expect(testEnv.Cleanup(ctx, tc.awsCluster, ns)).To(Succeed())
20292030
})
20302031

2031-
requests := reconciler.AWSClusterToAWSMachines(klog.Background())(tc.awsCluster)
2032+
requests := reconciler.AWSClusterToAWSMachines(logger.NewLogger(klog.Background()))(tc.awsCluster)
20322033
if tc.requests != nil {
20332034
if len(tc.requests) > 0 {
20342035
tc.requests[0].Namespace = ns.Name
@@ -2064,7 +2065,7 @@ func TestAWSMachineReconciler_requeueAWSMachinesForUnpausedCluster(t *testing.T)
20642065
Client: testEnv.Client,
20652066
Log: klog.Background(),
20662067
}
2067-
requests := reconciler.requeueAWSMachinesForUnpausedCluster(klog.Background())(tc.ownerCluster)
2068+
requests := reconciler.requeueAWSMachinesForUnpausedCluster(logger.NewLogger(klog.Background()))(tc.ownerCluster)
20682069
if tc.requests != nil {
20692070
g.Expect(requests).To(ConsistOf(tc.requests))
20702071
} else {

0 commit comments

Comments
 (0)