importer, registry-datasource: cleanup and simplify #4285
/cc @akalenyu @nav1s
@Acedus: GitHub didn't allow me to request PR reviews from the following users: nav1s.
Note that only kubevirt members and repo collaborators can review this PR, and authors cannot review their own PRs.
<details>
In response to this:
>/cc @akalenyu @nav1s
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
</details>

coverage: 49.885% (+0.1%) from 49.777% — Acedus:kill-transport into kubevirt:main
Is this wrapper still needed?
Could we use a reader that will allow us to verify that it was closed here?
Thanks @Acedus, looks pretty good, few comments below.
@nav1s: changing LGTM is restricted to collaborators
<details>
In response to this:
>Thanks @Acedus, looks pretty good, few comments below.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
</details>
Nope, let's drop it.
Approved these changes.
@nav1s: changing LGTM is restricted to collaborators
<details>
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
</details>
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/kubevirt/containerized-data-importer/pull/4285#pullrequestreview-5357102340" title="Approved">awels</a>
The full list of commands accepted by this bot can be found here.
The pull request process is described here
<details >
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":[]} -->
nav1s
Acedus
<!-- Thanks for sending a pull request! Here are some tips for you:
1. Follow the instructions for writing a release note from k8s: https://git.k8s.io/community/contributors/guide/release-notes.md
-->
What this PR does / why we need it:
Cleanup of the registry import path. Along the way it fixes a reader stack leak when
NewFormatReadersfails, anImageSourcedouble close, and three fetches of the same image config instead of one.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
The last commit pulls layer extraction out of the registry code into a
fileExtractorhanded ablobOpener, so the tar walk, without handling and zip-slip guard can be unit tested instead of going through OCI archive fixtures.Release note:
<!-- Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
``
release-note
``NONE