8269 Commits

Author SHA1 Message Date
05713fbbf3 generate systemd: wrap pod/ctr lookup errors
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
139f82933d docs: create/run fix --pod-id-file description
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
8d8746adee generate systemd: create pod template
Create a new template for generating a pod unit file. Eventually, this
allows for treating and extending pod and container generation
seprately.

The `--new` flag now also works on pods.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
35ae53067f generate systemd: refactor
Refactor the systemd-unit generation code and move all the logic into
`pkg/systemd/generate`.  The code was already hard to maintain but I
found it impossible to wire the `--new` logic for pods in all the chaos.

The code refactoring in this commit will make maintaining the code
easier and should make it easier to extend as well.  Further changes and
refactorings may still be needed but they will easier.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
b4a410215e add (*Pod).CreateCommand()
Add a method to Pod to easily access its .config.CreateCommand.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
557a9c1211 generate systemd: rename source files
Rename to `containers{_test}.go` to make some place for the upcoming pod
changes.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
9232d4e443 generate systemd: rephrase lookup error
Rephrase the lookup error when the specified name or ID does not refer
to a container or pod.  Until, only the pod-lookup error has been
returned which can be confusing when actually looking for a container;
a user might have just mistyped the ID or name.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
402c68b41d pod create: add --infra-conmon-pidfile
Add an `--infra-conmon-pidfile` flag to `podman-pod-create` to write the
infra container's conmon process ID to a specified path.  Several
container sub-commands already support `--conmon-pidfile` which is
especially helpful to allow for systemd to access and track the conmon
processes.  This allows for easily tracking the conmon process of a
pod's infra container.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
144c6bb76d generate systemd: rename "cid" to "ctr-id"
Rename the container ID file from "cid" to "ctr-id" to make the
generated unit files a) easier to read and to b) pro-actively
avoid any confusion when pod ID files are being added in the
future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
cf89bb6711 container-{create,run}: add --pod-id-file
Allow containers to join an existing pod via the `--pod-id-file` which
is already supported by a number of `podman-pod` subcommands.  Also add
tests to make sure it's working and to prevent future regressions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
7d71d24440 podman-pod{rm,start,stop}: support --pod-id-file
Support the `--pod-id-file` flag in the rm, start and stop pod commands.
This completes the already support flag in pod-create and is another
prerequisite for generating generic systemd unit files for pods.

Also add completions, docs and tests.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
7f5aabb083 systemd/generate: remove unused infra container field
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
636881ece5 pod config: add a CreateCommand field
Add a `CreateCommand` field to the pod config which includes the entire
`os.Args` at pod-creation.  Similar to the already existing field in a
container config, we need this information to properly generate generic
systemd unit files for pods.  It's a prerequisite to support the `--new`
flag for pods.

Also add the `CreateCommand` to the pod-inspect data, which can come in
handy for debugging, general inspection and certainly for the tests that
are added along with the other changes.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
7b85d5c6d2 Merge pull request #6561 from CUB-OIT-PE/fix-truncated-logs
Fixed bug where 'podman log <container>' would truncate some lines.
2020-06-11 04:45:52 -04:00
86ffa552d2 Fixed bug where 'podman log <container>' would truncate some lines.
Signed-off-by: Will Haines <william.haines@colorado.edu>
2020-06-10 15:08:48 -06:00
4e2a0b5b9c Enable IPv6 port binding
Two areas needed tweaking to accomplish this: port parsing and
binding ports on the host.

Parsing is an obvious problem - we have to accomodate an IPv6
address enclosed by [] as well as a normal IPv4 address. It was
slightly complicated by the fact that we previously just counted
the number of colons in the whole port definition (a thousand
curses on whoever in the IPv6 standard body decided to reuse
colons for address separators), but did not end up being that
bad.

Libpod also (optionally) binds ports on the host to prevent their
reuse by host processes. This code was IPv4 only for TCP, and
bound to both for UDP (which I'm fairly certain is not correct,
and has been adjusted). This just needed protocols adjusted to
read "tcp4"/"tcp6" and "udp4"/"udp6" based on what we wanted to
bind to.

Fixes #5715

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-10 13:28:09 -04:00
b2200dbe05 Merge pull request #6550 from giuseppe/fix-userns-in-pod
container: fix creating a userns inside of a pod
2020-06-10 13:22:33 -04:00
c44992827d Merge pull request #6530 from edsantiago/test_podman_remote
Enable, then partially disable, podman-remote testing
2020-06-10 13:19:44 -04:00
6c5bd15264 Merge pull request #6552 from mheon/bump-2.0.0-rc5
Bump to v2.0.0-RC5
2020-06-10 11:20:24 -04:00
cf39c18bed Bump to v2.0.0-dev
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-06-10 09:43:18 -04:00
4c729407e9 Bump to v2.0.0-rc5
Signed-off-by: Matthew Heon <mheon@redhat.com>
v2.0.0-rc5
2020-06-10 09:43:15 -04:00
37c907868d Merge pull request #6537 from vrothberg/events-docs
podman-events: clarify streaming behaviour
2020-06-10 09:32:56 -04:00
6c27e27b8c container: do not set hostname when joining uts
do not set the hostname when joining an UTS namespace, as it could be
owned by a different userns.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-10 14:52:10 +02:00
a389eab8d1 container: make resolv.conf and hosts accessible in userns
when running in a new userns, make sure the resolv.conf and hosts
files bind mounted from another container are accessible to root in
the userns.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-10 14:46:48 +02:00
63468464e8 Merge pull request #6546 from rhatdan/lint
Turn on golint
2020-06-10 08:42:16 -04:00
87718c4e67 Fix Id->ID where possible for lint
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-10 05:49:41 -04:00
4bb43b898d Fixup issues found by golint
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-10 05:49:41 -04:00
99cbe59917 podman-events: clarify streaming behaviour
Unless `--since` or `--until` is specified, `podman events` will stream
new events.  Clarify this behavior in the `--help` message and man page
to avoid confusion.

Fixes: #6536
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-10 11:09:12 +02:00
9967f28339 Merge pull request #6193 from cevich/conmon_ci_packages
Cirrus: Include packages for containers/conmon CI
2020-06-09 21:22:17 -04:00
2fa7f03a35 Merge pull request #6542 from mheon/fix_pod_kill_signalerr
Ensure signal validation happens first in pod kill
2020-06-09 21:16:12 -04:00
455a94d1f9 Cirrus: Include packages for containers/conmon CI
This allows the containers/conmon repository to share the same VM
images produced by containers/libpod.  Included are several packages
which are downloaded only since they might otherwise interfere with
testing for some repos.  This allows stable versions to be at the ready
at testing runtime, avoiding any version updates surprising developers.

Also, re-enable running the VM-image check test which was not working
due to a logic problem in Cirrus-CI configuration.  Update the neglected
tests so that they pass on all distros.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-06-09 14:47:23 -04:00
15f273b931 WIP: Enable (and disable) remote testing
podman-remote has not been tested. A principal part of the
problem was #5387 - the YAML I wrote did not have the
intended effect, it did not set TEST_REMOTE_CLIENT=true
and because of my multiple iterations I did not catch this
during testing.

Part 1 of this PR is to fix .cirrus.yml to enable remote tests.

Part 2 -- what I had first noticed and tried to fix -- is that
rootless_test.sh was never running remote because, of course,
envariables are not sent via ssh. I reworked integration_test.sh
and rootless_test.sh to use a command-line decision instead.

Part 3, sigh, is to disable one failing integration test
and *all* system tests, because so many of the latter are
failing. Addressing those failures needs to be done in
subsequent PRs. Issues #6538, #6539, #6540 are filed for
some of the problems I isolated. There will be more.

Also, minor, fixed some stale references to varlink.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-09 12:43:58 -06:00
817dbdfdf8 Ensure signal validation happens first in pod kill
This fixes an error in the system tests, which expect that when
you try and kill a nonexistent pod with an incorrect signal, you
receive an error about the signal, not the pod.

At the same time, fix a missing return statement in the bindings,
which could also have caused us grief.

Fixes #6540

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-09 14:10:10 -04:00
3218736cff fix api fails with 'strconv.ParseUint: parsing "tcp": invalid syntax'
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-06-10 00:03:04 +08:00
fbe09d78e9 Merge pull request #6533 from containers/dependabot/go_modules/github.com/json-iterator/go-1.1.10
Bump github.com/json-iterator/go from 1.1.9 to 1.1.10
2020-06-09 17:47:47 +02:00
607cfa3ffb Merge pull request #6534 from containers/dependabot/go_modules/github.com/containers/common-0.13.0
Bump github.com/containers/common from 0.12.0 to 0.13.0
2020-06-09 17:44:52 +02:00
c831ae110e Merge pull request #6521 from cevich/update_cors_docs
[CI:DOCS] Improve swagger+CORS metadata docs
2020-06-09 16:43:32 +02:00
a2e0e170f9 Merge pull request #6532 from sujil02/python-test
Modify py test to start stop system service for each test
2020-06-09 16:27:24 +02:00
2df9edbd4f Bump github.com/json-iterator/go from 1.1.9 to 1.1.10
Bumps [github.com/json-iterator/go](https://github.com/json-iterator/go) from 1.1.9 to 1.1.10.
- [Release notes](https://github.com/json-iterator/go/releases)
- [Commits](https://github.com/json-iterator/go/compare/v1.1.9...v1.1.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-09 10:24:03 -04:00
01c45698ca Bump github.com/containers/common from 0.12.0 to 0.13.0
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/containers/common/releases)
- [Commits](https://github.com/containers/common/compare/v0.12.0...v0.13.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-09 10:23:06 -04:00
4314336ce3 Improve swagger+CORS metadata docs
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-06-09 09:53:19 -04:00
79f30af384 Merge pull request #6520 from mheon/no_conmon_no_error
Ensure Conmon is alive before waiting for exit file
2020-06-09 10:09:14 +02:00
a85e979529 Merge pull request #6513 from containers/dependabot/go_modules/github.com/stretchr/testify-1.6.1
Bump github.com/stretchr/testify from 1.6.0 to 1.6.1
2020-06-08 23:27:47 +02:00
9d964ffb9f Ensure Conmon is alive before waiting for exit file
This came out of a conversation with Valentin about
systemd-managed Podman. He discovered that unit files did not
properly handle cases where Conmon was dead - the ExecStopPost
`podman rm --force` line was not actually removing the container,
but interestingly, adding a `podman cleanup --rm` line would
remove it. Both of these commands do the same thing (minus the
`podman cleanup --rm` command not force-removing running
containers).

Without a running Conmon instance, the container process is still
running (assuming you killed Conmon with SIGKILL and it had no
chance to kill the container it managed), but you can still kill
the container itself with `podman stop` - Conmon is not involved,
only the OCI Runtime. (`podman rm --force` and `podman stop` use
the same code to kill the container). The problem comes when we
want to get the container's exit code - we expect Conmon to make
us an exit file, which it's obviously not going to do, being
dead. The first `podman rm` would fail because of this, but
importantly, it would (after failing to retrieve the exit code
correctly) set container status to Exited, so that the second
`podman cleanup` process would succeed.

To make sure the first `podman rm --force` succeeds, we need to
catch the case where Conmon is already dead, and instead of
waiting for an exit file that will never come, immediately set
the Stopped state and remove an error that can be caught and
handled.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-06-08 13:48:29 -04:00
edf733c3b6 Bump github.com/stretchr/testify from 1.6.0 to 1.6.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.0...v1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-08 13:17:19 -04:00
b8acc851bb Merge pull request #6515 from vrothberg/v2-enable-ubuntu
V2 enable ubuntu
2020-06-08 12:36:06 -04:00
a5facca78f e2e: disable checkpoint test on Ubuntu
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-08 16:51:32 +02:00
b6148b6576 force bats version to v1.1.0
We experienced regression when using the latest `v1.2.0-dev` bats in
Ubuntu 20.04 (see github.com/containers/libpod/pull/6418).  Using
bats v1.1.0 worked in the Ubuntu test VM.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-08 15:21:34 +02:00
efd1422143 Enable Ubuntu tests in CI
Add updates required for ubuntu and run integration tests

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-06-08 12:21:16 +02:00
2869cce1d5 Merge pull request #6505 from mheon/parallel_stop
Add parallel operation to `podman stop`
2020-06-08 03:56:11 -04:00