You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
version_checker_is_available reports 0 for images whose tag still exists but was re-pushed (cached tag is mutated) #467
version_checker_is_available is 0 for a running image whose tag still exists
upstream, when that tag has been re-pushed to a new digest. Every other image
reports 1. Found on v0.12.0 (PR #447).
Example: running registry:3.1.2 with digest sha256:d4032d4c...c6c3.
Docker Hub still lists tag 3.1.2, but now with digest sha256:82f6ff4a...bc3c
(14 child images, none matching the running digest). The metric is 0 on every
reconcile, even though the tag exists.
Root cause
isLatestSemver (pkg/controller/checker/checker.go, lines 186 and 191)
appends "@" to latestImage.Tag when the tag is the same version but the
SHA differs upstream. latestImage is a pointer into the shared tag cache
(&cachedTags[i]), so the cached tag "3.1.2" becomes "3.1.2@sha256:82f6...".
Container() then calls CurrentImage, which falls back to a tag-name match
(pkg/version/version.go:134, tags[i].Tag == imageTag). The cached entry no
longer equals "3.1.2", so nothing matches, the result is nil and Available
is set to false.
When the running digest is still current, the mutating branch does not run
and the metric is 1, which is why only re-pushed tags are affected.
Reproduction
A unit test using a fake client.ClientHandler returning Docker Hub shaped
data: tags "3.1.1", "3.1.2" (SHA 82f6ff4a..., 14 children) and "latest".
Run Container() for image "registry:3.1.2" with pod imageID
docker.io/library/registry@sha256:d4032d4c...
and likewise for the child SHA branch. A regression test that calls Container() and then CurrentImage() on the same search instance, with a
re-pushed tag, would catch this.
Environment
version-checker v0.12.0, Kubernetes, Docker Hub official images, with --test-all-containers=true.
Activity