282 Commits

Author SHA1 Message Date
7e3c27eb9d runtime: do not attempt to use global conf file
we had a regression where the rootless user tried to use the global
configuration file.  We should not try to use the global configuration
when running in rootless but only cherry-pick some settings from there
when creating the file for the first time.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-27 14:22:51 +02:00
bfcf0292de runtime: use GetRootlessUID() to get rootless uid
otherwise it won't work in a user namespace.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-27 13:52:36 +02:00
7705f99fe6 Merge pull request #3429 from cevich/strip_crio_conmon
Remove refs to crio/conmon
2019-06-27 03:05:33 +02:00
fc32439c29 Remove refs to crio/conmon
Conmon has moved out of cri-o and into it's own dedicated repository.
This commit updates configuration and definitions which referenced
the old cri-o based paths.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-06-26 12:44:22 -04:00
7e3f1c21b0 libpod: specify a detach keys sequence in libpod.conf
Add the ability of specifying a detach keys sequence in libpod.conf

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2019-06-26 10:12:34 +02:00
c9078936dd Merge pull request #3419 from baude/removelibpodfrommainphase1
remove libpod from main
2019-06-26 02:36:06 +02:00
dd81a44ccf remove libpod from main
the compilation demands of having libpod in main is a burden for the
remote client compilations.  to combat this, we should move the use of
libpod structs, vars, constants, and functions into the adapter code
where it will only be compiled by the local client.

this should result in cleaner code organization and smaller binaries. it
should also help if we ever need to compile the remote client on
non-Linux operating systems natively (not cross-compiled).

Signed-off-by: baude <bbaude@redhat.com>
2019-06-25 13:51:24 -05:00
21978c9908 Merge pull request #3332 from rhatdan/cgroupmanager
Correctly identify the defaults for cgroup-manager
2019-06-25 14:54:28 +02:00
e2b0587c21 runtime.go: Add /usr/local/{s,}bin
Signed-off-by: Jamie Bliss <jamie@ivyleav.es>
2019-06-21 14:38:29 -04:00
7377870641 Properly handle OCI runtime being set to a path
This is done by the --runtime flag, and as such, by all our CI.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-06-20 15:07:46 -04:00
fa0e48f21a Make a missing OCI runtime nonfatal
We may want to ship configurations including more than one
runtime configuration - for example, crun and runc and kata, all
configured. However, we don't want to make these extra runtimes
hard requirements, so let's not fatally error when we can't find
their executables.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-06-19 17:14:15 -04:00
92bae8d308 Begin adding support for multiple OCI runtimes
Allow Podman containers to request to use a specific OCI runtime
if multiple runtimes are configured. This is the first step to
properly supporting containers in a multi-runtime environment.

The biggest changes are that all OCI runtimes are now initialized
when Podman creates its runtime, and containers now use the
runtime requested in their configuration (instead of always the
default runtime).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-06-19 17:08:43 -04:00
53c3720de9 Correctly identify the defaults for cgroup-manager
Currently we report cgroupmanager default as systemd, even if the user modified
the libpod.conf.  Also cgroupmanager does not work in rootless mode.  This
PR correctly identifies the default cgroup manager or reports it is not supported.

Also add homeDir to correctly get the homedir if the $HOME is not set.  Will
attempt to get Homedir out of /etc/passwd.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-06-15 09:51:47 -04:00
7baa6b6266 Remove unnecessary var type to fix lint warning
Signed-off-by: Lawrence Chan <element103@gmail.com>
2019-06-14 17:42:05 -05:00
373048aaca Move installPrefix and etcDir into runtime.go
Signed-off-by: Lawrence Chan <element103@gmail.com>
2019-06-14 17:42:05 -05:00
6ea12e3028 Improve DESTDIR/PREFIX/ETCDIR handling
- PREFIX is now passed saved in the binary at build-time so that default
  paths match installation paths.
- ETCDIR is also overridable in a similar way.
- DESTDIR is now applied on top of PREFIX for install/uninstall steps.
  Previously, a DESTDIR=/foo PREFIX=/bar make would install into /bar,
  rather than /foo/bar.

Signed-off-by: Lawrence Chan <element103@gmail.com>
2019-06-14 17:42:05 -05:00
13e1afdb02 oci: allow to specify what runtimes support JSON
add a new configuration `runtime_supports_json` to list what OCI
runtimes support the --log-format=json option.  If the runtime is not
listed here, libpod will redirect stdout/stderr from the runtime
process.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-06-13 14:21:13 +02:00
8fe22d48fb Inherit rootless init_path from system libpod.conf
Signed-off-by: Lawrence Chan <element103@gmail.com>
2019-06-03 18:44:36 -05:00
6ddf47ca38 runtime: unlock the alive lock only once
Unlock the alive lock only once in the deferred func call.

Fixes: #3207
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-05-28 15:54:26 +02:00
791d53a214 rootless: use a pause process
use a pause process to keep the user and mount namespace alive.

The pause process is created immediately on reload, and all successive
Podman processes will refer to it for joining the user&mount
namespace.

This solves all the race conditions we had on joining the correct
namespaces using the conmon processes.

As a fallback if the join fails for any reason (e.g. the pause process
was killed), then we try to join the running containers as we were
doing before.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-17 20:48:24 +02:00
2e0fef51b3 migrate: not create a new namespace
this leaves the containers stopped but we won't risk to use the wrong
user namespace.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-17 20:47:55 +02:00
7a58c6601b set default event logger based on build tags
once the default event logger was removed from libpod.conf, we need to
set the default based on whether the systemd build tag is used or not.

Signed-off-by: baude <bbaude@redhat.com>
2019-05-14 16:17:11 -05:00
bc7b1ca03d enable integration tests for remote-client
first pass at enabling a swath of integration tests for the
remote-client.

Signed-off-by: baude <bbaude@redhat.com>
2019-05-07 14:06:02 -05:00
d1a7378aa0 change from sysregistries to sysregistriesv2
We want to start supporting the registries.conf format.
Also start showing blocked registries in podman info
Fix sorting so all registries are listed together in podman info.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-05-03 10:38:51 -04:00
416cc20c68 Small fixes for #2950
We merged #2950 with some nits still remaining, as Giuseppe was
going on PTO. This addresses those small requested changes.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-05-01 15:07:30 -04:00
f49e0c19ed runtime: pass down the context
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-26 22:23:49 +02:00
525f0b30ac system: add new subcommand "migrate"
it is useful to migrate existing containers to a new version of
podman.  Currently, it is needed to migrate rootless containers that
were created with podman <= 1.2 to a newer version which requires all
containers to be running in the same user namespace.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-26 22:23:45 +02:00
04d6ff0582 Add System event type and renumber, refresh events
Also, re-add locking to file eventer Write() to protect against
concurrent events.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-04-25 16:23:09 -04:00
a01c62fcbd Merge pull request #3013 from mheon/logging_for_refresh
Logging for refresh
2019-04-25 12:43:43 -07:00
0df9f6f9fe Add a debug message indicating that a refresh occurred
Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-04-25 11:29:16 -04:00
7bf7c177ab journald event logging
add the ability for podman to read and write events to journald instead
of just a logfile.  This can be controlled in libpod.conf with the
`events_logger` attribute of `journald` or `file`.  The default will be
set to `journald`.

Signed-off-by: baude <bbaude@redhat.com>
2019-04-24 16:00:04 -05:00
09532c8cc0 rootless: fix segfault on refresh if there are containers
create immediately a namespace if we need a refresh.  This is
necessary to access the rootless storage.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-10 23:12:37 +02:00
72382a12a7 rootless: use a single user namespace
simplify the rootless implementation to use a single user namespace
for all the running containers.

This makes the rootless implementation behave more like root Podman,
where each container is created in the host environment.

There are multiple advantages to it: 1) much simpler implementation as
there is only one namespace to join.  2) we can join namespaces owned
by different containers.  3) commands like ps won't be limited to what
container they can access as previously we either had access to the
storage from a new namespace or access to /proc when running from the
host.  4) rootless varlink works.  5) there are only two ways to enter
in a namespace, either by creating a new one if no containers are
running or joining the existing one from any container.

Containers created by older Podman versions must be restarted.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-01 15:32:58 +02:00
ed326206f2 rootless: remove SkipStorageSetup()
in the few places where we care about skipping the storage
initialization, we can simply use the process effective UID, instead
of relying on a global boolean flag.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-04-01 13:24:04 +02:00
2fa9861d78 rootless: set sticky bit on rundir
it prevents the directory to be auto pruned, according to the XDG
specifications.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-29 12:01:12 +01:00
a5443a532b vendor buildah, image, storage, cni
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-03-28 15:12:26 +01:00
5ed62991dc Remove ulele/deepcopier in favor of JSON deep copy
We have a very high performance JSON library that doesn't need to
perform code generation. Let's use it instead of our questionably
performant, reflection-dependent deep copy library.

Most changes because some functions can now return errors.

Also converts cmd/podman to use jsoniter, instead of pkg/json,
for increased performance.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-03-27 20:00:31 -04:00
232b46a374 utils: split generation and writing of storage.conf
split the generation for the default storage.conf and when we write it
if not existing for a rootless user.

This is necessary because during the startup we might be overriding
the default configuration through --storage-driver and --storage-opt,
that would not be written down to the storage.conf file we generated.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-17 10:45:51 +01:00
7efefde3bc rootless: write the custom config file before reload
so that when we do a rootlessReload we inherit the correct settings
from the command line.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-15 17:05:06 +01:00
dd8edd639f rootless: do not override user settings
if the settings are available in the user config file, do not override
them with the global configuration.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-15 10:39:40 +01:00
14cfc63631 runtime: refactor NewRuntime and NewRuntimeFromConfig
we had two functions NewRuntimeFromConfig and NewRuntime that differed
only for the config file they use.

Move comon logic to newRuntimeFromConfig and let it lookup the
configuration file to use when one is not specified.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-15 10:39:39 +01:00
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
e02393ba70 libpod: allow to configure path to the network-cmd binary
allow to configure the path to the network-cmd binary, either via an
option flag --network-cmd-path or through the libpod.conf
configuration file.

This is currently used to customize the path to the slirp4netns
binary.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-11 09:29:04 +01:00
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
2ac7991d1b rootless: fill in correct storage conf default
When the configuration file is specified, be sure to fill rootless
compatible values in the default configuration.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-05 16:09:41 +01:00
9bf8bd7bcb runtime: fill a proper default tmpdir when --config is used
Closes: https://github.com/containers/libpod/issues/2408

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-04 10:35:04 +01:00
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
b8e6ef618b Move all storage configuration defaults into libpod
Instead of passing in defaults via WithStorageConfig after
computing them in cmd/podman/libpodruntime, do all defaults in
libpod itself.

This can alleviate ordering issues which caused settings in the
libpod config (most notably, volume path) to be ignored.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 15:32:53 -05:00
ba6f1acf07 Record when volume path is explicitly set in config
This ensures we won't overwrite it when it's set in the config we
load from disk.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 09:38:02 -05:00
5a0a9dfa23 Add debug information when overriding paths with the DB
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-02-26 09:38:02 -05:00