Skip to content

Commit

Permalink
Reduce error and info logs (#744)
Browse files Browse the repository at this point in the history
* reduce error logs (run-int-tests)

* reduce error logs (run-int-tests)

* reduce error logs (run-int-tests)

* reduce error and info logs (run-int-tests)
  • Loading branch information
achimweigel authored May 8, 2023
1 parent 4e534ea commit de758fa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion controller-utils/pkg/logging/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func StartReconcileFromContext(ctx context.Context, req reconcile.Request) (Logg
// StartReconcile works like StartReconcileFromContext, but it is called on an existing logger instead of fetching one from the context.
func (l Logger) StartReconcile(req reconcile.Request, keysAndValues ...interface{}) Logger {
newLogger := l.WithValues(lc.KeyReconciledResource, req.NamespacedName).WithValues(keysAndValues...)
newLogger.Info(lc.MsgStartReconcile)
newLogger.Debug(lc.MsgStartReconcile)
return newLogger
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/landscaper/controllers/execution/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ func (c *controller) handleReconcilePhase(ctx context.Context, exec *lsv1alpha1.
}

if !deployItemClassification.HasRunningItems() && deployItemClassification.HasFailedItems() {
err = lserrors.NewError(op, "handlePhaseProgressing", "has failed or missing deploy items")
err = lserrors.NewError(op, "handlePhaseProgressing", "has failed or missing deploy items", lsv1alpha1.ErrorForInfoOnly)
return c.setExecutionPhaseAndUpdate(ctx, exec, lsv1alpha1.ExecutionPhases.Failed, err, read_write_layer.W000134)
} else if !deployItemClassification.HasRunningItems() && !deployItemClassification.HasRunnableItems() && deployItemClassification.HasPendingItems() {
err = lserrors.NewError(op, "handlePhaseProgressing", "items could not be started")
err = lserrors.NewError(op, "handlePhaseProgressing", "items could not be started", lsv1alpha1.ErrorForInfoOnly)
return c.setExecutionPhaseAndUpdate(ctx, exec, lsv1alpha1.ExecutionPhases.Failed, err, read_write_layer.W000135)
} else if !deployItemClassification.AllSucceeded() {
// remain in progressing in all other cases
Expand Down
4 changes: 0 additions & 4 deletions pkg/landscaper/controllers/installations/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ func (c *Controller) setInstallationPhaseAndUpdate(ctx context.Context, inst *ls
[]interface{}{lc.KeyReconciledResource, client.ObjectKeyFromObject(inst).String()},
lc.KeyMethod, op)

if lsError != nil && !lserrors.ContainsErrorCode(lsError, lsv1alpha1.ErrorUnfinished) {
logger.Error(lsError, op+lsError.Error())
}

inst.Status.LastError = lserrors.TryUpdateLsError(inst.Status.LastError, lsError)

if inst.Status.LastError != nil {
Expand Down
17 changes: 12 additions & 5 deletions pkg/landscaper/controllers/installations/reconcile_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,22 @@ func checkIfSiblingImports(inst *lsv1alpha1.Installation, siblings []*installati
// This is achieved by a fatal error.
// - Otherwise, the existence of "sibling" means that "inst" cannot yet be deleted, but must be checked again later.
// This is achieved by a normal error.
func checkSuccessorSibling(inst *lsv1alpha1.Installation, sibling *installations.InstallationAndImports) (fatalError lserrors.LsError, normalError lserrors.LsError) {
func checkSuccessorSibling(inst *lsv1alpha1.Installation,
sibling *installations.InstallationAndImports) (fatalError lserrors.LsError, normalError lserrors.LsError) {

op := "CheckSuccessorSibling"

if inst.Status.JobID == sibling.GetInstallation().Status.JobIDFinished &&
sibling.GetInstallation().Status.InstallationPhase == lsv1alpha1.InstallationPhases.DeleteFailed {
return lserrors.NewWrappedError(SiblingDeleteError,
op, "SiblingDeleteError", SiblingDeleteError.Error()), nil

err := lserrors.NewWrappedError(SiblingDeleteError, op, "SiblingDeleteError",
SiblingDeleteError.Error(), lsv1alpha1.ErrorForInfoOnly)

return err, nil
}

return nil, lserrors.NewWrappedError(SiblingImportError,
op, "SiblingImport", SiblingImportError.Error())
err := lserrors.NewWrappedError(SiblingImportError, op, "SiblingImport", SiblingImportError.Error(),
lsv1alpha1.ErrorForInfoOnly)

return nil, err
}

0 comments on commit de758fa

Please sign in to comment.