Commit Graph

144 Commits

Author SHA1 Message Date
Urvashi Mohnani bd4cc572c6 Add kube_generate_type to set default for kube generate
The kube_generate_type field can be used to set what kind
of k8s object, i.e pod or deployment, that the podman kube
generate command should generate by default.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-04-03 13:19:23 -04:00
Valentin Rothberg 20e578d5b9 pkg/config: add CONTAINERS_CONF_OVERRIDE
Add yet another environment variable for loading containers.conf.
When CONTAINERS_CONF_OVERRIDE is set, the specified config file
will be loaded last - even when CONTAINERS_CONF is set.

This mechanism is needed to preserve system settings and other
environment variables.  Setting CONTAINERS_CONF will load only
the specified config file and ignore all system and user paths.
That makes testing hard as many Podman tests use CONTAINERS_CONF
for testing.

The intended use of CONTAINERS_CONF_OVERRIDE is to set it during tests
and point it to a specific configuration of Podman (e.g., netavark with
sqlite backend).

Similar needs have popped up talking to users in the automotive and
high-performance computing space.  In a way, such a setting allows for
specifying a specific "flavor" of Podman while preserving all existing
settings on the system.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-03-23 13:48:39 +01:00
Daniel J Walsh 00eae8d87d Back by popular demand CAP_SYS_CHROOT
We are getting a lot of issues on our removal of CAP_SYS_CHROOT
from the default list of capabilities used by Podman, so adding
it back until we do a major release.

This capabilty is also needed to successfully run the
quay.io/buildah/stable image with Podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-03-21 10:25:29 -04:00
Daniel J Walsh 8ff9776671 Add oom_score_adj to set default oom score adj
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-03-15 17:28:59 -04:00
Daniel J Walsh 99fbba5ca3 Allow cgroup-conf settings to be stored in containers.conf
This will allows users to set all containers to automatically
set certain cgroup fields globally for all of their containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-03-14 16:35:54 -04:00
Valentin Rothberg ac12d8f273 containers.conf: add database backend option
The on-going work of adding a new database backend to Podman requires it
to be configurable in containers.conf.  To prevent any breaking changes,
the backend defaults to Podman's current boltdb backend.  Also export
the parsing function for it be usable by Podman.

NOTE: documentation will be added once the database rewrite in Podman
has been completed.  I want to avoid any incomplete docs from leaking
into a release.

Fixes: https://issues.redhat.com/browse/RUN-1772
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-20 13:00:13 +01:00
Daniel J Walsh e2fb8c5133 Add ReadOnly flag to run containers in readonly mode
This is needed for Automotive.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-05 06:05:56 -05:00
Valentin Rothberg 821a0657ca containers.conf: add events_container_create_inspect_data
Add an option to create a more verbose container-create event which
includes a JSON payload with detailed information about the container.

Jira: https://issues.redhat.com/browse/RUN-1702
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-28 13:01:46 +01:00
Aditya R 1ea30aa853 config: add support for platform_to_oci_runtime and default entries for wasm
Containers.conf now supports `platform_to_oci_runtime` which allows end
users to map variant of OCI runtime for a particular platform.

Most ideal use-case of this feature is switching to crun's variant when
platform string is `wasm32/wasi`.

Example
```toml
[engine.platform_to_oci_runtime]
"wasi/wasm" = "crun-wasm"
"wasm/wasm32" = "crun-wasm"
"wasm/wasm64" = "crun-wasm"
```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-11-11 20:44:59 +05:30
unknowndevQwQ 5db50a2cb8 feat: add support for the youki OCI Runtime 2022-10-22 10:35:23 +08:00
Doug Rabson 8d0af4f01e config: Add config entry for ocijail
Another experimental OCI runtime for FreeBSD, similar to runj but with
a focus on podman/buildah compatiblity.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-10-19 12:02:47 +01:00
Valentin Rothberg e17483b871 bump to golangci-lint v1.50.0
Used `go fmt` rules to migrate away from deprecated functions, for
instance `gofmt -w -s -r 'ioutil.TempDir(a, b) -> os.MkdirTemp(a, b)'`

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-17 15:03:07 +02:00
Charlie Doern 2b86bc5d8a podman machine and podman-remote need some softer handling when it comes to key verification
this ensures that podman machine will still work (until we want to make this mandatory). I made the call back function more verbose so we know what is happening from now on.

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-09-26 15:36:00 -04:00
Paul Holzinger 7fff18ce94 phg/config: do not force default EventsLogFilePath
The problem with setting such defaults in c/common is that podman cannot
know if a user set this or it is the default. EventsLogFilePath is not a
static path, it depends on the --tmpdir value from podman.

check
b0b36430b8/libpod/runtime.go (L1041-L1043)

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-09 15:07:58 +02:00
Charlie Doern 64be63d976 ssh package
initial implementation of the ssh package including:

- nativeConnectionCreate() / golangConnectionCreate()
- n/a / golangConnectionDial()
- nativeConnectionScp() / golangConnectionScp()
- nativeConnectionExec() / golangConnectionExeC()

the way this works, is there are publicly accessible functions Create, Exec, Dial and Scp. podman will have a new global flag --ssh` that will allow users to choose native or golang based ssh functions. The functionality in containers/common (here) also checks if you have the necessary binaries installed

closes #1091

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-08-08 09:22:46 -04:00
Dominique Martinet 837a035e34 pkgs/config tests: fix tests when /usr/libexec/foo does not exist
cni_plugin_dirs validation require directories to exist, use a
directory that is more likely to exist like /tmp instead of an
arbitrary path that won't exist on most systems

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2022-07-08 08:07:37 +09:00
Daniel J Walsh 58f58410a6 Support setting image_volume_mode in containers.conf
Begins to fix https://github.com/containers/podman/issues/14230

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-18 10:10:06 -04:00
Doug Rabson faf3c75d8f Add runj which is an experimental OCI runtime based on FreeBSD jails
Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-05-09 14:07:58 +01:00
Valentin Rothberg 1cb045b421 containers.conf: add pod_exit_policy
Add a new `pod_exit_policy` field to the containers.conf's engine table.
A pod's exit policy determines the behaviour when the last container of
a pod exits.

Required-in: containers/podman/pull/13859
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-29 12:17:16 +02:00
OpenShift Merge Robot 14485d3f32 Merge pull request #1006 from Luap99/ipv6-slirp
pkg/config: fix docs for network_cmd_options
2022-04-21 07:11:03 -04:00
Paul Holzinger ce62c07f22 add host_containers_internal_ip to containers.conf
Set the ip for the host.containers.internal entry in the containers /etc/hosts
file. This can be set to "none" to disable adding this entry. By default it
will automatically choose the host ip.

Also add a function to get the correct host.containers.internal ip. This
should be used by podman and buildah and then passed to the New()
function.

Ref https://github.com/containers/podman/issues/13224

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-21 11:48:36 +02:00
Paul Holzinger a3b0ae033e add base_hosts_file field to containers.conf
base_hosts_file can be used to overwrite the default base host file
/etc/hosts which is used to copy hosts entries from this file into the
containers /etc/hosts file. As special value "image" can be used to copy
the entries from the image hosts file or "none" to not use a base file
at all. IF the value is empty we should use /etc/hosts as default.

Ref https://github.com/containers/podman/issues/13277
Ref https://github.com/containers/podman/issues/13748

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-21 11:39:56 +02:00
Paul Holzinger d154daf361 pkg/config: fix docs for network_cmd_options
Slirp4netns options were changed to always default to ipv6 so it does
not need the extra setting. Update the documentation to reflect this.

see https://github.com/containers/podman/pull/13929

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-20 14:56:31 +02:00
Niall Crowe a894dd11a3 pkg/config: new value for events_logfile_max_size
Changing the value for events_logfile_max_size from 0 to 1048576. This allows
up to 10,000 events to be written to the events log file before rotation occurs.
Also adding new values to default.go

Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-04-20 10:23:50 +01:00
OpenShift Merge Robot 6c2cd2f357 Merge pull request #997 from kolyshkin/golangci-lint
golangci-lint spring cleaning and bump
2022-04-14 07:14:51 -04:00
Daniel J Walsh a3e25551d0 Add machine volumes to containers.conf
This will allow users to specify which volumes they want podman machine
to automatically mount into the machine. These volumes can later be used
to volume mount into containers.

Environment variables like $HOME can be used and are translated at the
time of machine start.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-13 07:33:17 -04:00
Kir Kolyshkin 4393468343 *_test.go: fix or suppress errcheck warnings
Where we can check the error, do it. Where we can not, ignore it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-04-09 15:18:22 -07:00
Sascha Grunert a6b63a5c47 Switch to ginkgo/v2
Update ginkgo to the next major version which has been released a while
ago.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-03-30 10:03:17 +02:00
Paul Holzinger 6239117889 config.Write(): test for empty writes
When we write a default(empty) config it should only add the default
stanza fields but never any actual config values.
This is important see commit 6c61942524 for the reasons.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-25 11:27:19 +01:00
Daniel J Walsh 54be5eba7e IPCMode default mode should be sharable not private
Docker defined --ipc=private to mean that the container's IPC Namespace
can NOT be shared with another container.  While --ipc=shareable can,
which is our current default.  Docker also defines "none" which means
the container runs in a IPC namespace but does NOT mount a /dev/shm.
"Host" means the container runs in the host namespace, and
container:UUID means run new container in other containers namespace.
ns:PATH means run in the namepsace designated in PATH.2

This Patch, fixes containers/common to reflect the correct default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-22 07:25:59 -04:00
Niall Crowe ccad158a8b containers.conf: add events_logfile_max_size
Add a new option to the `[engine]` table in containers.conf
for specifying the maximum size of `events_logfile_path`.
Once exceeded, Podman will rotate the logfile and delete
the old one.

Also add tests to make sure we're not regressing in the future.

Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-03-16 14:32:59 +00:00
Daniel J Walsh e24561828a Change infra_image default to ""
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-27 16:42:18 -05:00
Daniel J Walsh 4c67daff69 Document the events_logfile_path field in containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 12:18:23 -05:00
Hironori Shiina e5204aef82 Check accessibility to journal without sdjournal library
Because `sdjournal` library just ignores directories which are not
accessible, `journald` log driver is set as the default for a user who
cannot access the journal. As a result, the user cannot see logs of
containers via `podman logs`.

This change verifies accessibility of journal directories without
the library.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
2021-11-30 21:24:53 -05:00
Daniel J Walsh 4249000f56 Set netns to default to private like other namespaces
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-18 10:42:47 -05:00
Valentin Rothberg 44f8339664 containers.conf: unknown keys: reduce to Debug level
Reduce the logs for unknown keys from Warn to Debug level.
The containers.conf continuously receives new keys, and some consumers
(e.g., Podman) are updating it at runtime.  Even small divergences in
the vendored versions of containers/common can let one tool run fine and
the other print warnings for each invocation.  Reducing the log-level to
debug works around that problem at the cost of honest typos not being
as easy to detect as before.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-10-08 13:02:25 +02:00
Paul Holzinger 6c61942524 config: add omitzero for numeric types
When toml writes the config file it does not use `omitempty` for numeric
values instead it requires `omitzero`. [1]

The problem is that without this change, `config.Write()` writes
```
[machine]
  cpus = 0
  disk_size = 0
  memory = 0
```
to the user file. Because podman machine system connection add code will
do this the config file is broken afterwards. The first vm will be created
successfully but after this every other vm will be broken because the
cpu, memory and disk size are set to zero.

[1] https://github.com/BurntSushi/toml/pull/81

Fixes containers/podman#11824

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-10-01 15:13:02 +02:00
Daniel J Walsh 8795468580 UserNS should default to '' rather then host
If you use this field in rootless mode, it will blow up,
since rootless mode can not use the host user namespace.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-18 07:00:40 -04:00
Daniel J Walsh 34010ec073 Merge branch 'main' of github.com:containers/common into ipv6 2021-09-17 07:15:03 -04:00
Daniel J Walsh b45ac6d515 Make podman system service timeout configurable in containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-15 06:15:42 -04:00
Frederic Crozat c2965e479c Add support for the krun (runc running in KVM) OCI Runtime
Signed-off-by: Frederic Crozat <fcrozat@suse.com>
2021-09-14 15:57:26 +02:00
Daniel J Walsh fd50dccd46 Enable ipv6 for rootless users by default
Fixes containers/podman#10889

Inspired by @rugk

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-12 06:31:56 -04:00
Daniel J Walsh a5bac2096a Add support for image_copy_tmp_dir
Allow users to set the default location for the temporary files used
during image pulls and pushes.

Defaults to /var/tmp;

Overridden via "TMPDIR" environment variable.

Allow special flag "storage" to indicate the the storage should use
the tmp directory in containers/storage/tmp.

Needed to fix: https://github.com/containers/podman/issues/11107

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-11 04:51:27 -04:00
Paul Holzinger 25622da26e Add HelperBinariesDir field to engine config
This field contains a list of directories which should be used to store
some helper binaries, e.g. gvproxy.

Also add a FindHelperBinary method to the config struct to get the full
path to a helper binary.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-10 13:38:19 +02:00
unknowndevQwQ 43bd1ced8a add some cni plugin paths
add some possible paths for the cni plugin to be stored

Replaces: containers/common#728

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-08-31 06:23:16 -04:00
Daniel J Walsh e3dc20ea75 Fix default definition of secrets in containers.conf
We had a bogus setting for secrets in our default containers.conf
[secret] should have been [secrets].

Also added a test to make sure this never happens again.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-05 06:37:28 -04:00
Daniel J Walsh 001e09ea34 Report bad entries in containers.conf to the user
Currently if a user puts a typo into a contianers.conf
or puts the keys in the wrong section, then tools using
container-common ignore them. This patch will print them
as warnings, so that the user has some ide.

I have tested this locally with Podman.
./bin/podman run alpine echo hi
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
WARN[0000] Failed to decode the keys ["containers.events_logger" "engine.foo"] from "/home/dwalsh/.config/containers/containers.conf".
hi

With ~/.config/containers/containers.conf

[containers]
events_logger = "file"
[engine]
foo="bar"

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-30 15:17:05 -04:00
Daniel J Walsh 4c51429098 Add support for config drop in directories
Fixes: https://github.com/containers/common/issues/368

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-10 16:34:26 -04:00
Daniel J Walsh 9c89b403e7 Add default for log-tag
Needed for https://github.com/containers/podman/issues/10204

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-09 08:43:07 -04:00
Daniel J Walsh 4c654f7ac2 Don't use systemd defaults if /proc/1/comm != systemd
Currently we have users failing to run containers within containers
or on systems without systemd support.  This change will give us
better defaults on these systems.

Fixes: https://github.com/containers/common/issues/580

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-26 15:08:14 -04:00
Daniel J Walsh 542311225b Fix handling of all capabilities
You should be able to specify --cap-add=all --cap-drop=cap_perfmon
And end up with all capabilties except cap_perfmon.

You should not be allowed to specify --cap-add all --cap-drop all

The outcome would be undefined.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-14 07:04:14 -04:00
Valentin Rothberg 2d3c57daa0 adjust log-driver defaults
Commit ebfe786429 changed the default logging driver k8s-file to
journald.  The only consumer of the log-driver is Podman which I think
still needs some more time to stabilize.  Vendoring containers/common
into Podman has revealed quite some warts (see
containers/podman/pull/10222) which reduced my confidence level.

To resolve the chicken-egg-problem of maturing the journald driver, I
want to only partially revert commit ebfe786429.  The built-in default
remains k8s-file while the containers.conf sets it to journald.  The
intention behind is to make sure that running systems are not impacted
but we can change Fedora to journald to increase coverage.

Once the confidence level is back to normal, we can change the default
to journald.  Latest before RHEL9.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-12 14:13:04 +02:00
Daniel J Walsh 3528cdbf3f Only close eventchannel if it exists
We got some crashes in Fedora 34 testing.

Second part of this PR is to fix the config_test which is accitendtly
picking up a containers.conf settings from the host.  This change forces
the default settings.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-10 06:17:32 -04:00
Daniel J Walsh ebfe786429 Swap default logging to journald
This eliminates the concern of log files growing infinitely and also
records all containers for posterity rather then allowing the removal
of a container to destroy the record.

Partially fixes: https://github.com/containers/podman/issues/9158

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-29 13:32:50 -04:00
Daniel J Walsh 671db86c0d Add support for the runsc OCI Runtime
Based on https://github.com/containers/common/pull/507 PR.

Thanks to unknowndev233 unknowndevQwQ@protonmail.com whoever they are.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-24 06:11:10 -04:00
Giuseppe Scrivano 0392037151 capabilities: ALL returns the bounding set
follow up to "capabilities: add new method BoundingSet()".

When ALL is used, limit it to the known capabilities in the bounding
set instead of ALL the known capabilities.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-19 15:58:49 +01:00
Valentin Rothberg 592498d52b Revert "Change default log driver to journald"
This reverts commit 451f5fb68b.

Journald is not yet passing Podman CI.  We need to temporarily revert
the commit to unblock secrets work.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-05 21:28:22 +01:00
Daniel J Walsh 0f802d0065 Add image_default_format
Currently when pulling/pushing images we default to the format
of the source image.  When Building images we default to OCI.

Customers have asked us to allow them to force a specific image
type when pushing to a registry.

We already have a flag to building images.

This PR adds image_default_format to define the format to be used
by all tools create/building/pulling and pusing images.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-01 06:38:50 -05:00
Daniel J Walsh 451f5fb68b Change default log driver to journald
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-30 07:57:07 -05:00
Daniel J Walsh 952d2c9991 Add image_parallel_copies engine config
This will allow users to configure the amount of parallel copies that
the container engines are allowed to do. This allows users to configure
their systems to match their available network settings.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-21 14:59:34 -05:00
Daniel J Walsh 2694f2c7dc Add new function to setup default environment
Need to be able to getdefault container environment
based on use provided functions on httpProxy and use
the environment from the host.

This way users can modify the environment from podman

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-07 15:48:11 -05:00
Daniel J Walsh 58231b6407 http_proxy is supposed to default to true.
In the containers.conf we default to true, but in code and man page
it is defaulted to false. Since Podman wants it defaulted to true
we need to change default and man page to match.

Also fixed the testing for SELinux, which would never succeed on an SELinux box.

Helps fix: https://github.com/containers/podman/pull/8844

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-29 08:04:52 -05:00
Daniel J Walsh 00631f7fa2 Add support for CONTAINER_CONNECTION environment variable
Users on the MAC have pointed out that they could have multiple connections
to different servers, and they asked to be able to specify the connection
name via environmnet variable rather then to always have to specify the
connection on the command line if they did not want to use the default
setting.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-16 07:06:04 -04:00
Qi Wang f1c4d645f6 ValidatePullPolicy case-insensitive
Set pullpolicy case-insensitive for fixing https://github.com/containers/podman/issues/7246. And replce the duplicate code in podman with c/common code.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-09-10 17:05:35 -04:00
Daniel J Walsh 1ef1790040 Add TERM=xterm to default setting for env
We want to make sure that the TERM envionment variable is always
set.  TERM defaulted to ansi might be better, but we want to match
Docker defaults, so we will stick at xterm.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-08-18 11:37:15 -04:00
Jhon Honce 4f496fde52 Add support for multiple service destinations
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-07-15 14:02:00 -07:00
Qi Wang 4c9e0ba4cd Add config reload
Add Reload() to reload configurations from containers.conf files.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-07-14 15:08:18 -04:00
Nalin Dahyabhai d045e7f373 readConfig(): don't return a pointer
Remove the often-unused result value from readConfig().

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2020-06-30 15:02:39 -04:00
Daniel J Walsh dd0b47bedf Fix testing to not race on containers.conf
Looks like the Write test has to run last.  Not sure why this is
crashing but this fixes the issue.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-25 06:04:39 -04:00
Sascha Grunert 4a58c879e2 Change AppArmor profile prefix and fix name-check
The default AppArmor profile is now prefixed with
`container-default-$VERSION`, whereas the version is now part of a new
`version` package.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-06-23 18:11:28 +02:00
Daniel J Walsh a3a0a08b50 Add support for Remote flags in containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-28 15:47:01 -04:00
dependabot-preview[bot] 461f6406d9 Bump github.com/onsi/gomega from 1.9.0 to 1.10.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.9.0...v1.10.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-08 07:39:54 -04:00
Daniel J Walsh f681e24f01 Fix config.Capabilities function call
We need to normalize the capadd and capdrop functions, and
we need to return errors if the caller gives us bad input.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-30 17:41:07 -04:00
Daniel J Walsh c719975a94 Add RuntimeSupportsKVM to config.Engine
We need to identify the list of containers that support KVM separation, these
containers can run with a different SELinux label, and we might be able to
make different decisions in the container engines about how to launch these
containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-07 10:11:59 -04:00
Daniel J Walsh 4bb3c87228 Add kata containers support
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-27 06:54:25 -04:00
Daniel J Walsh 50135a792d Change references to libpod to engine
containers/common pkg/config is for more engines then just libpod.

We want to use the 'libpod' section to configure parts of buildah.  Renaming this
section to engine, makes it more obvious to users that these fields can effect other
container engines.

Certain fields are still libpod specific, so we do not change those fields.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-11 14:56:32 -04:00
Daniel J Walsh 357a5402c6 NewConfig(): passed-in configuration file should matter most
In NewConfig(), settings in the file whose name we're passed should
matter more than the hardwired default files, or the file named in the
CONTAINERS_CONF environment variable.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-09 17:29:26 -04:00
Qi Wang bec93b6703 Add pull_policy to LibpodConfig
pull_policy is the same as podman run --pull option to determin whether to pull a new image when running a container.
Accepted "always", "missing", and "never". Default value is "missing".

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-03-03 11:13:38 -05:00
Daniel J Walsh 3d6b785749 CgroupManager should belong to libpod not containers
CgroupManager is defined for managing containers, it is not defined
per container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-20 10:27:47 -05:00
Daniel J Walsh ad4b16c9d2 Remove additional_ adjective from containers.conf
Additional is implied, so should not be stated.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-19 09:48:11 -05:00
Daniel J Walsh 862583d397 Merge pull request #63 from ArangoGutierrez/issue_62
Add annotations into containers.conf file
2020-02-18 14:30:43 -05:00
Valentin Rothberg 130c712a05 pkg/capabilities
Replace pkg/caps with pkg/capabilities (from libpod).  It's also a fork
from Docker but attributes its origing with copyright notes and has a
trimmed down (and faster) API.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-18 15:58:19 +01:00
Carlos Eduardo Arango Gutierrez be1f3f6caa fix gofmt on file config_test.go
apply `gofmt -s -w config_test.go`

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2020-02-17 18:13:03 -05:00
Daniel J Walsh 4fa425fe38 Add Default function to read containers config
This function should be called to return a default config to be used
by callers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-10 08:21:07 -05:00
Daniel J Walsh 95fb926363 Stop validating networkconfig by default
This is causing issues in rootless and remote mode.  We should not be creating
directories on the fly.
Also stop exporting functions that are not used by Buildah and Podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-29 06:10:15 -05:00
Daniel J Walsh 789d9a515f Run code through codespell
Fix spelling mistakes found using codespell.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-08 08:56:50 -05:00
Daniel J Walsh 3e1c3932bf Add new Capability function to parse Capabiltiies
The Capability check handles merging of Default capabiltiies along
with user specified add and drop capabilities.

Fork docker/docker/oci/caps file to prevent a huge vendor

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-07 17:57:04 -05:00
Daniel J Walsh 2603f5de14 Fix handling of SELinux labeling
Also re-add DefaultMountsFile since we need a holding place to be
used in libpod.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-04 05:45:17 -05:00
Daniel J Walsh 74d7f91c66 Update/Fix man page and fix several bugs in definition.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-03 13:57:01 -05:00
Daniel J Walsh 67213c41a3 Remove merge code and optional handling
Fix handling of toml files

No longer need merge, since we can specify a default conf for each toml file.
The toml code will retain the previous defaults and only use the newly specified
values.

This greatly simplifies the code.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-12-11 08:26:52 -05:00
Qi Wang 894913abdf add libpod.conf to containers.conf
Add configurations from libpod.conf to containers.conf.Use merge code from libpod to read and merge configurations from file.

Add unshare_linux for build linux: HomeDir should buildah not only for linux. so add unshare_linux for linux and unshare.go for other

convert bool to optinalbool:Use OptionalBool for on-disk configurations so we can distinguish field is undefined  vs. user set to false.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-12-06 15:55:47 -05:00
Qi Wang 023822b7b0 turn off the check of the hook directory
Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-11-09 13:05:58 -05:00
Qi Wang 64705d1f72 Fix tests failure #11
tests failures should be fixed since #11 add hooksdir to default config.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-11-04 10:28:56 -05:00
Qi Wang 9bb8e7e62b Add config package for containers.conf
This PR adds a package config for reading configurations from the containers.conf into the go struct.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-10-07 13:38:17 -04:00