Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to pull LVH images directly from OCI repositories #133

Merged
merged 5 commits into from
Jan 9, 2024

Conversation

joestringer
Copy link
Member

@joestringer joestringer commented Jan 6, 2024

This PR adds support to directly pull VM images in the CLI so that the user
doesn't need to do this if they just want to reuse existing images that were
already built for the Cilium project.

The first command added is a direct replacement for the image pull script.
It pulls an image from the specified OCI repository and decompresses it
for local usage. Example usage:

$ lvh images pull quay.io/lvh-images/kind:bpf-next-main

The second command leverages the same underlying support in order to directly
run VM images from the OCI image. This removes the need for users to manually
pull it. Example usage:

$ lvh run --image quay.io/lvh-images/kind:bpf-next-main

@joestringer joestringer force-pushed the pr/joe/docker-pull branch 2 times, most recently from 4165722 to 2217288 Compare January 8, 2024 20:48
@kkourt kkourt self-requested a review January 9, 2024 05:21
Copy link
Collaborator

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

One thought I had was to add a manifest file in the images that describe what the OCI image contains (e.g., rootfs images, kernels, etc.). But until we have that, auto-detection is great.

cmd/lvh/images/pull.go Outdated Show resolved Hide resolved
Add support to pull LVH images directly from the commandline so that
users who don't need to customize the image can directly pull the
required images directly rather than having to run another script or
manually pull & decompress the images locally.

Example usage:

$ lvh images pull quay.io/lvh-images/kind:5.4-main

Signed-off-by: Joe Stringer <[email protected]>
These will be used by an upcoming commit to pull LVH images directly
from the CLI.

Signed-off-by: Joe Stringer <[email protected]>
Example usage:

$ lvh run --image quay.io/lvh-images/kind:bpf-next-main

Signed-off-by: Joe Stringer <[email protected]>
Replace the open-coded image pull and decompression with native OCI
image support directly in LVH.

Signed-off-by: Joe Stringer <[email protected]>
@joestringer
Copy link
Member Author

joestringer commented Jan 9, 2024

Yeah the autodetect is not entirely ideal since I did notice some docker images have multiple VM images inside. Autodetect is arbitrarily picking one. But then it also extracts every image, so if you know what you're doing then you can use the image pull and then subsequently explore the _data/images directory and pick the one you want. A manifest file could help with this, and we could potentially add some additional flag or syntax to pick between them if there are multiple.

Another potential area for expansion is to add a similar functionality for kernels (--kernel), which seem to be often published in separate docker images. I briefly looked into this, and it seemed like the kernel docker images published for LVH are not using bzImage so I wasn't quite sure how to extract + override the image settings to allow a specific kernel docker image to override the base LVH image kernel. Anyway, this is what I needed for now, I won't make any promises about digging further into that idea.

I fixed up the flag as you suggested, will merge. Thanks for the review!

@joestringer joestringer merged commit 218de8b into main Jan 9, 2024
1 check passed
@joestringer joestringer deleted the pr/joe/docker-pull branch January 9, 2024 19:11
brb added a commit to cilium/cilium that referenced this pull request Jul 7, 2024
To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
github-merge-queue bot pushed a commit to cilium/cilium that referenced this pull request Jul 8, 2024
To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
giorio94 pushed a commit to cilium/cilium that referenced this pull request Jul 15, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
giorio94 pushed a commit to cilium/cilium that referenced this pull request Jul 15, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
giorio94 pushed a commit to cilium/cilium that referenced this pull request Jul 15, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
giorio94 pushed a commit to cilium/cilium that referenced this pull request Jul 15, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
giorio94 pushed a commit to cilium/cilium that referenced this pull request Jul 15, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
aanm pushed a commit to cilium/cilium that referenced this pull request Jul 15, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
aanm pushed a commit to cilium/cilium that referenced this pull request Jul 18, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
joestringer pushed a commit to cilium/cilium that referenced this pull request Jul 18, 2024
[ upstream commit ad7d792 ]

To adjust to the changes from
cilium/little-vm-helper#133.

Signed-off-by: Martynas Pumputis <[email protected]>
Signed-off-by: Marco Iorio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants