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

fix: remove non-transient logs on missing artifact-repositories configmap #13516

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
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 {
thor marked this conversation as resolved.
Show resolved Hide resolved
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
Loading