-
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
Add podman play kube --build support for podman remotes #14527
Comments
@baude PTAL The problem with remote support is that remote build has to tar the full context dir and send it to the remote server. |
A friendly reminder that this issue had no activity for 30 days. |
@flouthoc PTAL |
Why is it a problem ? It is what |
The client doesn't parse the yaml so it has no idea what is specified in the file as such it can never perform any builds. You would need a major rewrite of the API in order to allow such things and this is not trivial. |
@Luap99 After looking a bit at the code, I still think that the client does not need to parse the file.
|
tarContent := []string{options.ContextDirectory} |
Then it provide in the POST request at /build
the tar file as the body
podman/pkg/bindings/images/build.go
Line 590 in acc78af
response, err := conn.DoRequest(ctx, tarfile, http.MethodPost, "/build", params, headers) |
On the server side, it will ensure the content body is x-tar
.
podman/pkg/api/handlers/compat/images_build.go
Lines 42 to 43 in bd00c6f
case "application/x-tar": | |
break |
Then untar, and uses it as the ContextDirectory
kube play
mechanism
When using kube play
according to the documentation, the default ContextDirectory will be the parent folder of the yaml file provided. Or the value defined by --context-dir option.
The body of the request kube play
is not the context directory as it is not supported, but simply concat all the yaml resources
podman/pkg/bindings/kube/kube.go
Line 70 in 72f1617
body = io.NopCloser(bytes.NewReader(yamlBytes)) |
and provide them as body.
podman/pkg/bindings/kube/kube.go
Line 78 in 72f1617
response, err := conn.DoRequest(ctx, body, http.MethodPost, "/play/kube", params, header) |
Question
My question is, why just like the build
command, where the Containerfile is not parsed by the client, and the context is simply send to the server, the same could be done for the kube play
From the docs: Kube play is capable of building images on the fly given the correct directory layout and Containerfiles. This option is not available for remote clients, including Mac and Windows (excluding WSL2) machines, yet. Consider the following excerpt from a YAML file:
If there is a directory named foobar in the current working directory with a file named Containerfile or Dockerfile, Podman kube play builds that image and name it foobar. An example directory structure for this example looks like:
The build considers foobar to be the context directory for the build NOT . If there is an image in local storage called foobar, the image is not built unless the --build flag is used. Use --build=false to completely disable builds. So without reading the file you cannot know what the dir on the client because the context dir is based of the image name foobar. Also without reading the file we wouldn't even know how to name the final image. |
I do not see the problem of sending the entire directory where |
Sending a (possible) large directory by default is very bad. |
I understand the concerns, context directory can be very big on build too, but we are still sending them. IMO the sizing issue is the user responsibility: when building an image or a pod making a context directory that is okey to deal with is on the user part. I still think that this would be manageable, and could be improve by having the |
If you want to propose a specific way on how to do it then sure please do so here. You can also join our cabal meetings to discus it there, next one on July 2 (https://hackmd.io/gQCfskDuRLm7iOsWgH2yrg?both). So feel free to add this topic there. |
This issue has been mentioned by this PR that tries to fix it. The right way to solve this would be to package and send the images-named folders and context-dir folders (and that requires the client to parse YAMLs and the API to be adapted) but as mentioned by @Luap99 this is not trivial and since it's not a top priority it's unlikely that we are going to implement it in the short term. But there may be a workaround solution, easy to implement, that would address the default podman machine cases. Podman machine automatically mounts some host folders inside the VM (mainly For This doesn’t solve all the use cases (i.e. remote hosts, non-default machine mounts, build contexts in non-mounted paths etc…) but is simple to implement and unblock the podman machine cases. @fixomatic-ctrl would this address your use case? |
I understand that this is a complicated task, and clearly not trivial, thanks for the explanation and details.
This would partially address some of my use cases, but I would not be able to continue using podman from inside a dev-container, the solution provided would not fix the problem as it would not be able to find a valid path to provide the resources. Given the details of the explanation for the
|
@fixomatic-ctrl please provide more details. My understanding is that you are running |
Our devs have a mixture of both OS X and Linux. It would be really nice for this feature to work. |
Fixes containers#14527 Signed-off-by: fixomatic-ctrl <180758136+fixomatic-ctrl@users.noreply.github.com>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind feature
Description
podman play kube --build
is not supported on remote podman. The documentation doesn't specify why, and I wasn't able to find any discussion of why exactly it isn't working, aspodman build
works on remote mode.The use case is developing on immutable distributions like Fedora Silverblue. I'm running podman inside a toolbox, I can build images manually with
podman --remote build
, I would likepodman play kube
to be able to build as well, so I only need one command to local development.Steps to reproduce the issue:
podman play kube --build
Describe the results you received:
Error: unknown flag: --build
Describe the results you expected:
Build to work on remote podman.
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:The text was updated successfully, but these errors were encountered: