Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Record unusable image manifests, rather than fail #1265

Merged
merged 1 commit into from
Aug 6, 2018

Conversation

squaremo
Copy link
Member

@squaremo squaremo commented Aug 1, 2018

At present the registry client considers a non-Linux/AMD64 image an
error, which provokes the image "cache" warmer to fail for that entire
image repo. As more and more image repositories have Windows images,
this mean flux won't be able to automate or even report on many
workloads.

What we actually want to do is just exclude unusable images from the
result; and for bonus points, record the fact that it wasn't a usable
image. To this end, I've wrapped the cache entries in a struct that
also includes an "excluded reason". If that field is present, the
fetch is considered a success, but the image is not included in the
result for the repo.

The cache entry version doesn't need to be bumped, because old entries
can be parsed as new entries. Happily, no-one has to refresh their
image DB from scratch.

Fixes #741.

At present the registry client considers a non-Linux/AMD64 image an
error, which provokes the image "cache" warmer to fail for that entire
image repo. As more and more image repositories have Windows images,
this mean flux won't be able to automate or even report on many
workloads.

What we actually want to do is just exclude unusable images from the
result; and for bonus points, record the fact that it wasn't a usable
image. To this end, I've wrapped the cache entries in a struct that
also includes an "excluded reason". If that field is present, the
fetch is considered a success, but the image is not included in the
result for the repo.

The cache entry version doesn't need to be bumped, because old entries
can be parsed as new entries. Happily, no-one has to refresh their
image DB from scratch.
@squaremo squaremo requested a review from aaron7 August 2, 2018 09:16
@squaremo squaremo merged commit 32c814f into master Aug 6, 2018
@squaremo squaremo deleted the issue/741-dont-balk-at-windows-images branch August 6, 2018 16:50
@squaremo
Copy link
Member Author

squaremo commented Aug 6, 2018

Thanks Aaron 🥇

squaremo added a commit that referenced this pull request Aug 23, 2018
I noticed that fluxd was continually fetching image manifests that
were "excluded", that is, had the wrong arch or otherwise weren't
suitable.

The design in #1265 was to mark those manifests as excluded, but count
them as successful fetches; and, to save the fact in memcached. The
implementation failed on three counts:

 - it would unconditionally use a cached result, even if excluded;

 - it was using the ID from excluded results (which have no ID value)
   as a key, so they got effectively thrown away anyway;

 - the encoding of results to JSON omitted the ExcludedReason field,
   because they embed the image.Info struct and thus inherit its JSON
   encoding methods.

This commit corrects those problems.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants