Skip to content

Conversation

@awprice
Copy link
Contributor

@awprice awprice commented Dec 3, 2019

This commit improves the fallback behaviour when resolving and
fetching images with multiple hosts. If an error is encountered
when resolving and fetching images, and more than one host is being
used, we will try the same operation on the next host. The error
from the first host is preserved so that if all hosts fail, we can
display the error from the first host.

fixes #3850

Signed-off-by: Alex Price aprice@atlassian.com

@awprice
Copy link
Contributor Author

awprice commented Dec 3, 2019

Had a little bit of difficulty coming up with good tests for this, any pointers would be helpful. I definitely think tests are needed to ensure this behaviour isn't lost.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 3, 2019

Build succeeded.

@dmcgowan
Copy link
Member

dmcgowan commented Dec 3, 2019

Had a little bit of difficulty coming up with good tests for this, any pointers would be helpful. I definitely think tests are needed to ensure this behaviour isn't lost.

The tests have a common pattern, but most rely on returning an HTTP code. You can try either returning a panic in the handler or wrapping the listener to return a connection which closes. TLS to non-TLS endpoint could simulate the error too.

@codecov-io
Copy link

codecov-io commented Dec 3, 2019

Codecov Report

Merging #3868 into master will decrease coverage by 3.25%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3868      +/-   ##
==========================================
- Coverage   45.72%   42.46%   -3.26%     
==========================================
  Files         117      130      +13     
  Lines       11765    14702    +2937     
==========================================
+ Hits         5379     6243     +864     
- Misses       5462     7538    +2076     
+ Partials      924      921       -3
Flag Coverage Δ
#linux 45.85% <64.7%> (+0.13%) ⬆️
#windows 38% <66.66%> (?)
Impacted Files Coverage Δ
remotes/docker/resolver.go 56.25% <100%> (-0.29%) ⬇️
remotes/docker/fetcher.go 59.52% <58.82%> (+17.02%) ⬆️
archive/tar_opts.go 58.82% <0%> (-12.61%) ⬇️
snapshots/native/native.go 42.42% <0%> (-10.27%) ⬇️
cio/io.go 46.47% <0%> (-8.53%) ⬇️
archive/tar.go 48.18% <0%> (-8.51%) ⬇️
metadata/snapshot.go 48.47% <0%> (-7.19%) ⬇️
metadata/containers.go 49.84% <0%> (-6.26%) ⬇️
content/local/writer.go 58.65% <0%> (-5.55%) ⬇️
content/local/store.go 49.52% <0%> (-5.29%) ⬇️
... and 76 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff91f22...a022c21. Read the comment docs.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 3, 2019

Build succeeded.

@awprice
Copy link
Contributor Author

awprice commented Dec 3, 2019

Had a little bit of difficulty coming up with good tests for this, any pointers would be helpful. I definitely think tests are needed to ensure this behaviour isn't lost.

The tests have a common pattern, but most rely on returning an HTTP code. You can try either returning a panic in the handler or wrapping the listener to return a connection which closes. TLS to non-TLS endpoint could simulate the error too.

Thanks for the pointers, working on tests now.

@awprice
Copy link
Contributor Author

awprice commented Dec 3, 2019

Tests added. They aim to test two cases:

  • Falling back to the second host when the first is unresponsive/not running
  • Falling back to the second host when communicating over TLS to the first non-TLS host

@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 3, 2019

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 12, 2019

Build succeeded.

This commit improves the fallback behaviour when resolving and
fetching images with multiple hosts. If an error is encountered
when resolving and fetching images, and more than one host is being
used, we will try the same operation on the next host. The error
from the first host is preserved so that if all hosts fail, we can
display the error from the first host.

fixes containerd#3850

Signed-off-by: Alex Price <aprice@atlassian.com>
@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 13, 2019

Build succeeded.

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

LGTM

@dmcgowan dmcgowan merged commit 5661214 into containerd:master Dec 17, 2019
@coreyjohnston
Copy link

Its been over a month since 1.3.2 was released. Do we know when we're expecting the next release which will include this?

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.

More robust mirror fallback

6 participants