From 1f6f31e0fd5e3c90f9a185c2485e9cf9837082b0 Mon Sep 17 00:00:00 2001 From: ste Date: Mon, 30 Dec 2024 17:42:39 +0100 Subject: [PATCH] chore: Remove controllerLog in folder reconciler --- controllers/grafanafolder_controller.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/grafanafolder_controller.go b/controllers/grafanafolder_controller.go index 347a8b7a6..09e03467f 100644 --- a/controllers/grafanafolder_controller.go +++ b/controllers/grafanafolder_controller.go @@ -154,8 +154,7 @@ func (r *GrafanaFolderReconciler) syncFolders(ctx context.Context) (ctrl.Result, // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.9.2/pkg/reconcile func (r *GrafanaFolderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - controllerLog := log.FromContext(ctx).WithName("GrafanaFolderReconciler") - r.Log = controllerLog + r.Log = log.FromContext(ctx).WithName("GrafanaFolderReconciler") // periodic sync reconcile if req.Namespace == "" && req.Name == "" { @@ -215,7 +214,7 @@ func (r *GrafanaFolderReconciler) Reconcile(ctx context.Context, req ctrl.Reques } removeInvalidSpec(&folder.Status.Conditions) - instances, err := GetScopedMatchingInstances(controllerLog, ctx, r.Client, folder) + instances, err := GetScopedMatchingInstances(r.Log, ctx, r.Client, folder) if err != nil || len(instances) == 0 { setNoMatchingInstancesCondition(&folder.Status.Conditions, folder.Generation, err) folder.Status.NoMatchingInstances = true @@ -229,7 +228,7 @@ func (r *GrafanaFolderReconciler) Reconcile(ctx context.Context, req ctrl.Reques removeNoMatchingInstance(&folder.Status.Conditions) folder.Status.NoMatchingInstances = false - controllerLog.Info("found matching Grafana instances for folder", "count", len(instances)) + r.Log.Info("found matching Grafana instances for folder", "count", len(instances)) applyErrors := make(map[string]string) for _, grafana := range instances {