-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Machine init with an explicit image path url always downloads #14388
Comments
@baude PTAL |
right now, that is the defined behavior and not a bug. that said, we could change the behavior. when we deal with official images, we can determine if an image has changed by it's shasum. in the case of an individual url like you explained, there is no mechanism for that (right now). If you happen to be developing and testing an fcos image (finger pointing at me), then this default behavior is preferable because the filename of the test image may not change. what say you @containers/podman-maintainers ? |
I think by the official images you are referring to the latest ones that can be accessed by the logical build stream names of For the layer of automation orchestration I have on top of podman I chose to version pin the FCOS image version in use as this being used with a large corporate client. This eases our support activities with that client base. With that said, it is good to know this is not a bug. But I still think the SHASUM should always been recomputed and validated and on every I suggest the best of both worlds: a new feature on the CLI for |
A friendly reminder that this issue had no activity for 30 days. |
@rhatdan - I have to recreate my podman machine every day that i want to use it (m1 issues), so downloading a 600mb fcos image every day is a pretty major problem (slow, uses a lot of bandwidth quota). I'm not even using any specific urls or anything, just finding that the default behavior is creating an issue in my usage. |
@alexanderankin, if you're using the default fcos images (ie, next, stable), and not using a custom URL, Podman should not be downloading the image every day, as we do cache the image. Otherwise, the best thing to do to avoid pulling every day is to download the image in another directory and point the |
@ashley-cui I didn't realize that |
@alexanderankin Good news, this is not an M1 Mac issue at all. But what you say is on point. @ashley-cui The "custom URL" is from the FCOS build streams itself. This is why I offered a possible resolution to this from my previous comment on this issue. Having some "baked in" feature for the convenience of engineers / developers just because they need it without an ability to override that behavior is poor thinking, design and implementation. Think globally. Sorry, but, I am bringing to the table the global perspective beyond that of engineering (which I am a die hard engineer). I have had to work around this behavior for a strategic client and partner (and we can talk about this offline if you would like). Fact is, time to think "enterprise'. |
@cpolizzi I understand you are using a FCOS build stream itself, but Podman is unable to verify the shasum of the pulled file if it is straight from a URL. We're only able to cache the next/stable versions of FCOS because FCOS provides a pull package that will tell us shasums before we actually pull the new file. With a generic URL, podman is unable to verify shasums to pull, and I'm hesitant to cache based on other factors, such as filenames, because they might change, or the contents will change with the same filename. I would recommend working around the issue like @alexanderankin has, by downloading the image separately from podman and setting the pull path to the local image. |
@ashley-cui I beg to differ. Podman client could easily be orchestrated to pull the build metadata endpoint already present, locate the appropriate JSON node in the response from the endpoint and then compare the SHA sum for that release to what is currently and locally on disk. This is just simple behavior modification and is in no way "not possible". This is not purely caching but this is caching with validation. Yeah, I've already worked around the baked in behavior but again one should not have to. Consider that every "custom URL" as you call it (which it is not, it is a URL from the stream metadata endpoint itself) contains everything that is needed. The "custom URL" is directly from this build stream metadata endpoint and in fact, as you know, has the name of the build stream itself embedded in the URL, predictably so: https://builds.coreos.fedoraproject.org/prod/streams/{stream-name}/builds/... Given this fact the "custom URL" could easily be parsed to determine the build stream and from that pull the metadata endpoint reliably: https://builds.coreos.fedoraproject.org/streams/{stream-name}.json The JSON response has all the information needed if one is willing to dig through it with say JSON query (architecture + artifact + formats) which will yield the specific download URL as well as signatures, image SHA-256 and the uncompressed image SHA-256. Alternatively one could JSON query for the "custom URL" in this response payload and then "backstep" to the parent node defining this information. And yet, a third alternative is to simply JSON query based on the "custom URL" release name for against the metadata endpoint response for the value of release where the value of this is the release version such as 36.20220703.3.1. So, would you be so kind as to explain why what you state is not feasible please? Surely, it is additional logic, But, it is entirely possible from where I sit. So when you say "I'm hesitant to cache based on other factors, such as filenames, because they might change ..." is this because you are thinking "well, what someone self-hosted the build streams privately?" Because if not then the filenames, paths and URLs themselves have already been set in proverbial stone. Otherwise, with private self-hosting of this entire ecosystem of build automation and what not it still could actually be reliably determined. All that needs to happen in that case is the simple and trivial definition of "standards". |
Hi all - I'll weigh in and see if what I say helps some :) One objective we've had is "it works everyday" for the end-users at for the 100+ developers with new developers onboarding / setting up podman (and often first exposure to containers at all). To do this we have to pin the version of podman; the podman machine. The wrapper we wrote is configured to pull in a specific version of the podman machine that we know works reliably, and this is done via the URL from the fedoraproject. Maybe it would help if we constrain the scope some? I like what @baude suggested by comparing sha's. We've also been experiencing (several times a week) where the resulting download is truncated for some reason (likely fault of the corporate proxy/vpn). The image that gets created on the filesystem is 0 bytes. If the code is co-located well, perhaps we could also put in a check to say "ensure that the downloaded file matches" before trying to create/init the machine itself. The errors that occur when podman tries to create a machine from a 0 byte image is cryptic to say the least. It more or less tries to create the machine, but the machine never responds. |
PRs welcome... |
A friendly reminder that this issue had no activity for 30 days. |
We handled this case in our own automation that seamlessly provides a smooth end developer experience for our customer from the state of "I have no container engine at all" to "I am up and running with podman", all in restrictive environments. We actually are going to have to handle this in our same automation instead but were hoping the podman project would just simply handle it which would be substantially better (and same for all of the things we had to do for getting podman to work in restrictive environments). Also please note that this "automation" is a fancy set of a bunch of script modules all orchestrated by a top-level single entry point script. |
@cpolizzi Ok, let's think this one through and see if we can find a compromise for your use case. When podman does an init without a custom URL, it goes online and parses some JSON that is generated by the FCOS release process. The parsing is done with a library provided to us by the FCOS people. The image-path command line option was not deigned with your use case in mind. It was developed for a one-off boot of an image; in fact, largely just handy for us to test an unpublished image. If you are using custom FCOS builds and using their tools like So my solution would be as follows. If you want to mimic what we do with init, we could add a containers-common variable in the machine stanza for where Podman would look for a JSON file. From there, it will behave like normal by using sha's to determine if an image is available or the same. We basically did exactly this approach when Podman 4 released but Fedora 36 has not; I made a temporary download location that had the JSON and hardwired that location in Podman's code. This makes me reasonably confident it would work. One minor issue is that for a new user who has not run Podman yet, that conf file does not exist. So it would need to be provided in your case; or we would have to expose a command-line option; the latter of which I would prefer to avoid. |
A friendly reminder that this issue had no activity for 30 days. |
@baude My apologies for my delay on this. Currently, for our customer, we have resolved this through our existing automation and also did a slight course correction for future planned work. That course correction is that we import our desired FCOS image from the project for both Intel and Apple silicon into a private storage solution. We augmented our automation to perform the SHA validation of what the user has locally versus what we provision into that centralized private storage solution and react accordingly. The next part of this course correction with our customer is that we intend to customize the FCOS image from the project via |
Is there a way to make --image-path as part of some config. So when the end-user runs "podman machine init" the config is read from their respective config file (or a global config file) and uses an alternative path for grabbing the respective coreos? |
in containers.conf
|
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Initializing a new podman machine using a specific FCOS image URL always downloads the image from the URL and does not first check if it already exists to bypass the download.
Steps to reproduce the issue:
podman machine init --image-path https://builds.coreos.fedoraproject.org/prod/streams/next/builds/36.20220522.1.0/aarch64/fedora-coreos-36.20220522.1.0-qemu.aarch64.qcow2.xz
podman machine list
ls -l ~/.local/share/containers/podman/machine/qemu/fedora-coreos-36.20220522.1.0-qemu.aarch64.qcow2.xz
podman machine rm --force
ls -l ~/.local/share/containers/podman/machine/qemu/fedora-coreos-36.20220522.1.0-qemu.aarch64.qcow2.xz
'podman machine init --image-path https://builds.coreos.fedoraproject.org/prod/streams/next/builds/36.20220522.1.0/aarch64/fedora-coreos-36.20220522.1.0-qemu.aarch64.qcow2.xz
Describe the results you received:
FCOS image is always download despite that it exists on the host in the correct cached location.
Describe the results you expected:
FCOS image is only downloaded when needed (e.g., not present in the correct cached location, otherwise, cached image is used). Download should be bypassed and the FCOS image should immediately be extracted. FCOS build stream metadata should not be checked nor verified.
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman --version
:Package info (e.g. output of
brew info podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
M1 Mac Mini
The text was updated successfully, but these errors were encountered: