VEP 395: Support direct OCI layer fetch with Layer option #4301
/cc @0xFelix @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 @0xFelix @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>
Message: "Source registry Layer selector cannot contain an empty key",

coverage: 50.688% (+0.3%) from 50.376% — Acedus:registry-ds-layer-support into kubevirt:main
Add case for nil map?
This is pretty loose at the moment, allowing to supply any image that has just this mediaType. What about asserting on well known artifactTypes as well? We can only work with application/vnd.kubevirt.virtualmachine.v1 and application/vnd.kubevirt.virtualmachinetemplate.v1 as specified by VEP 256.
Similar for layers, as for manifests. Filter on the mediaType, to only allow well known / supported media types?
application/vnd.kubevirt.disk.raw+zstd + application/vnd.kubevirt.persistentstate.tar+zstd after https://github.com/kubevirt/enhancements/pull/464 was merged.
Press F to pay respects
In that case, a user could receive a different Platform than they've requested? Should it not fail instead? I.e. cannot restrict with Platform on a plain manifest.
F
I've purposefully made it rather generic and deliberately hoped to avoid mentioning kubevirt wherever possible. I don't mind doing that, though.
I agree, but it would mean that virt-import would need to avoid passing a platform option for what it resolves to be a plain manifest.
IIUC the importer recursively detects the file format it works with, i.e. you can stack formats freely? What would happen with a media type of application/vnd.oci.image.layer.v1.tar or application/vnd.oci.image.layer.v1.tar+gzip? If that works we don't have to limit it to the known media types.
With the above media types it would have to look for a *.img file again.
If that's not supported anyway, I'm happy to avoid it in virt-import.
I guess we can limit on artifactType for starters .
~~That's fair, I forgot we need to support application/vnd.kubevirt.persistentstate.tar+zstd, let me see what we can do.~~
EDIT: Left my thoughts on the VEP.
nit: should we move these consts to the const block at the top?
nit: shouldn't this be: "nil for container disk image"?
should we support nested indexes here?
should we verify the digest we got here is what we ordered? (as far as I can tell this is the caller's responsibility), reference
Thanks @Acedus! looking pretty sharp, few comments below
It's actually idiomatic to keep consts separate depending on their logical use near their consumers in Go.
No, imports aren't just for container disks.
We could support it later as a follow-up if we add support for a producer that does it.
Good catch.
@nav1s @0xFelix I believe it's ready now.
IIUC then src.GetBlob is passed as open. It doesn't verify the blob against layer.Digest. Wrap it in layer.Digest.Verifier() and fail if it's not Verified()?
Doesn't have to be this PR, but it would be good to know how to reproduce the test artifacts, i.e. with a script?
VEP table still says verify Platform on a plain manifest, will update the VEP to say refuse.
Sure, I can write something up.
See recent PRs in virt-import, there's code to create artifact fixtures: https://github.com/kubevirt/virt-import/pull/6
Sounds good but yeah, probably worth doing it in a follow-up.
Ping on two unresolved threads, otherwise LGTM!
Ping on two unresolved threads, otherwise LGTM!
Sorry, should be good now.
/cc @akalenyu
Looking good, two nits below
Thanks @Acedus!
Thanks!
/test pull-containerized-data-importer-e2e-hpp-previous
I think the failure has to do with informer not syncing the defaultsc=false change.
great stuff! thank you!
/approve
was thinking about the JSON passing mechanism; maybe we can eventually start placing new annotations in a config map that gets mounted by importer (not too keen on converting all existing, just want to stop accumulating new data)
something for a follow up, not necessarily by the author of this PR :stuck_out_tongue:
https://github.com/kubevirt/containerized-data-importer/issues/4369
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/kubevirt/containerized-data-importer/pull/4301#pullrequestreview-6040958617" title="Approved">akalenyu</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:
This PR implements the CDI portion of https://github.com/kubevirt/enhancements/issues/395. It adds a
Layerfield toDataVolumeSourceRegistrythat enables filtering and fetching a single OCI blob directly according to a set of annotations.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:
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
``Added Layer option for Registry DataSource to allow importing disk images from specific OCI image layers by filtering with annotations.