It's mooted in https://github.com/fluxcd/toolkit/discussions/164 that
a distinct metric is used for not completing reconciliation, as
opposed to an unexpected error. Until that discussion has run its
course, we should just do what the other controllers do, and that's
returning an error when the controller is unable to reconcile to
completion.
This also adds a comment noting the purpose of the redundant `Requeue:
true` fields, for the avoidance of confusion later.
This adds the details of calculating the latest image for a policy. It
relies on the ImageRepository and ImagePolicy controllers having a
shared database of image tags. Usually, this sort of thing would be
objects in the Kubernetes database; but since tags (and images) can
number in the tens of thousands per image, I'm using a separate
database. For the minute, it's just a map.
In this commit I use the test registry implementation to check that
the controller will scan the tags of an image. This needs a bit more
scaffolding, since the test registry doesn't handle /tags/list.
This commit adds a little code to scan the image repository given in
an ImageRepository resource, and report the (number of) tags there. It
does so anonymously, so it'll only work for public repos for the
minute.
The next step is to introduce ImagePolicy resources and figure out the
interaction with them -- e.g., if they only care about semver, you
might only need to get the tags.