Commit graph

1072 commits

Author SHA1 Message Date
Daniel J Walsh 4352d58549
Add support for containers.conf
vendor in c/common config pkg for containers.conf

Signed-off-by: Qi Wang qiwan@redhat.com
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-27 14:36:03 -04:00
OpenShift Merge Robot 4233250c43
Merge pull request #5611 from baude/v2podcreate
podmanv2 pod create using podspecgen
2020-03-27 16:25:30 +01:00
OpenShift Merge Robot 3ddb5b10d5
Merge pull request #5595 from stefano-pogliani/pod-ps-filter-label
Support label filters for podman pod ps
2020-03-27 15:18:27 +01:00
Brent Baude e56d529561 podmanv2 pod create using podspecgen
using the factory approach similar to container, we now create pods based on a pod spec generator.  wired up the podmanv2 pod create command, podcreatewithspec binding, simple binding test, and apiv2 endpoint.

also included some code refactoring as it introduced as easy circular import.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-27 09:04:10 -05:00
Valentin Rothberg 2c4ac55c81 use pause:3.2 image for infra containers
The `pause:3.1` has wrong configs for non-amd64 images as they all claim
to be for amd64.  The issue has now been fixed in the latest
`pause:3.2`.

[1] https://github.com/kubernetes/kubernetes/issues/87325

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-27 10:32:04 +01:00
Stefano Pogliani df568e4963
Support label filters for podman pod ps.
Update the podman pod ps command to support filtering by labels.
This brings the command in line with the documentation as well as
the functionality by the containers equivalent podman ps.

Signed-off-by: Stefano Pogliani <stefano@spogliani.net>
2020-03-26 23:11:07 +00:00
Brent Baude 2fa78938a9 podmanv2 container inspect
add ability to inspect a container

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-26 15:54:26 -05:00
Brent Baude c5ce210f7d podmanv2 pod subcommands
add pod kill, pause, restart, rm, start, stop, and unpause

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-26 14:14:05 -05:00
OpenShift Merge Robot 48b3143656
Merge pull request #5436 from QiWang19/rm_created_ctr
container prune remove state created, configured
2020-03-23 15:45:26 +01:00
Daniel J Walsh 31d14457a5
Merge pull request #5582 from kunalkushwaha/bugfix-5001
Improved readability in image json output
2020-03-22 17:40:20 -04:00
Kunal Kushwaha 19bf7adedb Improved readability in image json output
Changes made in json output to improve readability of
podman images output.

Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
2020-03-22 21:38:07 +09:00
Brent Baude 232b5034cf when removing networks for tests, force should be used
when removing networks in integration tests, we should should force; otherwise if the network has containers associated with it, it will fail to remove.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-20 16:19:58 -05:00
OpenShift Merge Robot ccc30c606e
Merge pull request #5539 from sujil02/issue-5461
Implemented --iidfile for podman commit
2020-03-20 11:45:32 +01:00
Sujil02 5efa6dae90 Implemented --iidfile for podman commit
Added flag to Write the image ID to the file with podman commit command.
Fix to issue #5461

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-03-19 16:32:02 -04:00
Jhon Honce 651ddd3560 Reduce CPU usage when --timeout=0
* Add second go routine for when a Timer is not needed.
* goimports updated some project files

Fixes #5531

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-03-18 10:27:25 -07:00
OpenShift Merge Robot 412a114d33
Merge pull request #5439 from ttys3/fixup-systemdgen-with-new-param
systemd generator: force run container detached if CreateCommand has no detach param
2020-03-16 14:40:02 +01:00
OpenShift Merge Robot 4e13ef58c8
Merge pull request #5476 from edsantiago/run_rmi_test_fix
run --rmi test: make it work
2020-03-16 12:51:50 +01:00
Brent Baude 9ca4b6c6f5 add os|arch attributes when building
when building images, we can now add the os and arch of the image using overrides from the commandline.  the commandline options set sane defaults so we use those as well.

Fixes: #5503

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-15 12:49:42 -05:00
荒野無燈 194723f314
force run container detached if container CreateCommand missing the detach param
the podman generated systemd service file has `Type=forking` service,
so the command after `ExecStart=` should not run in front.
if someone created a container and has the detach(`-d`) param missing
like this
```
podman create --name ngxdemo -P nginxdemos/hello
```
and generate the file with `--new` param:
```
podman generate systemd --name --new ngxdemo
```
because `podman run xxx` has no `-d` param,
so the container is not run in background and nerver exit.
and systemd will fail to start the service:
```
sudo systemctl start container-ngxdemo.service
Job for container-ngxdemo.service failed because a timeout was exceeded.
See "systemctl status container-ngxdemo.service" and "journalctl -xe" for details.
```

Signed-off-by: 荒野無燈 <ttys3@outlook.com>
2020-03-14 21:54:12 +08:00
Ed Santiago 3585780876 run --rmi test: make it work
The recently-added 'run --rmi' test was not actually doing
what it thinks it was doing: for one, 'run_podman | grep'
is never going to work; also, the test was leaving behind
stray images.

Rework to do what I believe the intention was; and, combine
into one test (down from two) for readability.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-12 07:57:11 -06:00
Qi Wang abb60fbba2 container prune remove state created, configured
podman container prune should remove containers with state Created, Configured to be compatible with docker

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-03-10 10:57:51 -04:00
OpenShift Merge Robot 3d48940927
Merge pull request #5307 from QiWang19/security-opt-genkube
fix security-opt generate kube
2020-03-09 22:22:29 +01:00
Valentin Rothberg a5c04c793e generate systemd: remove leading slashes
Remove leading slashes from the run-dir paths. It was meant to make it
explicit that we're dealing with an absolute path but user feedback has
shown that most are aware.  It also cleans up the path in the systemctl
status output.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-05 14:05:48 +01:00
OpenShift Merge Robot 90eef95cb1
Merge pull request #4772 from boaz0/closes_4628
Add the rmi flag to podman-run to delete container image
2020-03-04 10:58:10 -05:00
OpenShift Merge Robot a8bc423e29
Merge pull request #5344 from edsantiago/log_format
CI: format cirrus logs
2020-03-04 10:55:36 -05:00
OpenShift Merge Robot d5f5b2e8be
Merge pull request #5379 from edsantiago/test_apiv2
APIv2 tests: add tests for stop
2020-03-03 20:31:44 +01:00
Qi Wang 17bab33bd2 fix security-opt generate kube
fix #4950
add selinux options from --security-opt of the container to generate kube result

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-03-03 11:21:14 -05:00
OpenShift Merge Robot 3bc5f431d4
Merge pull request #5206 from rhatdan/capabilities
Allow devs to set labels in container images for default capabilities.
2020-03-03 14:48:10 +01:00
Ed Santiago 88cd648816 APIv2 tests: add tests for stop
...and allow status 'stopped' in addition to 'exited'.

Fixes: #5336

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-03 06:40:27 -07:00
Boaz Shuster 11e5c53d11 Add the rmi flag to podman-run to delete container image
The --rmi flag will delete the container image after its execution
unless that image is already been used by another container(s).

This is useful when one wants to execute a container once and remove
any resources attached to it.

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2020-03-03 14:27:11 +02:00
Ed Santiago 1814638000 CI: format cirrus logs
This introduces a new cirrus helper script, logformatter.
Usage is:

    [commands...] | logformatter TEST-NAME

It reformats its input into a readable, highlighed, linkable
form. Some features:

   - boring stuff (timestamps, standard podman options) is
     deemphasized
   - important stuff (warnings, errors) is emphasized
   - in-page links to the actual failures
   - active links to source files
   - jumps to bottom of page on load, because that's where
     the errors are. (All errors are linked)

Add it to select test commands (integration, system) and
add a new artifacts_html, run in the 'always' block, which
uploads generated *.log.html into Cirrus; from there we
generate a live URL that can be viewed in browser.

Unfortunately, due to security concerns in Cirrus, it is
not currently possible to make the link a live one.

Kludge: add a line of dashes after Restoring images; without this,
the first test ("systemd PID 1") has no dashes before it, so
logformatter doesn't see it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-02 15:55:05 -07:00
Daniel J Walsh b163640c61
Allow devs to set labels in container images for default capabilities.
This patch allows users to specify the list of capabilities required
to run their container image.

Setting a image/container label "io.containers.capabilities=setuid,setgid"
tells podman that the contained image should work fine with just these two
capabilties, instead of running with the default capabilities, podman will
launch the container with just these capabilties.

If the user or image specified capabilities that are not in the default set,
the container will print an error message and will continue to run with the
default capabilities.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-02 16:37:32 -05:00
Ed Santiago 5612089412 CI: add API v2 tests
API v2 has been quiet for a few days, and the test script is
actually passing. Let's take advantage of this opportunity
to get them running in CI.

Requires adding a check for cgroupsv2

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-02 13:19:42 -07:00
Matthew Heon b41c864d56 Ensure that exec sessions inherit supplemental groups
This corrects a regression from Podman 1.4.x where container exec
sessions inherited supplemental groups from the container, iff
the exec session did not specify a user.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-28 11:32:56 -05:00
OpenShift Merge Robot c132a4b7ff
Merge pull request #5295 from mheon/advanced_network_inspect
Add support for multiple CNI networks in podman inspect
2020-02-27 12:33:26 +01:00
Ed Santiago 40470b45d3 kill test: clean up warnings; document better
9f69c4eca (part of the f31 pr, #3091) semi-broke the kill test,
there's now an ugly warning:

    setup(): removing stray images quay.io/libpod/fedora-minimal:latest 7bb5a60e8a78

The comments also didn't actually explain the problem
being addressed, and included a misleading reference
to busybox.

Here we switch to using fedora-minimal only with podman-remote,
clean it up (rmi) when finished, and include an explanation in
the comments about why this is needed; making it clear that
this workaround can be removed once we get rid of podman-remote.
We also reformat back to 80 columns.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-26 11:01:38 -07:00
OpenShift Merge Robot 19016f3cd8
Merge pull request #5332 from giuseppe/uts-lookup-container
spec: allow container alias name in lookup
2020-02-26 16:58:27 +01:00
OpenShift Merge Robot 75d0d48d20
Merge pull request #5330 from baude/flakefixesfored
curb flakes in integration tests
2020-02-26 16:17:34 +01:00
Brent Baude 04f1306c87 curb flakes in integration tests
instead of searching the fedora registry which is error prone, we instead search a local registry for the empty set search.

when running two containers with the same IP, i suspect the first container has not fully gotten its ip information back from cni when the second container fires.  rework this test such that we use nginx to make sure the container is up and running before continues which should pace the subsequent test.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-26 08:30:28 -06:00
Giuseppe Scrivano 418dee100b
spec: allow container alias name in lookup
Previously --uts=container: expected the full container ID.

Closes: https://github.com/containers/libpod/issues/5289

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-02-26 15:04:31 +01:00
OpenShift Merge Robot 6c5591ed9d
Merge pull request #3901 from cevich/support_f31
Cirrus: Support testing with F31
2020-02-25 21:32:20 +01:00
Matthew Heon f9fc9a7b7b Add support for multiple CNI networks in podman inspect
When inspecting containers, info on CNI networks added to the
container by name (e.g. --net=name1) should be displayed
separately from the configuration of the default network, in a
separate map called Networks.

This patch adds this separation, improving our Docker
compatibility and also adding the ability to see if a container
has more than one IPv4 and IPv6 address and more than one MAC
address.

Fixes #4907

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-25 13:20:25 -05:00
Chris Evich 4511e15f8c
Fix kill test obtaining CID
It's possible/likely the container image for the test will need to be
pulled as part of the `run` command.  Due to the way BATS handles
output, messages regarding image-pull could be misinterpreted as the
container's CID.  Force the CID to be obtained by only the last line of
output.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00
Chris Evich 9f69c4ecaf
System Tests: Force default signal handlers
Recommended as part of:
https://github.com/containers/libpod/issues/5004

and

https://github.com/containers/crun/issues/230

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00
Chris Evich 9b9789c207
Fix cgroupsv2 run test, unexpected output
Sometime between 10th and 23rd of Feb. 2020, the behavior of crun
changed.  Upon consulting with Giuseppe, the podman run tests for
`device-read-*` and `device-write-*` do not depend on the container
output for success, only the exit code.  Add a comment and conditional
regarding this in case of cgroupsv2.  Also noted that these tests
will likely require future refactoring/simplification.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00
Ed Santiago f25c595cb8 apiv2 tests: add more pod tests, timing check
Looks like /libpod/pods/create has been fixed to return an
actual pod ID. Extend those tests.

Also, update timeout in the server command: it's now seconds,
not milliseconds.

Also, update FIXME comments in /pods/prune . Still doesn't
work, but clarify what we're seeing.

Also, add a new test that runs ten /info requests and
barfs if it takes more than 5 seconds.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-25 06:42:27 -07:00
OpenShift Merge Robot 18dcb84d64
Merge pull request #4889 from baude/portsearch
fix port list by container with port
2020-02-23 13:00:10 -05:00
Ed Santiago fab5b35b2a Friendly amendment: tests, and a help message
1) Help message for podman port was missing [PORT]

2) Add test for 'podman port'. And, actually, an entire
   networking test that I'd written some weeks ago but
   apparently didn't 'git add'.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-23 11:04:39 -06:00
Brent Baude 0184714a82 Add --no-healthcheck command to create/run
Now support --no-healthcheck option to disable defined healthchecks in a container image.  --health-cmd=none remains supported as well.

Fixes: #5299

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-22 12:45:15 -06:00
OpenShift Merge Robot 1c476d7696
Merge pull request #5286 from edsantiago/flake_fix_same_ip
Flake fix: race condition in same-IP test
2020-02-21 07:58:46 -05:00