From 3591f8dd5ddab23228ef2eb79530d0fc3018390f Mon Sep 17 00:00:00 2001 From: Gloria Ciavarrini Date: Thu, 6 Oct 2022 09:56:32 +0200 Subject: [PATCH] Fix: add logger definition in playbookexecution controller Signed-off-by: Gloria Ciavarrini --- controllers/playbookexecution_controller.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/playbookexecution_controller.go b/controllers/playbookexecution_controller.go index ede2a824d..b0a96c8a0 100644 --- a/controllers/playbookexecution_controller.go +++ b/controllers/playbookexecution_controller.go @@ -24,6 +24,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/event" + "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" "github.com/project-flotta/flotta-operator/api/v1alpha1" @@ -54,6 +55,9 @@ type PlaybookExecutionReconciler struct { // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcile func (r *PlaybookExecutionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + logger := log.FromContext(ctx) + logger.Info("Reconciling", "playbookExecution", req) + playbookExec, err := r.PlaybookExecutionRepository.Read(ctx, req.Name, req.Namespace) if err != nil { if errors.IsNotFound(err) { @@ -78,7 +82,7 @@ func (r *PlaybookExecutionReconciler) Reconcile(ctx context.Context, req ctrl.Re } return ctrl.Result{Requeue: true}, err } - logger.Info(">>> edgeDevice found", "edgeDevice", edgeDevice) + logger.Info("edgeDevice found", "edgeDevice", edgeDevice) return ctrl.Result{}, nil }