OCPNODE-4477: docker: add blob-level mirror fallback in dockerImageSource #845
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 406 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #845"
general
weight: 0.35
QiWang19
Summary
In disconnected/restricted environments, a mirror can pass the manifest
check in
newImageSource()but then fail blob downloads (5xx, timeout,or partial mirror returning BLOB_UNKNOWN). When this happens, the copy
fails and CRI-O propagates the error to kubelet — which retries from
scratch, picks the same broken mirror, and deadlocks.
This PR adds blob-level mirror fallback(full blob downloading and partial chunk
fetches used by lazy image pulling (zstd:chunked)) inside
dockerImageSourcesothat when a blob fetch fails, remaining configured mirrors are tried
before giving up. The fallback is transparent to all callers (CRI-O,
Podman, Buildah, Skopeo).
Design choices
Fallback triggers: Only transient errors (5xx, network timeout),
blob-not-found (BLOB_UNKNOWN), and rate limiting (429) trigger
fallback. Other 4xx errors (auth failures, etc.) are fatal — they
indicate a configuration problem, not a source issue.
Serialized mirror probing:
getBlobWithMirrorFallback()holdsmirrorMufor the entire probe loop. This is intentional: the firstgoroutine to hit a failure walks the mirror list while the rest block on
getActiveSource(), then reuse the discovered working mirror viamirrorOverride. This avoids N goroutines independently exhausting themirror list.
No manifest re-fetch on fallback: Blob digests from the original
manifest are used against fallback sources. Safe because digests are
content-addressed. Fallback uses
newPullClient()to create only aclient and reference, skipping the manifest fetch; configured mirrors
are expected to have the image in practice, and isMirrorFallbackError
handles BLOB_UNKNOWN to move to the next source if it doesn't.
remainingSourcesincludes mirrors AND the primary location: Thefallback loop tries whatever
pullSourcesentries come after theinitially-selected source, which may include the original upstream
registry.
Same-mirror retry on transient errors:
tryGetBlob()retries oncewith 1s+jitter delay before moving to the next source. This handles
brief 503 spikes without immediately triggering the full fallback
machinery.
~~Questions~~
Re: https://github.com/podman-container-tools/container-libs/pull/845#pullrequestreview-4330576035
isMirrorTransientError()/isMirrorFallbackError()? Should any other error types be included or excluded?getBlobWithMirrorFallback()serializes all blob goroutines during fallback — is this acceptable, or would you prefer a different concurrency strategy?tryGetBlob()retry once on the same mirror before falling back, or should any failure immediately try the next source?Out of scope (future work from the review)
bodyReader's reconnect to the same source also fails, it could try a different mirror instead of giving up. This is tracked: https://github.com/podman-container-tools/container-libs/issues/987Fixes: https://issues.redhat.com/browse/OCPSTRAT-3170