Commit Graph

170 Commits

Author SHA1 Message Date
Daniel J Walsh f8045ec731 Remove conmon probe
This is taking time on every podman call, and provide limited
protection. Versioning should be handled in the packaging system
and this is an unlikely to happen.

Every exec done by container tools hurts us as we try to get container
startup team to absolute minimal amounts.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-27 07:16:29 -05:00
Daniel J Walsh 3a429400c3 Deprecate UserNSSize, since we don't use it
Podman and Buildah do not use this field, and I
know of no users of it, remove it from docs and
the default conf file, so users will not expect
it to do anything.

Leaving implementation in the slight chance someone
has used it in a non containers project.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-21 13:06:10 -05: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
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
OpenShift Merge Robot af3185ad19 Merge pull request #1119 from rhatdan/path
Add support for returning image path with ARCH and OS Substitutions
2022-08-23 09:06:05 -04:00
Filipe Brandenburger de5bad0cc3 config: Allow specifying helper dirs with $BINDIR as base directory
This should make it easier to locate helper binaries relative to where the main
binary was installed, which should be useful in installations such as Homebrew
which install packages under a versioned directory.

Use a `$BINDIR` magic token as a prefix in the helper path to indicate it should
be relative to the directory where the binary is located. This is somewhat familiar
to the syntax used in the shell and Makefile and is still quite explicit about the
behavior (as opposed to, say, making all relative paths be relative to the directory
of the binary.)

Tested: After updating the Darwin config to include a `$BINDIR/../libexec/podman`
directory, updated vendored package in podman, built it with `podman-remote`,
copied `gvproxy` to a `libexec/podman` at the same level as `bin/podman` and
confirmed that `podman machine start` worked as expected. Also confirmed that
having the `podman` in search path be a symlink to a binary elsewhere works as
expected, the searched `../libexec/podman` directory is relative to the actual
binary and not the symlink (which matches the Homebrew use case.)

Signed-off-by: Filipe Brandenburger <filbranden@gmail.com>
2022-08-22 13:28:00 -07:00
Matthew Heon 4f7bd530ae Add volume plugin timeout to containers.conf
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-08-22 14:39:23 -04:00
Daniel J Walsh 3196de901c Add support for returning image path with ARCH and OS Substitutions
Allow distributions to specify the location of the podman image VM
images in the form of URIs with $ARCH and $OS specified.  This would
allow a distribution to pull the image based on the current OS and Arch.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-22 07:17:58 -04:00
Jake Correnti 5128b5a72f Add conmon-rs paths
Adds the conmon-rs paths so Podman can find the right conmon-rs binary
when making a new runtime.

I also slightly modified the `FindConmon` function so that the code
could be shared with the `FindConmonRs` function that I added.

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
2022-08-10 10:46:26 -04: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
openshift-ci[bot] 765893536d Merge pull request #1077 from saschagrunert/errors
Switch to golang native error wrapping
2022-07-12 11:21:37 +00:00
Sascha Grunert 426d69c00f Switch to golang native error wrapping
`github.com/pkg/errors` is deprecated since quite some time so we now
use the native error wrapping for more idiomatic golang.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-12 10:54:07 +02:00
Dominique Martinet 2e8943d3f7 add network dns_bind_port setting and set NETAVARK_DNS_PORT from it
This commit allows using aardvark with an alternate port as per
implementation in containers/netavark#323

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2022-07-08 09:45:15 +09:00
Daniel J Walsh a390d0c66c Change github.com/pkg/errors to use errors in pkg/config
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-18 10:33:53 -04: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
Kir Kolyshkin 27bf522212 .golanci-lint: enable gofumpt
gofumpt is more opinionated version of gofmt. One can use it from their
$EDITOR, or IDE, or gopls to better format the source code.

Previously, commit b951b72412 already formatted all the code with
gofumpt, but since then a couple of things crept in.

Fix these (with gofumpt v0.3.1) and enable the gofumpt linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-05-16 20:01:08 -07:00
Doug Rabson a4a658034b Config files should live in /usr/local on FreeBSD
Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-05-09 14:07:58 +01: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
OpenShift Merge Robot 030366b89e Merge pull request #1024 from Luap99/linters
enable unparam, exportloopref and revive linters
2022-05-06 08:57:16 -04:00
Paul Holzinger cc110440e4 enable unparam, exportloopref and revive linters
unparam and exportloopref already work without changes.
For revive I had to silence many naming issues. I decided to silence them
instead of changing the name because I didn't want to break any code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-06 13:32:35 +02: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
Jason T. Greene 77d8f70039 Deprecate MachineEnabled and replace with API
machine.IsPodmanMachine replaces MachineEnabled
machine.MachineHostType informs the type unknown, qemu, wsl, etc
machine.IsGvProxyBased used to make specific determinations re gvproxy

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-04-23 12:32:54 -05: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
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 b951b72412 Gofumpt the code
gofumpt is a stricter version of gofmt, basically making the code more
readable, and fixing the gocritic's octalLiterar warnings like this one:

	pkg/util/util_supported.go:26:17: octalLiteral: use new octal literal style, 0o722 (gocritic)
		return (perm & 0722) == 0700
			       ^

Generated by gofumpt -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-04-09 16:50:11 -07:00
Daniel J Walsh a4a20e5973 Switch all calls to filepath.Walk to filepath.WalkDir
Eliminating all of the stat calls should make this a bit faster.

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-26 06:53:11 -04:00
Paul Holzinger 205fcae97e pkg/config: events_logfile_max_size add omitzero
Number types must use omitzero otherwise they are included in the toml
file when it is written and the value is 0, see commit 6c61942524.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-24 16:13:19 +01: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
Rover van der Noort 87dcc5729f Add ExitCommandDelay as configuration in EngineConfig with default of 5 minutes in seconds.
Signed-off-by: Rover van der Noort <s.r.vandernoort@student.tudelft.nl>
2022-02-24 15:51:05 +01:00
Paul Holzinger b76062811b pkg/config: add new default_subnet_pools field
Add a new field to set the default subnet pools. They can be used to
change the subnet which is automatically allocated by podman network
create.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-15 15:29:19 +01:00
Daniel J Walsh 3e33e53044 Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-21 07:47:02 -05:00
Paul Holzinger 4eb265ce95 remove rootless_networking field from containers.conf
This field was only needed for machine to force cni, however you can set
netns="bridge" in the config to have the same effect. This is already
done in the machine setup.

The field was more of a hack and just creates confusion for users so we
remove it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-20 16:23:12 +01:00
OpenShift Merge Robot c0b7992982 Merge pull request #887 from machacekondra/configmap
Add configmap backend
2022-01-19 10:37:02 -05:00
Paul Holzinger 995cdaae8f netavark: use globally shared network config dir
Since the network namespace is shared for all rootful libpod instances
we also need to make sure to use the same network config dir and run dir
to ensure that we do not use the same subnet or ip for more than one
container.

Also update the documentation about the network_config_dir field.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-17 15:36:03 +01:00
Ondra Machacek db55cb361b Add configmap backend 2022-01-14 09:56:51 +01:00
Daniel J Walsh f92d49848e No reason to use a Map versus a slice for ProxyEnv
[NO NEW TESTS NEEDED]

Also vendor in latest containers/image code to remove dependabot
warnings.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-07 09:20:54 -05:00
Daniel J Walsh 98b9bd7d43 WEB Proxy is used in at least three different places in code
This change makes a global rather then defining this list in multiple
places.

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-07 08:43:38 -05:00
Jason T. Greene d813c5e6fb Add platform driven image and user defaults for podman machine
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2021-12-09 14:37:54 -06:00
Giuseppe Scrivano f0262407d0 config: add CompressionFormat option
support changing the default compression format in the containers.conf
config file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-02 15:56:43 +01:00
Valentin Rothberg c9748ff5ad containers.conf: add option to enforce docker.io for compat API
Add an option to containers.conf as a knob to enforce short-name
resolution to Docker Hub in Podman's compatibility REST API.

By popular request, turn it on by default.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-19 16:44:56 +01:00
Daniel J Walsh 6d6fe11781 Set the environment variables for the engine
The Engine.Env needs to be set very early in the setup process
to make sure no one attempts to use the environment.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-15 12:03:40 -05:00
Ed Santiago c55ef5b984 FindHelperBinary(): allow override via envariable
When searching for helpers, check $CONTAINERS_HELPER_BINARY_DIR.
If it points at an existing directory, prepend it to the
search path for binaries.

Intention is to use this for developer testing: a way to run make
(e.g. in podman) then use the locally-built rootlessport and pause
images

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-11 12:26:38 -07:00
Matthew Heon 8b1b879924 Add network_backend field for switching to netavark
This field determines whether CNI or netavark will be used to
create container networks. Default presently set to "cni".

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-11-09 13:45:56 -05:00
Daniel J Walsh 9680fe7bf6 Update pkg/config/config.go
Co-authored-by: Valentin Rothberg <rothberg@redhat.com>
2021-10-25 12:36:34 -04:00
Jacob Emmert-Aronson 8d0bbae800 Add a hint for misconfigured helper_binaries_dir
Signed-off-by: Jacob Emmert-Aronson <jacob@roadnottaken2718.com>
2021-10-23 14:50:57 -07:00