podman
podman copied to clipboard
feat(libpod): support kube play tar content-type
Part of https://github.com/containers/podman/issues/14527
Does this PR introduce a user-facing change?
Operation PlayKubeLibpodapi support Content-Type `application/x-tar`
Testing with a tar file
Create a test directory with the following structure
.
└── example/
├── play.yaml
└── foobar/
└── Containerfile
play.yaml
apiVersion: v1
kind: Pod
metadata:
name: demo-build-remote
spec:
containers:
- name: container
image: foobar
example/foobar/Containerfile
FROM docker.io/library/alpine:latest
make binariesCreate a podman system service./bin/podman system service --time=0 tcp://localhost:8888Create a tar fileexample.tarwith our example contentcd ./example && tar cvf example.tar *
$: curl --location 'http://localhost:8888/v5.0.0/libpod/kube/play' \
--header 'Content-Type: application/x-tar' \
--data '@./example/example.tar'
{
"Pods": [
{
"ID": "<omitted>",
"Containers": [
"<omitted>"
],
"InitContainers": null,
"Logs": null,
"ContainerErrors": null
}
],
"Volumes": null,
"StopReport": null,
"RmReport": null,
"VolumeRmReport": null,
"SecretRmReport": null,
"Secrets": null,
"ServiceContainerID": "",
"ExitCode": null
}
Testing backward compatibilty
Let's check we did not break the basic support
play.yaml
Change to
apiVersion: v1
kind: Pod
metadata:
name: demo-build-remote
spec:
containers:
- name: container
image: docker.io/library/nginx:latest
./bin/podman kube play example/play.yaml
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: fixomatic-ctrl Once this PR has been reviewed and has the lgtm label, please assign edsantiago for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/retest
@fixomatic-ctrl: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
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.
Wonder if this is worth implementing for the CLI side of things for Podman Desktop. Code LGTM
Ephemeral COPR build failed. @containers/packit-build please check.
It would be nice to have an actual API level test here with a tarball, please see test/apiv2 for such test. There are already some libpod/build tests there that show how it should be done.
@Luap99 while making the tests, I noticed that if we already build the image(s), we do not have any way to force the re-build. It would re-use the existing image. Therefore I added a query parameter build, which would be translated to the PlayKubeOptions.