Commit graph

422 commits

Author SHA1 Message Date
OpenShift Merge Robot a65788c876
Merge pull request #2622 from baude/protectdarwin
Add gating tasks
2019-03-13 11:06:43 -07:00
baude c8ca027938 Add gating tasks
to protect against regressions, we need to add a few gating tasks:
 * build with varlink
 * build podman-remote
 * build podman-remote-darwin

we already have a gating task for building without varlink

Signed-off-by: baude <bbaude@redhat.com>
2019-03-13 12:10:35 -05:00
TomSweeneyRedHat 8f418f1568 Vendor docker/docker, fsouza and more #2
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Vendors in fsouza/docker-client, docker/docker and
a few more related. Of particular note, changes to the TweakCapabilities()
function from docker/docker along with the parse.IDMappingOptions() function
from Buildah. Please pay particular attention to the related changes in
the call from libpod to those functions during the review.

Passes baseline tests.
2019-03-13 11:40:39 -04:00
Daniel J Walsh adad93342c
Update vendor of Buildah and imagebuilder
Fixes the testing issues we are hitting.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-03-13 08:21:11 -04:00
OpenShift Merge Robot 883566fbc0
Merge pull request #2562 from baude/healtcheckphase2
healthcheck phase 2
2019-03-12 13:09:13 -07:00
baude 03716cf7f3 healtcheck phase 2
integration of healthcheck into create and run as well as inspect.
healthcheck enhancements are as follows:

* add the following options to create|run so that non-docker images can
define healthchecks at the container level.
  * --healthcheck-command
  * --healthcheck-retries
  * --healthcheck-interval
  * --healthcheck-start-period

* podman create|run --healthcheck-command=none disables healthcheck as
described by an image.
* the healthcheck itself and the healthcheck "history" can now be
observed in podman inspect
* added the wiring for healthcheck history which logs the health history
of the container, the current failed streak attempts, and log entries
for the last five attempts which themselves have start and stop times,
result, and a 500 character truncated (if needed) log of stderr/stdout.

The timings themselves are not implemented in this PR but will be in
future enablement (i.e. next).

Signed-off-by: baude <bbaude@redhat.com>
2019-03-12 14:29:18 -05:00
OpenShift Merge Robot 300b53cffe
Merge pull request #2527 from baude/events
Add event logging to libpod, even display to podman
2019-03-11 18:04:51 -07:00
baude ca1e76ff63 Add event logging to libpod, even display to podman
In lipod, we now log major events that occurr.  These events
can be displayed using the `podman events` command. Each
event contains:

* Type (container, image, volume, pod...)
* Status (create, rm, stop, kill, ....)
* Timestamp in RFC3339Nano format
* Name (if applicable)
* Image (if applicable)

The format of the event and the varlink endpoint are to not
be considered stable until cockpit has done its enablement.

Signed-off-by: baude <bbaude@redhat.com>
2019-03-11 15:08:59 -05:00
Daniel J Walsh de12f45688
Fix SELinux on host shared systems in userns
Currently if you turn on --net=host on a rootless container
and have selinux-policy installed in the image, tools running with
SELinux will see that the system is SELinux enabled in rootless mode.

This patch mounts a tmpfs over /sys/fs/selinux blocking this behaviour.

This patch also fixes the fact that if you shared --pid=host we were not
masking over certin /proc paths.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-03-11 15:17:22 -04:00
OpenShift Merge Robot 6421208e0f
Merge pull request #2583 from giuseppe/rootless-fix-pod-rm
rootless: fix stop and rm when the container is running with uid != 0
2019-03-11 10:01:25 -07:00
OpenShift Merge Robot f5afe88098
Merge pull request #2597 from jwhonce/issue/2016
Initialize field in InfoHost struct
2019-03-11 09:29:19 -07:00
Jhon Honce 55e24c65ce Initialize field in InfoHost struct
Fixes #2016

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-03-11 07:30:32 -07:00
Giuseppe Scrivano af3e73426a
rootless: allow single mappings
we were playing safe and not allowed any container to have less than
65536 mappings.  There are a couple of reasons to change it:

- it blocked libpod to work in an environment where
  newuidmap/newgidmap are not available, or not configured.

- not allowed to use different partitions of subuids, where each user
  has less than 65536 ids available.

Hopefully this change in containers/storage:

https://github.com/containers/storage/pull/303

will make error clearers if there are not enough IDs for the image
that is being used.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-11 14:38:42 +01:00
Giuseppe Scrivano 231129e4dc
rootless: fix pod stop|rm if uid in the container != 0
join the user namespace where the pod is running, so that we can both
manage the storage and correctly send the kill signal to a process
which is not running as root in the namespace.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-11 11:48:28 +01:00
Giuseppe Scrivano f31ba2929b
rootless: support a custom arg to the new process
let the process running as euid != 0 pass down an argument to the
process running in the user namespace.  This will be useful for
commands like rm -a that needs to join different namespaces, so that
we can re-exec separately for each of them.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-11 11:48:25 +01:00
Daniel J Walsh 2f3875d009
Move secrets package to buildah
Trying to remove circular dependencies between libpod and buildah.

First step to move pkg content from libpod to buildah.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-03-08 16:08:44 -05:00
Giuseppe Scrivano cc411dd98f
rootless: propagate errors from info
we use "podman info" to reconfigure the runtime after a reboot, but we
don't propagate the error message back if something goes wrong.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-08 19:42:20 +01:00
OpenShift Merge Robot 614409f644
Merge pull request #2534 from jwhonce/wip/remote_wait
Implement podman-remote wait command and container subcommand
2019-03-06 13:07:52 -08:00
OpenShift Merge Robot 02e2342d20
Merge pull request #2442 from baude/remotepodtop
podman-remote pod top|stats
2019-03-06 12:24:13 -08:00
OpenShift Merge Robot f50715ed25
Merge pull request #2412 from QiWang19/iss2380
Enable specifying directory as device on container with --device
2019-03-06 10:59:56 -08:00
Jhon Honce 8a6758d5fd Implement podman-remote wait command and container subcommand
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-03-06 10:32:01 -07:00
OpenShift Merge Robot c6c0b54c36
Merge pull request #2491 from baude/healtcheckphase1
podman healthcheck run (phase 1)
2019-03-06 09:24:22 -08:00
baude 788f818cc5 podman-remote pod top|stats
this is the final enablement for the pod subcommand.  it includes the
ability to run podman-remote pod top and stats.

Signed-off-by: baude <bbaude@redhat.com>
2019-03-06 11:01:25 -06:00
Qi Wang c90e0ea346 fix bug --device enable specifying directory as device
Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-03-06 10:14:52 -05:00
OpenShift Merge Robot 7418ff988b
Merge pull request #2543 from giuseppe/fix-rootless-s390x-cris
rootless: fix clone syscall on s390 and cris archs
2019-03-06 05:48:27 -08:00
baude 598bde52d0 podman healthcheck run (phase 1)
Add the ability to manually run a container's healthcheck command.
This is only the first phase of implementing the healthcheck.
Subsequent pull requests will deal with the exposing the results and
history of healthchecks as well as the scheduling.

Signed-off-by: baude <bbaude@redhat.com>
2019-03-05 14:03:55 -06:00
OpenShift Merge Robot 3d441b5d96
Merge pull request #2519 from jwhonce/wip/remote_kill
Support podman-remote kill container(s)
2019-03-05 08:52:09 -08:00
Giuseppe Scrivano ca5114faf9
rootless: fix clone syscall on s390 and cris archs
from the clone man page:

  On the cris and s390 architectures, the order of the first two
  arguments is reversed:

           long clone(void *child_stack, unsigned long flags,
                      int *ptid, int *ctid,
                      unsigned long newtls);

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1672714

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-05 17:27:43 +01:00
OpenShift Merge Robot 85b116707b
Merge pull request #2426 from giuseppe/exec-preserve-fds
exec: support --preserve-fds
2019-03-05 05:56:46 -08:00
Jhon Honce 8eb4940081 Support podman-remote kill container(s)
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-03-04 16:37:22 -07:00
OpenShift Merge Robot 4b80517b6a
Merge pull request #2522 from mheon/fix_timestamp_format_logs
Change timestamp format for podman logs
2019-03-04 13:52:21 -08:00
OpenShift Merge Robot 33be9e6845
Merge pull request #2523 from jwhonce/bug/2521
Fix #2521
2019-03-04 12:24:26 -08:00
Jhon Honce ae47a7c47e Fix #2521
* Bad merge against podman stop, restored overwritten code

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-03-04 12:20:37 -07:00
Matthew Heon 29ade7f6af Change timestamp format for podman logs
The Golang standard library implementation of RFC3339Nano will
trim trailing 0s from the nanoseconds portion of timestamps. This
is undesirable for lining everything up nicely during terminal
output. As the Golang developers have not seen fit to give us a
better way, use the one that was proposed on the issue tracker
but rejected.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-03-04 13:43:04 -05:00
OpenShift Merge Robot 34bf58c5db
Merge pull request #2513 from mheon/log_timestamps_newline
Ensure that each log line is newline-terminated
2019-03-04 08:38:18 -08:00
Matthew Heon ff609a5ade Add additional defense against 0-length log segfaults
Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-03 23:30:45 -05:00
Matthew Heon 429f2e63a0 When logging with timestamps, append only until newline
When we log time timestamps, don't print a new timestamp for each
input - instead, print one at the start of every line, and then
wait until we hit a newline to print a new timestamp.

This still doesn't exactly mirror the Docker behavior (they don't
print until they receive an entire line, while we print any time
the logs file is appended to - so you can see partial lines being
typed in our system). Also, timestamps are recorded as the start
of a line being typed, as opposed to when the enter key is
pressed (on Docker).

(Worth noting that, while characters are printed as they are
typed, logs does respect the backspace key - so you'll also see
them disappear as the person typing realizes they've made a
mistake and retypes their command).

This is the closest we can get to Docker without major surgery on
the Kubernetes log-printing library, so I'm content to call this
an adequate solution.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-03 23:06:32 -05:00
Matthew Heon e372837eb0 Ensure that each log line is newline-terminated
When writing logs with timestamps to the terminal, ensure that
each line is newline-terminated, so we don't end up with an
unreadable mess with timestamps interspersed with the actual
content being displayed.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-03 21:13:49 -05:00
Jhon Honce 4d13a80fa4 Support podman-remote stop container(s)
* Clean up adapter code
* Add GetContainersByContext to Varlink API
* Add missing comments
* Restore save command
* Restore error type mapping when using varlink

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-03-02 08:57:20 -07:00
Giuseppe Scrivano 0b34327ad4
exec: support --preserve-fds
Allow to pass additional FDs to the process being executed.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-02 11:45:42 +01:00
Giuseppe Scrivano 23615099e9
rootless, new[ug]idmap: on failure add output
if any of the mapping tools for setting up the user namespace fail,
then include their output in the error message.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-28 16:16:48 +01:00
Giuseppe Scrivano 80bad464f9
secrets: fix fips-mode with user namespaces
When using a user namespace, we create the mount point under
`mountPrefix` so that the uid != 0 can access that directory.

Change the addFIPSModeSecret code to honor that, and also ensure we
are creating the directories with the right ownership.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-27 22:40:38 +01:00
Matthew Heon ffefbda694 Fix build for non-Varlink-tagged Podman
Fixes #2459

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-27 10:27:08 -05:00
Matthew Heon f68a243f8e Centralize setting default volume path
No reason to do it in util/ anymore. It's always going to be a
subdirectory of c/storage graph root by default, so we can just
set it after the return.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 15:44:46 -05:00
Matthew Heon 5511cdc487 Ensure volume path is set appropriately by default
There are some cases where we might not be properly adjusting the
volume path after setting the storage graph root. Ensure that we
always set volume path to be a child of graph root.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 15:39:13 -05:00
Giuseppe Scrivano 21bc766ee3
volume: do not create a volume if there is a bind
if there is already a bind mount specified for the target, do not
create a new volume.

Regression introduced by 52df1fa7e0

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-26 18:42:04 +01:00
baude 0416b3afc4 podman-remote pod pause|unpause|restart
enable the ability for the remote client to pause, unpause, and
restart pods.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-25 16:14:06 -06:00
OpenShift Merge Robot cf521449e5
Merge pull request #2422 from baude/remotepodcreate
podman-remote create|ps
2019-02-25 21:57:42 +01:00
OpenShift Merge Robot e45c442080
Merge pull request #2358 from rhatdan/namespace
Fix up handling of user defined network namespaces
2019-02-25 21:31:50 +01:00
Giuseppe Scrivano 0f5ae3c5af
podman: fix ro bind mounts if no* opts are on the source
This is a workaround for the runc issue:

https://github.com/opencontainers/runc/issues/1247

If the source of a bind mount has any of nosuid, noexec or nodev, be
sure to propagate them to the bind mount so that when runc tries to
remount using MS_RDONLY, these options are also used.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-02-25 18:56:09 +01:00