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

Added retryable etcdserver errors to the retry list #300

Merged
merged 2 commits into from
Sep 2, 2021
Merged
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
12 changes: 11 additions & 1 deletion pkg/kapp/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func (c *ResourcesImpl) isPodMetrics(resource Resource, err error) bool {
}

func (c *ResourcesImpl) isGeneralRetryableErr(err error) bool {
return IsResourceChangeBlockedErr(err) || c.isServerRescaleErr(err) ||
return IsResourceChangeBlockedErr(err) || c.isServerRescaleErr(err) || c.isEtcdRetryableError(err) ||
c.isResourceQuotaConflict(err) || c.isInternalFailure(err) || errors.IsTooManyRequests(err)
}

Expand Down Expand Up @@ -515,6 +515,10 @@ var (
// Post https://cert-manager-webhook.cert-manager.svc:443/convert?timeout=30s:
// x509: certificate signed by unknown authority (reason: )
conversionWebhookErrCheck = regexp.MustCompile("conversion webhook for (.+) failed:")

// Matches retryable etcdserver errors
// Comprehensive list of errors at : https://github.com/etcd-io/etcd/blob/main/server/etcdserver/errors.go
etcdserverRetryableErrCheck = regexp.MustCompile("etcdserver:(.+)(leader changed|timed out)")
praveenrewar marked this conversation as resolved.
Show resolved Hide resolved
)

func IsResourceChangeBlockedErr(err error) bool {
Expand All @@ -532,6 +536,12 @@ func IsResourceChangeBlockedErr(err error) bool {
}
}

// Retries retryable errors thrown by etcd server.
// Addresses : https://github.com/vmware-tanzu/carvel-kapp/issues/106
func (c *ResourcesImpl) isEtcdRetryableError(err error) bool {
return etcdserverRetryableErrCheck.MatchString(err.Error())
}

type AllOpts struct {
ListOpts *metav1.ListOptions
}
Expand Down