Commit graph

1702 commits

Author SHA1 Message Date
OpenShift Merge Robot 26049193e0
Merge pull request #7642 from jwhonce/issues/7327-2
Refactor API version values
2020-09-16 04:06:30 +02:00
Jhon Honce 8a8bae8299 Refactor API version values
* API-Version header now Major.Minor to support tools parsing this
   header
 * Libpod Version updated to 2.0.0 to reflect changes in API field
   values
 * API-Version and Libpod-API-Version headers are now included in all
   results

Fixes #7327

 * Header support tested against goland 2020.2 and
    https://www.jetbrains.com/help/idea/docker.html plugin

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-15 11:29:45 -07:00
OpenShift Merge Robot e7af517914
Merge pull request #7633 from edsantiago/minus_l_with_other_args
Usability: prevent "-l" with arguments
2020-09-15 19:58:19 +02:00
OpenShift Merge Robot 3b4ad9a81d
Merge pull request #7452 from jwhonce/issues/7136
Refactor API build endpoint to be more compliant
2020-09-15 12:17:12 +02:00
Paul Holzinger 685ef847dd podman wait accept args > 1
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-09-15 00:02:45 +02:00
Ed Santiago 2583948f72 Usability: prevent "-l" with arguments
Add new system check confirming that "podman foo -l arg"
throws an error; and fix lots of instances where code
was not doing this check.

I'll probably need to add something similar for --all but
that can wait.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-14 15:49:28 -06:00
Jhon Honce 146c68f3ac Refactor API build endpoint to be more compliant
* Refactor/Rename channel.WriteCloser() to encapsulate the channel
* Refactor build endpoint to "live" stream buildah output channels
  over API rather then buffering output
* Refactor bindings/tunnel build because endpoint changes
  * building tar file now in bindings rather then depending on
    caller
* Cleanup initiating extra image engine
* Remove setting fields to zero values (less noise in code)
* Update tests to support remote builds

Fixes #7136
Fixes #7137

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-14 13:46:59 -07:00
OpenShift Merge Robot d7db1da789
Merge pull request #7600 from rhatdan/codespell
Fix up errors found by codespell
2020-09-11 11:30:05 -04:00
OpenShift Merge Robot 881f2dfe92
Merge pull request #7403 from QiWang19/runtime-flag
Add global options --runtime-flags
2020-09-11 11:00:11 -04:00
Daniel J Walsh 526f01cdf5
Fix up errors found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-11 06:14:25 -04:00
OpenShift Merge Robot d1798d0383
Merge pull request #7591 from haircommander/play-kube-process-namespace
play/generate: support shareProcessNamespace
2020-09-11 05:56:35 -04:00
OpenShift Merge Robot e59c3ce1c5
Merge pull request #7593 from edsantiago/network_test_cleanup
run_networking e2e test: add cleanup to some tests
2020-09-11 05:53:19 -04:00
OpenShift Merge Robot 26fb8d2cde
Merge pull request #7586 from ashley-cui/rokube
Add read-only volume mount to play kube
2020-09-11 05:32:42 -04:00
OpenShift Merge Robot 10ba232b34
Merge pull request #7590 from edsantiago/bats
system tests: cleanup
2020-09-10 18:58:42 -04:00
Ed Santiago 6874038e6a run_networking e2e test: add cleanup to some tests
Problem: if either of the two "podman network create" tests
fail, all subsequent retries will also fail because the
created network has not been cleaned up (so "network create"
will fail with EEXIST).

Solution: run "podman network rm" as deferred cleanup instead
of in each test.

This is NOT a fix for #7583 - it is just a way to allow
ginkgo to retry a failing test.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-10 15:27:50 -06:00
Peter Hunt b80b95eea0 play/generate: support shareProcessNamespace
this is an option that allows a user to specify whether to share PID namespace in the pod
for play kube and generate kube

associated test added

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2020-09-10 17:22:55 -04:00
OpenShift Merge Robot 861451a462
Merge pull request #7541 from mheon/modify_group
Make an entry in /etc/group when we modify /etc/passwd
2020-09-10 17:05:02 -04:00
Ed Santiago 1cb7bdc8a0 system tests: cleanup
- run tests: better "skip" message for docker-archive test;
  remove FIXME, document that podman-remote doesn't support it

- run tests: instrument the --conmon-pidfile test in hopes
  of tracking down flake #7580: cross-check pidfile against
  output of 'podman inspect', and add some debug messages
  that will only be seen on test failure.

- load tests: the pipe test: save and load a temporary tag,
  not $IMAGE. Primary reason is because of #7371, in which
  'podman load' assigns a new image ID (instead of preserving
  the saved one). This messes with our image management, and
  it turns out to be nonfixable.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-10 14:29:08 -06:00
OpenShift Merge Robot 96bc5eb4b7
Merge pull request #7577 from rhatdan/runlabel1
podman container runlabel should pull the image if it does not exist
2020-09-10 15:50:10 -04:00
OpenShift Merge Robot 41bd5e298a
Merge pull request #7578 from giuseppe/join-userns-reuse-mappings
libpod: read mappings when joining a container userns
2020-09-10 15:16:51 -04:00
Ashley Cui 20f73b857f Add read-only mount to play kube
add support for read-only volume mounts in podman play kube

Signed-off-by: Ashley Cui <acui@redhat.com>
2020-09-10 15:13:22 -04:00
OpenShift Merge Robot 2f0e803e76
Merge pull request #7460 from AkihiroSuda/allow-rootless-cni
rootless: support `podman network create` (CNI-in-slirp4netns)
2020-09-10 14:00:49 -04:00
Giuseppe Scrivano 686f6eccee
libpod: read mappings when joining a container userns
when joining an existing container user namespace, read the existing
mappings so the storage can be created with the correct ownership.

Closes: https://github.com/containers/podman/issues/7547

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2020-09-10 19:17:01 +02:00
OpenShift Merge Robot 8d78605929
Merge pull request #7574 from vrothberg/fix-7117
remote run: consult events for exit code
2020-09-10 13:10:48 -04:00
Matthew Heon f57c39fc7c Make an entry in /etc/group when we modify /etc/passwd
To ensure that the user running in the container ahs a valid
entry in /etc/passwd so lookup functions for the current user
will not error, Podman previously began adding entries to the
passwd file. We did not, however, add entries to the group file,
and this created problems - our passwd entries included the group
the user is in, but said group might not exist. The solution is
to mirror our logic for /etc/passwd modifications to also edit
/etc/group in the container.

Unfortunately, this is not a catch-all solution. Our logic here
is only advanced enough to *add* to the group file - so if the
group already exists but we add a user not a part of it, we will
not modify that existing entry, and things remain inconsistent.
We can look into adding this later if we absolutely need to, but
it would involve adding significant complexity to this already
massively complicated function.

While we're here, address an edge case where Podman could add a
user or group whose UID overlapped with an existing user or
group.

Also, let's make users able to log into users we added. Instead
of generating user entries with an 'x' in the password field,
indicating they have an entry in /etc/shadow, generate a '*'
indicating the user has no password but can be logged into by
other means e.g. ssh key, su.

Fixes #7503
Fixes #7389
Fixes #7499

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-09-10 13:02:31 -04:00
OpenShift Merge Robot 3d33923374
Merge pull request #7536 from Luap99/api-network-filter
APIv2 Add network list filtering
2020-09-10 10:15:01 -04:00
Daniel J Walsh dfd10d2bcd
podman container runlabel should pull the image if it does not exist
Since --pull is deprecated, remove it from help and hide if from --help
Also set it to true by default.

Share image pull code betweern podman image pull and podman container runlabel.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1877181

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-10 10:03:06 -04:00
Valentin Rothberg 5c44ebf96e remote run: consult events for exit code
After attaching to a container, we wait for the container to finish and
return its exit code.  Waiting for the container may not always succeed,
for instance, when the container has been force removed by another
process.  In such case, we have to look at the *last* container-exit
event.

Also refactor the `ContainerRun` method a bit to return early on errors
and de-spaghetti the code.

Enable the remote-disabled system test.

Fixes: #7117
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-10 10:06:48 +02:00
OpenShift Merge Robot 08b602043e
Merge pull request #7575 from rhatdan/runlabel
Fix podman container runlabel --display
2020-09-09 14:12:00 -04:00
OpenShift Merge Robot 68dace0619
Merge pull request #7573 from rhatdan/oom
Make oom-score-adj actually work
2020-09-09 14:08:48 -04:00
OpenShift Merge Robot 9c4c883d79
Merge pull request #7572 from vrothberg/fix-7135
remote kill: don't wait for the container to stop
2020-09-09 12:22:08 -04:00
Daniel J Walsh 1d7d218191
Fix podman container runlabel --display
Current podman container runlabel --display is being ignored.

This is just supposed to display the command that would be run, and
then exit, but instead is actually running the command.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1877186

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-09 10:45:24 -04:00
OpenShift Merge Robot 5a09fd8f2b
Merge pull request #7570 from rhatdan/logfile
Fix podman build --logfile
2020-09-09 10:21:50 -04:00
Daniel J Walsh 7b69b99db7
Make oom-score-adj actually work
During the redesign of podman 2.0, we dropped the support for --oom-score-adj.
Test for this flag was bogus and thus passing when it was broken.

Basically just need to set the value in the spec.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1877187

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-09 10:19:25 -04:00
OpenShift Merge Robot 81bc0395ad
Merge pull request #7571 from vrothberg/fix-7157
generate systemd: catch `--name=foo`
2020-09-09 10:18:28 -04:00
OpenShift Merge Robot 21cfcc4b3b
Merge pull request #7568 from rhatdan/latest
Fix podman ps -l
2020-09-09 10:15:22 -04:00
OpenShift Merge Robot 1b2b068ce8
Merge pull request #7569 from zhangguanzhang/fix-apiv2-top-response-two-value
fix APIv2 pods top of non-exist pod gets two response value
2020-09-09 09:12:40 -04:00
Valentin Rothberg fce2eaa6ca remote kill: don't wait for the container to stop
Invert the branch logic to match the comment.  Docker seems to wait for
the container while Podman does not.

Enable the remote-disabled system test as well.

Fixes: #7135
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-09 14:38:28 +02:00
Daniel J Walsh 3a7faf7cf8
Fix podman ps -l
Currently the --latest flag is ignored by podman ps command.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1877182

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-09 08:07:40 -04:00
Valentin Rothberg 9b8aaf88e7 generate systemd: catch --name=foo
The systemd generator looks for certain flags in the containers' create
commands to determine which flags need to be added.  In case of named
containers, the generator adds the `--replace` flag to prevent name
conflicts at container creation.  Fix the generator to not only cover
the `--name foo` syntax but also the `--name=foo` one.

Fixes: #7157
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-09 14:04:50 +02:00
Daniel J Walsh 28e685f26e
Fix podman build --logfile
Currently this command blows up because it closes the file descriptor before
doing the build.

Add tests to make sure we don't regress.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1877188

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-09 08:01:23 -04:00
zhangguanzhang a4ffed91da fix APIv2 pods top of non-exist pod gets two response value
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-09-09 18:50:17 +08:00
OpenShift Merge Robot 6b1a1fcc5c
Merge pull request #6811 from vrothberg/multi-image-archives
podman load/save: support multi-image docker archive
2020-09-09 06:35:56 -04:00
Akihiro Suda f82abc774a
rootless: support podman network create (CNI-in-slirp4netns)
Usage:
```
$ podman network create foo
$ podman run -d --name web --hostname web --network foo nginx:alpine
$ podman run --rm --network foo alpine wget -O - http://web.dns.podman
Connecting to web.dns.podman (10.88.4.6:80)
...
<h1>Welcome to nginx!</h1>
...
```

See contrib/rootless-cni-infra for the design.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-09-09 15:47:38 +09:00
OpenShift Merge Robot 814784c5e6
Merge pull request #7564 from Luap99/remote-subcmds-usage
Don't setup the Image/ContainerEngine when calling a cmd with subcmds
2020-09-08 17:21:55 -04:00
Paul Holzinger ea71f613e6 Don't setup the Image/ContainerEngine when calling a cmd with subcmds
There is no need to setup the image and container engine when calling
a command with subcommands since we only print a usage message.
e.g `podman`,`podman container`

This also allows the remote client to show the usage message on
these commands without a running endpoint. I added a test for this.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-09-08 21:05:11 +02:00
OpenShift Merge Robot 54a61e36a4
Merge pull request #7534 from edsantiago/bats
Migrate away from docker.io
2020-09-08 13:21:36 -04:00
OpenShift Merge Robot 11679c27a7
Merge pull request #7538 from edsantiago/cap_test_robust
Update VM images for new crun; adapt Cap tests to work with new kernel
2020-09-08 10:40:39 -04:00
Ed Santiago a9dbd2b3de Migrate away from docker.io
CI and system tests currently pull some images from docker.io.
Eliminate that, by:

  - building a custom image containing much of what we need
    for testing; and
  - copying other needed images to quay.io

(Reason: effective 2020-11-01 docker.io will limit the
number of image pulls).

The principal change is to create a new quay.io/libpod/testimage,
using the new test/system/build-testimage script, instead of
relying on quay.io/libpod/alpine_labels. We also switch to
using a hardcoded :YYYYMMDD tag, instead of :latest, in an
attempt to futureproof our CI. This image includes 'httpd'
from busybox-extras, which we use in our networking test
(previously we had to pull and run busybox from docker.io).

The testimage can and should be extended as needed for future
tests, e.g. adding test file content or other useful tools.

For the '--pull' tests which require actually pulling from
the registry, I've created an image with the same name but
tagged :00000000 so it will never be pulled by default.
Since this image is only used minimally, it's just busybox.

Unfortunately there remain two cases we cannot solve in
this tiny alpine-based image:

  1) docker registry
  2) systemd

For those, I've (manually) run:

    podman pull [ docker.io/library/registry:2.7 | registry.fedoraproject.org/fedora:31 ]
    podman tag !$ quay.io/...
    podman push !$

...and amended the calling tests accordingly.

I've tried to make the the smallest reasonable diff, not the
smallest possible one. I hope it's a reasonable tradeoff.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-08 06:06:06 -06:00
Valentin Rothberg 7fea46752c support multi-image (docker) archives
Support loading and saving tarballs with more than one image.
Add a new `/libpod/images/export` endpoint to the rest API to
allow for exporting/saving multiple images into an archive.

Note that a non-release version of containers/image is vendored.
A release version must be vendored before cutting a new Podman
release.  We force the containers/image version via a replace in
the go.mod file; this way go won't try to match the versions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-08 08:47:19 +02:00