Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce error and info logs #744

Merged
merged 4 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}