Add ReportResolvedSourceReference to copy.Options#702
Add ReportResolvedSourceReference to copy.Options#702justinmir wants to merge 1 commit intocontainers:mainfrom
Conversation
When registry mirrors are configured via registries.conf, callers of copy.Image have no way to discover which endpoint was actually contacted. The source's Reference() always returns the logical (user-requested) reference. Introduce a ResolvedImageSource interface in types/ that ImageSource implementations can satisfy to expose the physical endpoint. The docker transport implements this by returning its internal physicalRef. copy.Image populates the new ReportResolvedSourceReference option pointer when the source satisfies the interface, giving callers like CRI-O access to the resolved registry for metrics and diagnostics. Signed-off-by: Justin Miron <justin.miron@reddit.com>
|
Packit jobs failed. @containers/packit-build please check. |
1 similar comment
|
Packit jobs failed. @containers/packit-build please check. |
mtrmac
left a comment
There was a problem hiding this comment.
Thanks!
Hum… what should ever really use that value, as a primary implementation matter? [Arguably, c/image should be reporting its own metrics, without CRI-O having to care… we are nowhere near that, nor even slightly moving in that direction currently — but just a matter of “where does this go in the API”, it’s a bit of an argument against exposing it this way.]
What happens if we ever add the option to fall back to another mirror? (OTOH ultimately we can’t avoid hard-coding the concept of a “registry mirror” at some semantic level, of course.)
At a glance, this might be a better fit as a new event (or several?) in the progress reporting channel. That would, even, potentially, allow reporting the attempts to use a mirror (which can take a long time to timeout).
| // ResolvedImageSource is an optional interface that ImageSource implementations | ||
| // can satisfy to report the actual endpoint used when the source was resolved | ||
| // through mirrors or redirects. | ||
| type ResolvedImageSource interface { |
There was a problem hiding this comment.
If this should happen, please do it in the private types, and non-optional (we use ~mix-ins for the common “N/A” implementations).
+1 agree with this sentiment completely, cri-o shouldn't have to care from an API perspective and metrics in c/image should make much more sense. Given a world where we don't and won't have metrics in c/image for some time, would we be okay with exposing this information to cri-o somehow to expose in its own metrics? I think the progress reporting channel option seems reasonable as well. |
When registry mirrors are configured via registries.conf, callers of copy.Image have no way to discover which endpoint was actually contacted. The source's Reference() always returns the logical (user-requested) reference.
Introduce a ResolvedImageSource interface in types/ that ImageSource implementations can satisfy to expose the physical endpoint. The docker transport implements this by returning its internal physicalRef.
copy.Image populates the new ReportResolvedSourceReference option pointer when the source satisfies the interface, giving callers like CRI-O access to the resolved registry for metrics.