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

Add retry logic for image copying #63

Merged
merged 6 commits into from
Jun 9, 2020
Merged

Conversation

dymurray
Copy link
Contributor

@dymurray dymurray commented Jun 8, 2020

No description provided.

Copy link
Collaborator

@sseago sseago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, other than the minor 'return nil' nit, and the somewhat more substantial question of whether we want to retry for all errors or just the "blob unknown" case (see my comment for more details)

velero-plugins/migimagestream/shared.go Outdated Show resolved Hide resolved
if strings.Contains(err.Error(), "blob unknown to registry") {
log.Warn(fmt.Sprintf("encountered `blob unknown to registry error` for image %s", src))
}
log.Info(fmt.Sprintf("attempt #%v failed, waiting %vs and then retrying", i, retryWait))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're retrying on any error, not just "blob unknown to registry". Is that by design? This means we'll retry if the registry is down, among other things. If it's an error that takes a timeout to reach, we'll hit 5 timeouts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this isn't ideal but figured it was the easiest approach. I took this approach since I noticed the Docker CLI does the same and containers/image has a conversation to handle this specifically around the 429 HTTP code: containers/image#703.
They do an exponential backoff for 5 retries it looks like.

I would prefer to dig more into the specific errors this can return and make determinations on it but would need more time to do that properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a TODO to come back to this

@dymurray dymurray merged commit b7c9bbd into migtools:master Jun 9, 2020
dymurray added a commit that referenced this pull request Jun 9, 2020
* Add retry logic for image copying

* Remove unnecessary break

* Change to 5 retries

* Use proper format for prints

* Return empty byte array

* Add todo

(cherry picked from commit b7c9bbd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants