Skip to content

Commit

Permalink
fix: remove non-transient logs on missing artifact-repo configmaps
Browse files Browse the repository at this point in the history
Fixes #9085 by eliminating log-messages for override ConfigMaps which do
not have to exist.

Signed-off-by: Thor K. Høgås <[email protected]>
  • Loading branch information
jswxstw authored and thor committed Aug 30, 2024
1 parent 3d41fb2 commit 75edb7a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
27 changes: 20 additions & 7 deletions util/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,31 @@ func IgnoreContainerNotFoundErr(err error) error {
return err
}

// IsTransientErr reports whether the error is transient and logs it.
func IsTransientErr(err error) bool {
isTransient := IsTransientErrQuiet(err)
if !isTransient {
log.Warnf("Non-transient error: %v", err)
}
return isTransient
}

// IsTransientErrQuiet reports whether the error is transient and logs only if it is.
func IsTransientErrQuiet(err error) bool {
isTransient := isTransientErr(err)
if isTransient {
log.Infof("Transient error: %v", err)
}
return isTransient
}

// isTransientErr reports whether the error is transient.
func isTransientErr(err error) bool {
if err == nil {
return false
}
err = argoerrs.Cause(err)
isTransient := isExceededQuotaErr(err) ||
return isExceededQuotaErr(err) ||
apierr.IsTooManyRequests(err) ||
isResourceQuotaConflictErr(err) ||
isResourceQuotaTimeoutErr(err) ||
Expand All @@ -39,12 +58,6 @@ func IsTransientErr(err error) bool {
matchTransientErrPattern(err) ||
errors.Is(err, NewErrTransient("")) ||
isTransientSqbErr(err)
if isTransient {
log.Infof("Transient error: %v", err)
} else {
log.Warnf("Non-transient error: %v", err)
}
return isTransient
}

func matchTransientErrPattern(err error) bool {
Expand Down
2 changes: 1 addition & 1 deletion workflow/artifactrepositories/artifactrepositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (s *artifactRepositories) get(ctx context.Context, ref *wfv1.ArtifactReposi
err := waitutil.Backoff(retry.DefaultRetry, func() (bool, error) {
var err error
cm, err = s.kubernetesInterface.CoreV1().ConfigMaps(namespace).Get(ctx, configMap, metav1.GetOptions{})
return !errorsutil.IsTransientErr(err), err
return !errorsutil.IsTransientErrQuiet(err), err
})
if err != nil {
return nil, err
Expand Down

0 comments on commit 75edb7a

Please sign in to comment.