Skip to content

Commit

Permalink
chore: Remove controllerLog in folder reconciler
Browse files Browse the repository at this point in the history
  • Loading branch information
Baarsgaard committed Dec 30, 2024
1 parent 0c1e28f commit 1f6f31e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions controllers/grafanafolder_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 1f6f31e

Please sign in to comment.