forked from keptn/lifecycle-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(lifecycle-operator): improve logging (keptn#2253)
Signed-off-by: Geoffrey Israel <[email protected]> Co-authored-by: Florian Bacher <[email protected]> Co-authored-by: odubajDT <[email protected]>
- Loading branch information
1 parent
8443874
commit 8dd3394
Showing
9 changed files
with
49 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,8 @@ type KeptnAppReconciler struct { | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *KeptnAppReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
r.Log.Info("Searching for App") | ||
requestInfo := controllercommon.GetRequestInfo(req) | ||
r.Log.Info("Searching for App", "requestInfo", requestInfo) | ||
|
||
app := &klcv1alpha3.KeptnApp{} | ||
err := r.Get(ctx, req.NamespacedName, app) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,14 +70,14 @@ type KeptnEvaluationReconciler struct { | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *KeptnEvaluationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
|
||
r.Log.Info("Reconciling KeptnEvaluation") | ||
requestInfo := controllercommon.GetRequestInfo(req) | ||
r.Log.Info("Reconciling KeptnEvaluation", "requestInfo", requestInfo) | ||
evaluation := &klcv1alpha3.KeptnEvaluation{} | ||
|
||
if err := r.Client.Get(ctx, req.NamespacedName, evaluation); err != nil { | ||
if errors.IsNotFound(err) { | ||
// taking down all associated K8s resources is handled by K8s | ||
r.Log.Info("KeptnEvaluation resource not found. Ignoring since object must be deleted") | ||
r.Log.Info("KeptnEvaluation resource not found. Ignoring since object must be deleted", "requestInfo", requestInfo) | ||
return ctrl.Result{}, nil | ||
} | ||
r.Log.Error(err, "Failed to get the KeptnEvaluation") | ||
|
@@ -96,7 +96,7 @@ func (r *KeptnEvaluationReconciler) Reconcile(ctx context.Context, req ctrl.Requ | |
evaluationDefinition, err := controllercommon.GetEvaluationDefinition(r.Client, r.Log, ctx, evaluation.Spec.EvaluationDefinition, req.NamespacedName.Namespace) | ||
if err != nil { | ||
if errors.IsNotFound(err) { | ||
r.Log.Info(err.Error() + ", ignoring error since object must be deleted") | ||
r.Log.Info("KeptnEvaluation not found, ignoring error since object must be deleted", "requestInfo", requestInfo) | ||
span.SetStatus(codes.Error, err.Error()) | ||
return ctrl.Result{Requeue: true, RequeueAfter: 10 * time.Second}, nil | ||
} | ||
|
@@ -116,7 +116,7 @@ func (r *KeptnEvaluationReconciler) Reconcile(ctx context.Context, req ctrl.Requ | |
return ctrl.Result{Requeue: true, RequeueAfter: evaluation.Spec.RetryInterval.Duration}, nil | ||
} | ||
|
||
r.Log.Info("Finished Reconciling KeptnEvaluation") | ||
r.Log.Info("Finished Reconciling KeptnEvaluation", "requestInfo", requestInfo) | ||
|
||
err := r.updateFinishedEvaluationMetrics(ctx, evaluation, span) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,8 @@ type KeptnWorkloadReconciler struct { | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *KeptnWorkloadReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
r.Log.Info("Searching for workload") | ||
requestInfo := controllercommon.GetRequestInfo(req) | ||
r.Log.Info("Searching for workload", "requestInfo", requestInfo) | ||
|
||
workload := &klcv1alpha3.KeptnWorkload{} | ||
err := r.Get(ctx, req.NamespacedName, workload) | ||
|
@@ -88,7 +89,7 @@ func (r *KeptnWorkloadReconciler) Reconcile(ctx context.Context, req ctrl.Reques | |
|
||
workload.SetSpanAttributes(span) | ||
|
||
r.Log.Info("Reconciling Keptn Workload", "workload", workload.Name) | ||
r.Log.Info("Reconciling Keptn Workload", "workload", workload.Name, "requestInfo", requestInfo) | ||
|
||
workloadInstance := &klcv1alpha3.KeptnWorkloadInstance{} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters