Commit Graph

398 Commits

Author SHA1 Message Date
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 7c76968b10 Standardize on capatalize logrus messages, remove stutters
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-24 14:35:52 -04:00
Ashley Cui bb2b17e7da Add machine table to containers.conf
Add machine teable to configure podman machine options. Move machine_image to the machine table, and add cups, disk size, and memory to the machine table.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-09-23 17:03:12 -04:00
Paul Holzinger 27be5dc1df Export no such secret error
There is code in podman which uses `errors.Cause(err).Error() != "no such secret"`,
this is just bad code. Common should expose this error so podman
can check with `errors.Is()`.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-21 11:12:52 +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 abfd6e3fdd ensure same path is used in all location for krun 2021-09-14 16:59:26 +02: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
Paul Holzinger 4bd5b0f4bd Fix the fallback runtime path
Podman should not use `/tmp/run-...`. The Podman PR#8241 changed the
path to `/tmp/podman-run-...` and added systemd tmpfile config to make
sure the path is not removed. However the tmpDir is set in c/common and
was never changed.

Fixes containers/podman#11478

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-08 14:26:25 +02:00
Matthew Heon 92ebb4a858 Switch default Rootless Networking to "CNI" for OSX
This should better support rootless CNI usescases.

Fixes https://github.com/containers/podman/issues/11396

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-09-01 15:57:00 -04: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
Giuseppe Scrivano 639e8c87d0 seccomp: allow memfd_secret
memfd_secret is a new syscall that will be added to Linux 5.14

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-25 18:03:37 +02:00
xatier 8fbbdd14fc Update pkg/sysctl/sysctl.go
Co-authored-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-19 19:29:53 -07:00
xatier d35d150bf7 Update pkg/sysctl/sysctl.go
Co-authored-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-17 09:53:55 -05:00
xatier 6b081c39b1 Add space trimming check in sysctl.Validate
Sync with https://github.com/containers/podman/pull/11224

Signed-off-by: Yan-Ming Li <xatierlike@gmail.com>
2021-08-17 09:52:26 -05:00
xatier 85fb393029 Fix `pkg/sysctl` path typo
Closes: containers/common#730
Signed-off-by: xatier <xatierlike@gmail.com>
2021-08-16 20:36:46 -05:00
flouthoc e278dcf7ef path: dest paths inside container should always be treated as *nix type
Destination path inside containers should be always validated  as
*nix absolute path. So its recommended to use path.IsAbs() instead of
filepath.IsAbs().

[NO TEST NEEDED]

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2021-08-16 09:46:05 +05:30
Daniel J Walsh e97a1758ed Merge pull request #724 from unknowndevQwQ/patch-1
fix: fix #723
2021-08-12 06:42:20 -04:00
unknowndevQwQ 2ae6f621cd style: fix commit 927da0c 2021-08-12 16:43:36 +08:00
unknowndevQwQ 66d20a74b1 fix: fix #723
#707 commit will be revert
this since was not tested and caused problem #723

> #693#issuecomment-891126410
but it does cause problems
2021-08-12 16:12:23 +08:00
openshift-ci[bot] e2d30a3914 Merge pull request #716 from ashley-cui/machineconfs
Add machine_image to containers.conf
2021-08-10 14:56:30 +00:00
Ashley Cui 927da0ce99 Add machine_image to containers.conf
Signed-off-by: Ashley Cui <acui@redhat.com>
2021-08-09 15:37:06 -04:00
Daniel J Walsh 4c61660bf5 Switch default logdriver and eventslogger to journald, if root
This will fix hte eventslog and log files from growing huge,
Lets journald handling rolling logs.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-08-09 11:54:46 -04:00
unknowndevQwQ d55878097e style: complete containers#556 to-do list part 4
Finish the last unfinished part
2021-08-03 09:19:26 +08:00
openshift-ci[bot] 295d00f087 Merge pull request #706 from unknowndevQwQ/patch-1
fix: fix #692
2021-08-02 14:26:06 +00:00
dependabot[bot] 55204ee364 build(deps): bump github.com/containers/image/v5 from 5.14.0 to 5.15.0
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.14.0 to 5.15.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.14.0...v5.15.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-02 16:02:52 +02:00
unknowndevQwQ 1826e711c7 fix: fix #692 2021-08-02 21:43:06 +08:00
openshift-ci[bot] 33b273da89 Merge pull request #694 from unknowndev233/patch-1
complete containers#556 to-do list
2021-08-01 11:18:17 +00:00
Sascha Grunert e344d412c0 Remove `--accept-repositories` flag
We decided to remove the flag and opt-in via the options from Podman.
This means we do not need the flags any more, but keep the configuration
itself.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-07-30 13:03:03 +02:00
Valentin Rothberg fca9d0caf3 pull policy: support camel cases
The K8s pull policies are in camel case:
 * Always
 * IfNotPresent
 * Never

Support them in conjunction to Missing, Newer and IfNewer.  Doing it
here prevents Podman (and possibly CRI-O in the future) from adding
custom parsers.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-07-29 11:52:52 +02:00
Giuseppe Scrivano d7e8c2338b config: split arguments in DBUS_SESSION_BUS_ADDRESS
split the DBUS_SESSION_BUS_ADDRESS value so that something like:

unix:path=/run/user/1000/bus,guid=817e9ffcfb383869ad17ea8360e7428a

will ignore ",guid=817e9ffcfb383869ad17ea8360e7428a" when checking
that the path exists.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-07-26 15:08:33 +02:00
unknowndev233 238bc190f9 style: complete containers#556 to-do list part 3
line feed indentation are two spaces
2021-07-25 21:34:59 +08:00
unknowndev233 7b54c73e5e style: complete containers#556 to-do list part 2
delete space before the option to make it clear that it is an option
2021-07-25 21:27:12 +08:00
unknowndev233 7a862db7f3 style: complete #556 to-do list
add a line break between the description and the option
2021-07-25 21:02:34 +08:00
unknowndev233 1c9bde16c0 style: correct minor typos
delete the line 134 extra spaces added by commit 74d7f91
2021-07-25 20:33:06 +08:00
OpenShift Merge Robot a91cf9f69f Merge pull request #659 from saschagrunert/login-logout-registry-path
Add support for path based registry in login/logout
2021-07-24 04:44:17 -04:00
Kir Kolyshkin 701f0ee3b6 pkg/seccomp: avoid DefaultErrnoRet: null
This prevents

	"defaultErrnoRet": null,

from appearing in seccomp.json.

This member is similar to ErrnoRet in type Syscall,
and should also be marked with omitempty.

Fixes: c662eb936b
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-23 16:54:29 -07:00
Sascha Grunert 9f3d6b6bdd Add support for path based registry in login/logout
We now add a new configuration option to opt-in for path based registry
authentication in containers-auth.json. This affects login and logout,
which means if the option is enabled we can now use
`my-registry.local/path/to/image` to save or remove the credentials from
the auth.json.

If the option is enabled, then we enforce a stricter validation of the
input. For example it is not allowed input `http[s]://` prefixed keys.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-07-23 09:41:19 +02:00
OpenShift Merge Robot 33633ba029 Merge pull request #678 from vikas-goel/prepare-volume
User option to prepare container after creation for volume copy-up.
2021-07-15 09:22:09 -04:00
Vikas Goel a7668c208f User option to prepare container after creation for volume copy-up.
Docker does this by default.

Relates to podman#10262

[NO TESTS NEEDED]

Signed-off-by: Vikas Goel <vikas.goel@gmail.com>
2021-07-14 12:12:15 -07:00
Matej Vasek 61d2ae986d add config option for ChownCopiedFiles
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-07-13 18:17:12 +02: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
Tino Rusch 71ef0ed9cc add shelldriver.
Signed-off-by: Tino Rusch <tino.rusch@gmail.com>
2021-06-30 17:25:03 +02:00
cdoern 7a8b35ffe6 Created nummem_linux.go and nummem_unsupported.go
Created new sysInfo file to get and parse the number of executable memory nodes.

Signed-off-by: cdoern <cdoern@redhat.com>
2021-06-29 13:23:46 -04:00