podman icon indicating copy to clipboard operation
podman copied to clipboard

feat(libpod): support kube play tar content-type

Open fixomatic-ctrl opened this issue 1 year ago • 6 comments

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
  1. make binaries Create a podman system service
  2. ./bin/podman system service --time=0 tcp://localhost:8888 Create a tar file example.tar with our example content
  3. cd ./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
  1. ./bin/podman kube play example/play.yaml

fixomatic-ctrl avatar Sep 19 '24 15:09 fixomatic-ctrl

[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.

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

openshift-ci[bot] avatar Sep 19 '24 15:09 openshift-ci[bot]

/retest

fixomatic-ctrl avatar Sep 20 '24 12:09 fixomatic-ctrl

@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.

openshift-ci[bot] avatar Sep 20 '24 12:09 openshift-ci[bot]

Wonder if this is worth implementing for the CLI side of things for Podman Desktop. Code LGTM

mheon avatar Sep 20 '24 18:09 mheon

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.

fixomatic-ctrl avatar Sep 24 '24 21:09 fixomatic-ctrl