Commit Graph

5133 Commits

Author SHA1 Message Date
Toshiki Sonoda 17b5bd758d e2e: use isRootless() instead of rootless.IsRootless()
Unify the functions used to detect rootless to "isRootless()".
This function can detect to join the user namespace by mistake.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-18 10:34:51 +09:00
Ed Santiago dc2bd0857d sig-proxy system test: bump timeout
...and instrument with 'podman ps'es for debugging failures.

Test flakes pretty regularly in Fedora gating. If the increased
timeout doesn't help, at least we should be able to see if the
container is stopping or failed or something.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-17 08:21:39 -07:00
OpenShift Merge Robot cf40adb3df
Merge pull request #17118 from giuseppe/rename-auth-scripts-to-preexec-hooks
rootless: rename auth-scripts to preexec-hooks
2023-01-17 09:53:25 -05:00
Giuseppe Scrivano a581d2a041
rootless: rename auth-scripts to preexec-hooks
to not give a false sense of security since these are not a security
mechanism but a hook to run arbitrary code before executing a
command.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-01-17 10:58:46 +01:00
Martin Roukala (né Peres) 70057c8b47
Make rootless privileged containers share the same tty devices as rootfull ones
Until Podman v4.3, privileged rootfull containers would expose all the
host devices to the container while rootless ones would exclude
`/dev/ptmx` and `/dev/tty*`.

When 5a2405ae1b ("Don't mount /dev/tty* inside privileged containers
running systemd") landed, rootfull containers started excluding all the
`/dev/tty*` devices when the container would be running in systemd
mode, reducing the disparity between rootless and rootfull containers
when running in this mode.

However, this commit regressed some legitimate use cases: exposing
non-virtual-terminal tty devices (modems, arduinos, serial
consoles, ...) to the container, and the regression was addressed in
f4c81b0aa5 ("Only prevent VTs to be mounted inside privileged
systemd containers").

This now calls into question why all tty devices were historically
prevented from being shared to the rootless non-privileged containers.
A look at the podman git history reveals that the code was introduced
as part of ba430bfe5e ("podman v2 remove bloat v2"), and obviously
was copy-pasted from some other code I couldn't find.

In any case, we can easily guess that this check was put for the same
reason 5a2405ae1b was introduced: to prevent breaking the host
environment's consoles. This also means that excluding *all* tty
devices is overbearing, and should instead be limited to just virtual
terminals like we do on the rootfull path.

This is what this commit does, thus making the rootless codepath behave
like the rootfull one when in systemd mode.

This leaves `/dev/ptmx` as the main difference between the two
codepath. Based on the blog post from the then-runC maintainer[1] and
this Red Hat bug[2], I believe that this is intentional and a needed
difference for the rootless path.

Closes: #16925
Suggested-by: Fabian Holler <mail@fholler.de>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>

[1]: https://www.cyphar.com/blog/post/20160627-rootless-containers-with-runc
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=501718
2023-01-16 16:23:53 +02:00
OpenShift Merge Robot cdcd2eddc7
Merge pull request #17107 from vrothberg/fix-17016
kube play: complete container spec
2023-01-14 11:19:07 -05:00
OpenShift Merge Robot ae674a3c7c
Merge pull request #17082 from dcermak/warn-about-replicas
Warn about creating multiple replicas from kubernetes YAML
2023-01-14 11:08:46 -05:00
OpenShift Merge Robot 64988ad287
Merge pull request #17108 from vrothberg/fix-17093
fix flake in kube system test
2023-01-13 21:46:50 -05:00
OpenShift Merge Robot e1828873e7
Merge pull request #17018 from sstosh/e2e-systemd-acrivate
e2e: fix systemd_activate_test
2023-01-13 15:45:03 -05:00
Valentin Rothberg 4bb69abd5f fix flake in kube system test
Increase the loop range from 5 to 20 to make sure we give the service
enough time to transition to inactive.  Other tests have the same range
with 0.5 seconds sleeps, so I expect the new value to be sufficient and
consistent.

Fixes: #17093
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-13 15:38:50 +01:00
Valentin Rothberg 9a206fdc9f kube play: complete container spec
Make sure that the specs of containers generated by `kube play` are
correctly completed.  They have not before which surfaced in default
environment variables not being set.

Fixes: #17016
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-13 15:18:11 +01:00
OpenShift Merge Robot e473c93e94
Merge pull request #17072 from edsantiago/refactor_700
podman-play system test: refactor
2023-01-13 08:30:18 -05:00
OpenShift Merge Robot ceeeea874d
Merge pull request #17102 from ygalblum/kube-port-test-inspect
E2E Tests: Use inspect instead of actual data to avoid UDP flake
2023-01-13 03:49:54 -05:00
Ygal Blum a02a10f3f3 E2E Tests: Use inspect instead of actual data to avoid UDP flake
Do not test using an unreliable UDP connection

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-13 07:37:06 +02:00
Dan Čermák d9bf3f1290
Limit replica count to 1 when deploying from kubernetes YAML
This fixes: https://github.com/containers/podman/issues/16765

Signed-off-by: Dan Čermák <dcermak@suse.com>
2023-01-12 23:25:35 +01:00
Matthew Heon 1ab833fb73 Set StoppedByUser earlier in the process of stopping
The StoppedByUser variable indicates that the container was
requested to stop by a user. It's used to prevent restart policy
from firing (so that a restart=always container won't restart if
the user does a `podman stop`. The problem is we were setting it
*very* late in the stop() function. Originally, this was fine,
but after the changes to add the new Stopping state, the logic
that triggered restart policy was firing before StoppedByUser was
even set - so the container would still restart.

Setting it earlier shouldn't hurt anything and guarantees that
checks will see that the container was stopped manually.

Fixes #17069

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2023-01-12 14:45:34 -05:00
Ed Santiago 6ab8834480 podman-play system test: refactor
The kube-play test file was a rat's nest of long complicated
yaml strings all differing only slightly. Clean it up, by
adding a helper function with optional parameters. The
helper is ugly, but the actual test code (the important
stuff) is cleaner.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-12 12:28:48 -07:00
OpenShift Merge Robot b107d7720a
Merge pull request #16732 from flouthoc/network-update
network: add support for `podman network update` and `--network-dns-server`
2023-01-12 12:18:14 -05:00
Aditya R 882cd17f83
network: add support for podman network update and --network-dns-server
* Add support for `podman network update <>`

```console
network update

Description:
  update networks for containers and pods

Usage:
  podman network update [options] NAME

Examples:
  podman network update podman1

Options:
      --dns-add stringArray      add network level nameservers
      --dns-drop stringArray   remove network level nameservers
```

* Add support for `--network-dns-server` to `podman network create`

Extends podman to support recently added features in `netavark` and
`aardvark-dns`

* https://github.com/containers/netavark/pull/497
* https://github.com/containers/aardvark-dns/pull/252
* https://github.com/containers/netavark/pull/503

[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
2023-01-12 20:19:14 +05:30
Valentin Rothberg d2fb6cf05d service container: less verbose error logs
While manually playing with --service-container, I encountered a number
of too verbose logs.  For instance, there's no need to error-log when
the service-container has already been stopped.

For testing, add a new kube test with a multi-pod YAML which will
implicitly show that #17024 is now working.

Fixes: #17024
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-12 14:09:23 +01:00
Ygal Blum b10a906b5c Quadlet Kube - add support for PublishPort key
Move the handling of Publish key to a method
use --publish instead of -p
Use the new method for both .container and .kube files
Adjust .container tests
Add .kube tests
Update the man page

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-12 10:19:14 +02:00
OpenShift Merge Robot a7ba63dede
Merge pull request #17055 from mupuf/mount-non-vt-tty
Only prevent VTs to be mounted inside privileged systemd containers
2023-01-11 20:59:26 -05:00
Toshiki Sonoda ad12d61c66 e2e: fix systemd_activate_test
- When SELinux is enabled, a storage root directory
should be labeled with a specific value.

- `stop podman.service` test changes a storage root directory,
therefore we need to cleanup a container with --root option.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-12 09:53:15 +09:00
OpenShift Merge Robot 39ffcb8c31
Merge pull request #17064 from Romain-Geissler-1A/docker-compat-networkmode
[docker compat] Don't overwrite the NetworkMode from "default" to "bridge" if containers.conf specifies a non-default configuration.
2023-01-11 18:44:15 -05:00
OpenShift Merge Robot 1e451031ff
Merge pull request #17067 from sstosh/e2e-play-kube
e2e: fix play_kube_test
2023-01-11 14:31:40 -05:00
OpenShift Merge Robot 8a0d25f673
Merge pull request #17083 from ygalblum/kube-port-test-set-deadline
E2E Test: Play Kube set deadline to connection to avoid hangs
2023-01-11 13:50:51 -05:00
OpenShift Merge Robot f70233aa08
Merge pull request #16951 from ygalblum/system-test-quadlet-network
System tests: quadlet network test
2023-01-11 13:19:01 -05:00
Romain Geissler 3e2b9a28da [docker compat] Don't overwrite the NetworkMode if containers.conf overrides netns.
Fixes #16915 (only the part about docker client).

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2023-01-11 17:44:09 +00:00
Ygal Blum 5b1bdf9490 E2E Test: Play Kube set deadline to connection to avoid hangs
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-11 18:56:45 +02:00
Martin Roukala (né Peres) f4c81b0aa5 Only prevent VTs to be mounted inside privileged systemd containers
While mounting virtual console devices in a systemd container is a
recipe for disaster (I experienced it first hand), mounting serial
console devices, modems, and others should still be done by default
for privileged systemd-based containers.

v2, addressing the review from @fho:
 - use backticks in the regular expression to remove backslashes
 - pre-compile the regex at the package level
 - drop IsVirtualTerminalDevice (not needed for a one-liner)

v3, addressing the review from @fho and @rhatdan:
 - re-introduce a private function for matching the device names
 - use path.Match rather than a regex not to slow down startup time

Closes #16925.

Fixes: 5a2405ae1b ("Don't mount /dev/tty* inside privileged...")
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
2023-01-11 16:57:58 +02:00
Toshiki Sonoda a5ce3b3cd7 e2e: fix play_kube_test
When SELinux is enabled, e2e test could be failed
due to run a ls command in a running container.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-11 14:28:24 +09:00
OpenShift Merge Robot 382c55eeaa
Merge pull request #17038 from ygalblum/quadlet-kube-configmap
Quadlet: Add support for ConfigMap key in Kube section
2023-01-10 22:20:55 -05:00
Daniel J Walsh 7c95a5df92
Merge pull request #17053 from edsantiago/ditch_wwwpodmanio
Network tests: ping redhat.com, not podman.io
2023-01-10 15:07:28 -05:00
Daniel J Walsh 619933a530
Merge pull request #17041 from vrothberg/post-run
cobra: move engine shutdown to Execute
2023-01-10 12:59:17 -05:00
OpenShift Merge Robot 6ba308f075
Merge pull request #16880 from ygalblum/kube-publish-ports
Kube Play - allow setting and overriding published host ports
2023-01-10 11:49:36 -05:00
Ed Santiago 37ade6be12 Network tests: ping redhat.com, not podman.io
Much as we'd love to eat our dogfood, podman.io is not hosted
on reliable infrastructure; redhat.com is. Let's see if this
gets rid of CI flakes.

Closes: #17044

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-10 05:38:43 -07:00
Valentin Rothberg 2d8225cd44 cobra: move engine shutdown to Execute
If the run errors, cobra does not execute post runs.  It is a somehow
known issue (https://github.com/spf13/cobra/issues/914) but problematic
for Podmand as the runtime is shutdown during post run.

Since some commands overwrite the post run and a general lack in cobra
of post runs on errors, move the shutting down the engines directly into
Execute.  Fixing the issue may fix a number of flakes.

Note that the shutdowns are NOPs for the remote client.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-10 13:30:41 +01:00
OpenShift Merge Robot 5b9e068950
Merge pull request #17040 from giuseppe/podman-rm-f-no-processes
podman: podman rm -f doesn't leave processes
2023-01-10 05:11:00 -05:00
Giuseppe Scrivano 4cf06fe7e0
podman: podman rm -f doesn't leave processes
follow-up to 6886e80b45

when "podman -rm -f" is used on a container in "stopping" state, also
make sure it is terminated before removing it from the local storage.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-01-09 21:01:32 +01:00
Giuseppe Scrivano cf364703fc
linux: add /sys/fs/cgroup if /sys is a bind mount
if /sys is bind mounted from the host then also add an explicit mount
for /sys/fs/cgroup so that 'ro' is honored.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-01-09 19:42:51 +01:00
OpenShift Merge Robot 1da081f289
Merge pull request #17017 from edsantiago/ditch_ubi
e2e tests: stop using UBI images
2023-01-09 10:25:43 -05:00
Ygal Blum 1bd3d32c5f Quadlet: Add support for ConfigMap key in Kube section
For each instance of ConfigMap pass the path via --configmap
Add tests
Add to doc

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-09 14:58:31 +02:00
Valentin Rothberg 4a7a45f973 remove service container _after_ pods
Do not allow for removing the service container unless all associated
pods have been removed.  Previously, the service container could be
removed when all pods have exited which can lead to a number of issues.

Now, the service container is treated like an infra container and can
only be removed along with the pods.

Also make sure that a pod is unlinked from the service container once
it's being removed.

Fixes: #16964
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-09 13:44:51 +01:00
OpenShift Merge Robot bc6908e761
Merge pull request #17014 from rhatdan/VENDOR
Vendor in latest containers/common
2023-01-09 03:46:16 -05:00
Ygal Blum 07cc49efdb Kube Play - allow setting and overriding published host ports
Add a new flag --publish
Remote - Pass PublishPorts as a string array
ABI - translate the string array to Ports and merge with the ports in the spec
Add e2e tests
Add option to man doc

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-08 13:49:53 +02:00
OpenShift Merge Robot 5de8cd74f9
Merge pull request #16820 from rhatdan/names
Allow '/' to prefix container names to match Docker
2023-01-07 09:38:19 -05:00
Daniel J Walsh e332b6246b
Vendor in latest containers/common
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-06 14:19:47 -05:00
OpenShift Merge Robot 6f4eafe37c
Merge pull request #16992 from Luap99/log-since
several podman logs fixes
2023-01-06 12:05:34 -05:00
Ed Santiago e82045f73c e2e tests: stop using UBI images
Red Hat registry is too unreliable. (As of this writing
in January 2023, quay.io is not much better, but this is
a new flake. Ubi has been flaking for a year or more).

Instead of UBI, use the new systemd-image added to system tests
in #16814. Since this reduces the number of cached images,
a few unrelated tests (image count) need to be tweaked.

And, sigh, Fedora systemd colorizes boot messages by default,
causing a failure where we don't see an expected Reached Target
message. I don't want to rely on ASCII formatting codes, so
I've updated the build-systemd-image script so it disables
systemd colors, and have built a new systemd-image:20230106.
Made a few small usability improvements to the script as well.

Closes: #16695

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-06 08:21:50 -07:00
OpenShift Merge Robot 609df3ec32
Merge pull request #17002 from containers/dependabot/go_modules/test/tools/golang.org/x/tools-0.5.0
Bump golang.org/x/tools from 0.4.0 to 0.5.0 in /test/tools
2023-01-06 09:40:41 -05:00
Paul Holzinger 6038200fe0
k8s-file: podman logs --until --follow exit after time
When you use podman logs with --until and --follow it should exit after
the requested until time and not keep hanging forever.

This fixes the behavior for the k8s-file backend.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-06 15:19:23 +01:00
Paul Holzinger 767947ab88
journald: podman logs --until --follow exit after time
When you use podman logs with --until and --follow it should exit after
the requested until time and not keep hanging forever.

To make this work I reworked the code to use the better journald event
reading code for logs as well. this correctly uses the sd_journal API
without having to compare the cursors to find the EOF.

The same problems exists for the k8s-file driver, I will fix this in the
next commit.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-06 15:19:22 +01:00
Paul Holzinger 5f032256db
podman logs: journald fix --since and --follow
The `containerCouldBeLogging` bool should not be false by default, when
--since is used we seek in the journal and can miss the start event so
that bool would stay false forever. This means that a running container
is not followed even when it should.

To fix this we can just set the `containerCouldBeLogging` bool based on
the current contianer state.

Fixes #16950

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-06 15:19:16 +01:00
OpenShift Merge Robot b7314bdc68
Merge pull request #16806 from jakecorrenti/podman-inspect-add-error-info
Add container error message to ContainerState
2023-01-05 16:02:42 -05:00
OpenShift Merge Robot 7f3dd309c6
Merge pull request #16989 from sstosh/fix-e2e
e2e: fix run_volume_test
2023-01-05 13:56:42 -05:00
dependabot[bot] 4587e7fdb4
Bump golang.org/x/tools from 0.4.0 to 0.5.0 in /test/tools
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-05 18:54:13 +00:00
Daniel J Walsh d0c89e90bf
Describe copy volume options
Fixes: https://github.com/containers/podman/issues/16961

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-04 14:58:51 -05:00
OpenShift Merge Robot 49075c3813
Merge pull request #16985 from ashley-cui/attachsig
Support sig-proxy for podman-remote attach and start
2023-01-04 13:15:29 -05:00
Ashley Cui bfdffb5b62 Support sig-proxy for podman-remote attach and start
Signals were not proxied for attach and start for podman-remote. Now
they are.

Signed-off-by: Ashley Cui <acui@redhat.com>
2023-01-04 09:38:17 -05:00
OpenShift Merge Robot ff9d1c1309
Merge pull request #16978 from giuseppe/fix-race-condition-podman-rm-stopping
libpod: fix race condition rm'ing stopping containers
2023-01-04 07:14:33 -05:00
Giuseppe Scrivano 6886e80b45
libpod: fix race condition rm'ing stopping containers
do not allow removing containers that are in the stopping state,
otherwise it can lead to a race condition where a "podman rm" removes
the container from the storage while another process is stopping the
same container.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-01-04 08:53:19 +01:00
Toshiki Sonoda fb73121c4c e2e: fix run_volume_test
When SELinux is running in enforcing mode,
this test needs to add an suffix :Z to the volume mount.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-04 15:34:37 +09:00
OpenShift Merge Robot b2da34e57d
Merge pull request #16980 from vrothberg/fix-kube
kube play: fix the error logic with --quiet
2023-01-03 14:04:04 -05:00
OpenShift Merge Robot f2881afd21
Merge pull request #16926 from odra/quadlet-lint
Quadlet -dryrun arg
2023-01-03 14:00:59 -05:00
Jake Correnti df02cb51ee Add container error message to ContainerState
This change aims to store an error message to the ContainerState struct
with the last known error from the Start, StartAndAttach, and Stop OCI
Runtime functions.

The goal was to act in accordance with Docker's behavior.

Fixes: #13729

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-01-03 13:21:24 -05:00
OpenShift Merge Robot 28d04bc524
Merge pull request #16934 from SamirPS/fix-volume
Fix: List container with volume filter
2023-01-03 12:33:19 -05:00
Valentin Rothberg 03c7f47aa8 kube play: fix the error logic with --quiet
Fix a bug where kube play would print format errors such as
`Error: %!s(<nil>)`.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-03 17:39:03 +01:00
Ygal Blum 9f0a37cd47 System tests: quadlet network test
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-03 17:25:58 +02:00
OpenShift Merge Robot a4edd0d310
Merge pull request #16971 from ygalblum/quadlet-network-depend
Quadlet Network - Fix the name of the required network service
2023-01-03 10:17:25 -05:00
OpenShift Merge Robot 66ec8aa5d4
Merge pull request #16962 from jakecorrenti/update-pids-limit
Fixed `podman update --pids-limit`
2023-01-03 10:14:52 -05:00
SamirPS e479644177 Fix: List container with volume filter
Modify the condition in line 149 in order to list container by mounting
point.
Closes #16019

Signed-off-by: SamirPS <akariohsamir@yahoo.com>
2023-01-03 15:56:29 +01:00
OpenShift Merge Robot 2dd9e0859c
Merge pull request #16947 from ygalblum/kube-service-container-logdriver
Kube Play: use passthrough as the default log-driver if service-container is set
2023-01-03 09:28:00 -05:00
OpenShift Merge Robot 535d4d4779
Merge pull request #16887 from cdoern/subpath
Add support for hostPath and configMap subpath usage
2023-01-03 09:05:11 -05:00
OpenShift Merge Robot 74e8654681
Merge pull request #16953 from ygalblum/quadlet-container-env
Quadlet Container: Add support for EnvironmentFile and EnvironmentHost
2023-01-03 09:02:22 -05:00
OpenShift Merge Robot 864288b8da
Merge pull request #16970 from ygalblum/system-test-quadlet-volume-depend
System Test Quadlet - Volume dependency test did not test the dependency
2023-01-03 07:50:16 -05:00
Leonardo Rossetti cd3492304e
adding -dryrun flag
Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
2023-01-03 09:19:48 -03:00
OpenShift Merge Robot d070d5f725
Merge pull request #16963 from ygalblum/system-test-readme-hack
[CI:DOCS] Test README - point users to hack/bats
2023-01-03 07:14:42 -05:00
Ygal Blum 347d5372e1 Quadlet Container: Add support for EnvironmentFile and EnvironmentHost
Add the new keys to the supported keys list for the Container group
Pass the list of EnvironmentFile values while maintaining the order
Quadlet e2e test framework: Add support for checking regex in Podman args
Add relevant tests
Update man

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-03 13:14:31 +02:00
OpenShift Merge Robot e332a244e3
Merge pull request #16974 from edsantiago/bats_cleanup
[minor] System tests: add missing cleanup
2023-01-03 04:52:28 -05:00
OpenShift Merge Robot 4c2151698e
Merge pull request #16972 from edsantiago/fix_unquoted_glob
System tests: fix unquoted question marks
2023-01-03 04:49:57 -05:00
OpenShift Merge Robot ee01ae1079
Merge pull request #16814 from edsantiago/build-systemd-testimage
Build and use a newer systemd image
2023-01-03 04:47:20 -05:00
Ygal Blum 68fbebfacc Kube Play: use passthrough as the default log-driver if service-container is set
Reasoning
---------
When the log-driver is passthrough, the journal socket is passed to the containers as-is which has two advantages:
1. journald can see who the actual sender of the log event is,
    rather than thinking everything comes from the conmon process
2. conmon will not have to copy all the log data

Code Changes
------------
If log-driver was not set by the user and service-container is set use
passthrough as the default log-driver

Update the system tests
- explicitly set logdriver in sdnotify and play tests
- podman-kube template test:  Verify the default log driver for service-container

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-03 10:34:24 +02:00
Ed Santiago 635c008405 System tests: add missing cleanup
New tests got added since I've been on PTO. Some of those tests
weren't doing cleanup, resulting in nasty red logs. Fix.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-02 14:19:48 -07:00
Ed Santiago 8e77f4c993 System tests: fix unquoted question marks
In 'run_podman ? ...', the question mark will _usually_ be
interpreted as a literal question mark, meaning "ignore
exit status". But if there are one or more single-character
filenames in the working directory, such as droppings from
a command such as 'my-test-command > a', Very Bad Things
will happen: the test will fail with an incomprehensible
error message. Prevent that.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-02 14:13:47 -07:00
OpenShift Merge Robot ecbb52cb47
Merge pull request #16929 from vrothberg/fix-16916
fix `podman system connection - tcp` flake
2023-01-02 16:12:15 -05:00
Ed Santiago 16b595c32c Build and use a newer systemd image
...based on f37, not f31. And make it fedora-minimal so it's
smaller. And clean up dnf so it's even smaller. And tag it
with our proper YMD tag, and commit the script that builds it.

This broke the system-df tests. In the process of resolving
that, I found those tests a little lacking. So, improve their
coverage a little bit.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-02 13:26:46 -07:00
Ygal Blum a061d793df Quadlet Network - Fix the name of the required network service
The name of the network service does not start with systemd only the
podman network name

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-02 14:55:56 +02:00
Ygal Blum 3ebb822e21 System Test Quadlet - Volume dependency test did not test the dependency
Make sure the Container unit correctly references the volume
Start the Container service and not the Volume one
Remove the volume
Print the name of the service when status does not match

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-02 14:31:42 +02:00
OpenShift Merge Robot fa7042f12f
Merge pull request #16946 from sstosh/fix-e2e
e2e: fix containers_conf_test
2023-01-02 05:10:50 -05:00
OpenShift Merge Robot 94c9251864
Merge pull request #16810 from flouthoc/trim-path-correctly
podman-remote,bindings: trim context path correctly when its `emptydir`
2023-01-02 05:07:31 -05:00
Valentin Rothberg a741299efc fix `podman system connection - tcp` flake
The test was only waiting for the port to be ready but that doesn't
imply the server being ready to serve requests.  Hence, add a loop
waiting for the `info` call to succeed.

Fixes: #16916
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-02 10:22:06 +01:00
Ygal Blum 18b21b89c8 Test README - point users to hack/bats
Let users know they can use hack/bats to control the system tests they
are running

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-01 08:37:03 +02:00
Ygal Blum 2000c4c80e System test: quadlet kube basic test
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-01 08:20:52 +02:00
Jake Correnti 479052afa6 Fixed `podman update --pids-limit`
Added the functionality for a user to update the PIDs limit for a
container.

Fixes: #16543

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2022-12-31 18:42:47 -05:00
Aditya R 553df8748b
podman-remote,bindings: trim context path correctly when its emptydir
podman-remote converts and sends absolute path as context when its an
emptydir by adding additional seperator however it should correctly trim
the path and not add additional seperator for such use cases.

Closes: BZ#2145054

Signed-off-by: Aditya R <arajan@redhat.com>
2022-12-30 20:38:54 +05:30
Toshiki Sonoda 200f86edea e2e: fix containers_conf_test
Prevents overwriting of TMPDIR environment.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-12-27 18:20:42 +09:00
Daniel J Walsh 0c94f61852
Allow '/' to prefix container names to match Docker
Fixes: https://github.com/containers/podman/issues/16663

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-26 07:37:43 -05:00
OpenShift Merge Robot 4a57cfb926
Merge pull request #16545 from rhatdan/read-only
Add containers.conf read-only flag support
2022-12-25 07:56:23 -05:00
OpenShift Merge Robot e000f8509f
Merge pull request #16907 from vrothberg/refactor
infra/abi: refactor ContainerRm
2022-12-23 05:18:13 -05:00
OpenShift Merge Robot 9fbf91801d
Merge pull request #16904 from rhatdan/system
Output Size and Reclaimable in human form for json output
2022-12-22 13:49:17 -05:00
Daniel J Walsh 338b283935
Add containers.conf read-only flag support
If you are running temporary containers within podman play kube
we should really be running these in read-only mode. For automotive
they plan on running all of their containers in read-only temporal
mode. Adding this option guarantees that the container image is not
being modified during the running of the container.

The containers can only write to tmpfs mounted directories.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-22 11:57:28 -05:00
Valentin Rothberg 45b180c1f8 events: support "die" filter
Map "die" to the "died" status for Docker compat.

Fixes: #16857
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-22 10:59:40 +01:00
OpenShift Merge Robot 0a34a4f645
Merge pull request #16794 from karta0807913/main
podman play kube support container startup probe
2022-12-21 15:52:50 -05:00
OpenShift Merge Robot 7400887744
Merge pull request #16911 from rhatdan/test
New system tests for conflicting options
2022-12-21 13:19:15 -05:00
Valentin Rothberg 1e84e1a8db infra/abi: refactor ContainerRm
The function grew into a big hairy ball over time and I personally
refrained from touching it as it seemed fragile.  Hence, refactor
the function into something more comprehensible and maintainable.
There is still potential for improvement but I want to tackle one
thing at a time.

[NO NEW TESTS NEEDED] as it shouldn't change behavior.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-21 13:05:25 +01:00
Alexander Larsson 0179aa2451 quadlet: Support Type=oneshot container files
These just run once and are considered successful at exist. Not much is
needed to support it, but we have to avoid overwriting the type
with Type=notify.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-21 12:49:50 +01:00
Ed Santiago 97f9d625a9
New system tests for conflicting options
...make sure podman rejects being called with incompatible options

Replaces: https://github.com/containers/podman/pull/16813

Which is stuck in CI and Ed is on break.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-21 06:23:29 -05:00
OpenShift Merge Robot 90ba443472
Merge pull request #16893 from alexlarsson/quadlet-better-default-handling
quadlet: Handle booleans that have defaults better
2022-12-21 06:23:12 -05:00
Daniel J Walsh 24b1e81c5d
Output Size and Reclaimable in human form for json output
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-20 17:11:21 -05:00
OpenShift Merge Robot aecb5d3853
Merge pull request #16900 from Luap99/gingkolinter
ginkgo tests: apply ginkgolinter fixes
2022-12-20 13:30:05 -05:00
Paul Holzinger 8e05caef6c
ginkgo tests: apply ginkgolinter fixes
New fixes since my last commit 2ddf1c5cbd.

https://github.com/nunnatsa/ginkgolinter

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-20 16:47:17 +01:00
Charlie Doern 3e48d74c83 Add support for hostPath and configMap subpath usage
podman play kube now supports and has tests for the subpath field when using a hostPath volume type and a configMap volume type.
The hostpath works similarly to the named volume, allowing a user to specify a whole directory but also a specific file or subdir within that mount. Config Maps operate the same way but specifically allow users to mount specific data in a subpath alongside the existing data

resolves #16828

Signed-off-by: Charlie Doern <cbddoern@gmail.com>
2022-12-20 10:41:08 -05:00
Paul Holzinger 3ac5d10098
export: use io.Writer instead of file
This allows use to use STDOUT directly without having to call open
again, also this makes the export API endpoint much more performant
since it no longer needs to copy to a temp file.
I noticed that there was no export API test so I added one.

And lastly opening /dev/stdout will not work on windows.

Fixes #16870

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-20 14:38:41 +01:00
Alexander Larsson 0cf36684c6 quadlet: Handle booleans that have defaults better
The ReadOnly and the RunInit keys affect options that have a variable
default (configurable in containers.conf). This means we need to
handle them a bit differently in quadlet to allow overriding the
default. For example, we can't assume ReadOnly=false doesn't need to
add any argument because no argument may mean readonly=true if the default
is changed.

We now don't add any argument (leaving the default) if the key is not specified,
or we always add an argument (--foo or --foo=false) if the key is specified (overriding whatever the default is).

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-20 11:00:48 +01:00
Daniel J Walsh 80de850817
Stop recording annotations set to false
False is the assumed value, and inspect and podman generate kube are
being cluttered with a ton of annotations that indicate nothing.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-19 16:07:33 -05:00
OpenShift Merge Robot fb967aabc3
Merge pull request #16878 from rhatdan/docs
Unify --noheading and -n to be consistent on all commands
2022-12-19 15:08:02 -05:00
OpenShift Merge Robot b0acb59ccb
Merge pull request #16688 from ygalblum/quadlet_network_file
Quadlet: add network support
2022-12-19 14:16:53 -05:00
Daniel J Walsh 9187df5b28
Unify --noheading and -n to be consistent on all commands
Helps with https://github.com/containers/podman/issues/16536

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-19 13:18:43 -05:00
OpenShift Merge Robot aeb36e5dad
Merge pull request #16825 from alexlarsson/quadlet-system-test
Quadlet system test
2022-12-18 07:16:50 -05:00
Ygal Blum d974a79e27 Quadlet: add network support
Support .network file to create a systemd service that runs podman network create
Support networks with .network suffix in Container and Kube to link with Quadlet created networks
Add E2E Tests
Add man doc

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-12-18 11:25:20 +02:00
Liang Chu-Xuan 070b69205c Add comment for jsonMarshal command
* also, change makeHealthCheck to the standard test command structure

Signed-off-by: Liang Chu-Xuan <karta0807913@gmail.com>
2022-12-17 02:44:45 +00:00
Nalin Dahyabhai d1496afb54 Always allow pushing from containers-storage
Override the signature policy to always allow pushing images from local
storage, even if the default policy is set up to always disallow reading
images from any location.

Pay attention to the --signature-policy option in `podman push`, so that
we can test this properly.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-12-16 14:59:00 -05:00
OpenShift Merge Robot 12d5e6ab82
Merge pull request #16858 from Luap99/attach-log
libpod: fix header length in http attach with logs
2022-12-16 14:19:00 -05:00
OpenShift Merge Robot f21c64019f
Merge pull request #16800 from Luap99/restore-static-ip
checkpoint restore: fix --ignore-static-ip/mac
2022-12-16 11:03:40 -05:00
Alexander Larsson 80878f20bc Add initial system tests for quadlets
This adds basic container and volume system tests for quadlet. These
install and run actual systemd units and ensure they work.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-16 15:35:51 +01:00
Paul Holzinger 1424f0958f
libpod: fix header length in http attach with logs
When we read logs there can be full or partial lines, when it is full we
need to append a newline, thus the message length must be incremented by
one.

Fixes #16856

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-16 14:18:30 +01:00
OpenShift Merge Robot d6c2fa6452
Merge pull request #16781 from matejvasek/fix-event-reading-size
fix: event read from syslog when syslog entry too long
2022-12-16 07:30:37 -05:00
OpenShift Merge Robot ecc095df8b
Merge pull request #16853 from vrothberg/wait-ignore
wait: add --ignore option
2022-12-16 07:22:29 -05:00
OpenShift Merge Robot 3219650fab
Merge pull request #16862 from alexlarsson/quadlet-podman-binary-name
Quadlet handle podman binary name better
2022-12-16 07:00:38 -05:00
Valentin Rothberg f4d0496b54 wait: add --ignore option
In the recent past, I met the frequent need to wait for a container to
exist that, at the same time, may get removed (e.g., system tests in [1]).

Add an `--ignore` option to podman-wait which will ignore errors when a
specified container is missing and mark its exit code as -1.  Also
remove ID fields from the WaitReport.  It is actually not used by
callers and removing it makes the code simpler and faster.

Once merged, we can go over the tests and simplify them.

[1] github.com/containers/podman/pull/16852

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-16 10:24:29 +01:00
OpenShift Merge Robot 18f1a8046b
Merge pull request #16733 from rhatdan/caps
Vendor in latest containers/common with default capabilities
2022-12-16 03:58:06 -05:00
Alexander Larsson 461726a3fa qudlet: Respect $PODMAN env var for podman binary
This changes the podman binary name embedded in the generated files.
This is primarily needed for testing podman.

This also adds a -X config for BINDIR so that we pick up the right
install target. This required tweaking some tests to handle the default
bindir not being /usr/bin.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-16 09:47:49 +01:00
Alexander Larsson a4a647c0b9 e2e: Add assert-key-is-regex check to quadlet e2e testsuite
We will use this later

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-16 09:47:49 +01:00
Alexander Larsson 84f3ad3560 e2e: Add some assert to quadlet test to make sure testcases are sane
This just checks the expected number of arguments.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-16 09:47:33 +01:00
OpenShift Merge Robot 536d3b87f0
Merge pull request #16818 from SoMuchForSubtlety/api-port-bindings
api: remove unmapped ports from PortBindings
2022-12-15 20:19:53 -05:00
Jakob Ahrer 97f63da67d
remove unmapped ports from inspect port bindings
Signed-off-by: Jakob Ahrer <jakob@ahrer.dev>
2022-12-15 23:18:50 +01:00
OpenShift Merge Robot 494f983e63
Merge pull request #16790 from giuseppe/cli-handler
rootless: add cli validator
2022-12-15 14:42:53 -05:00
Daniel J Walsh 3718ac8e96
Vendor in latest containers/common with default capabilities
Also update vendor of containers/storage and image

Cleanup display of added/dropped capabilties as well

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-15 14:28:30 -05:00
OpenShift Merge Robot 1cc22631f6
Merge pull request #16773 from ygalblum/network_ignore
Network Create: Add --ignore flag to support idempotent script
2022-12-15 14:27:25 -05:00
Giuseppe Scrivano 290019c486
rootless: add cli validator
whenever the podman process is launched, it runs any file found in
these directories:

- /etc/containers/auth-scripts
- /usr/libexec/podman/auth-scripts

The current podman command line is passed as arguments to the
process.

If any of the processes fail, the error is immediately reported back
from podman that exits with the same error code.

[NO NEW TESTS NEEDED] requires a system-wide configuration.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-12-15 18:31:16 +01:00
Valentin Rothberg dcbf7b4481 bump golangci-lint to v1.50.1
Also fix a number of duplicate words.  Yet disable the new `dupword`
linter as it displays too many false positives.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-15 13:39:56 +01:00
Ygal Blum bddd3f5b5f Network Create: Add --ignore flag to support idempotent script
Add --ignore flag to the command line
Add a new parameter to the NetworkCreate interface in pkg/domain for CreateOptions
Add a new API Network CreateWithOptions in pkg/bindings
Remote API - Add a query parameter to set the ignore flag
Kube - use the IgnoreIfExists flag when creating the default network instead of handling the failure
Add e2e tests
Update man page for podman-network-create

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-12-15 10:58:54 +02:00
Daniel J Walsh 4a5581ce0d
stop reporting errors removing containers that don't exist
Init containers are removed once they exit, but podman
reports and error that the container does not exist, when
it was previously removed.  Stop reporting missing containers
when removing.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-14 14:09:56 -05:00
OpenShift Merge Robot 2a48296b0b
Merge pull request #16826 from alexlarsson/quadlet-more-defaults
quadlet: Default VolatileTmp to off
2022-12-14 10:35:41 -05:00
Matej Vasek 80405a2a5f test: added test from wait endpoint with to long label
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-12-14 16:28:11 +01:00
OpenShift Merge Robot 415a702bc3
Merge pull request #16799 from rhatdan/build
Add podman buildx version support
2022-12-13 20:24:03 -05:00
Alexander Larsson fd92a68071 quadlet: Default VolatileTmp to off
This is another case where we're diverging from the defaults in
podman.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-13 14:58:48 +01:00
OpenShift Merge Robot 0037bffbb1
Merge pull request #16803 from cdoern/subpath
add support for subpath in play kube for named volumes
2022-12-12 12:37:59 -05:00
Paul Holzinger 45a40bf587
checkpoint restore: fix --ignore-static-ip/mac
With the 4.0 network rewrite I introduced a regression in 094e1d70de.
It only covered the case where a checkpoint is restored via --import.
The normal restore path was not covered since the static ip/mac are now
part in an extra db bucket. This commit fixes that by changing the config
in the db.

Note that there were no test for --ignore-static-ip/mac so I added a big
system test which should cover all cases (even the ones that already
work). This is not exactly pretty but I don't have to enough time to
come up with something better at the moment.

Fixes #16666

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-12 18:34:49 +01:00
Charlie Doern 95cc7e0527 add support for subpath in play kube for named volumes
subpath allows for only a subdirecty of a volumes data to be mounted in the container
add support for the named volume type sub path with others to follow.

resolves #12929

Signed-off-by: Charlie Doern <cbddoern@gmail.com>
2022-12-12 09:54:00 -05:00
OpenShift Merge Robot d8e23dfbed
Merge pull request #16549 from sstosh/remote-manifest-annotation
Add support for podman-remote manifest annotate
2022-12-12 09:29:06 -05:00
OpenShift Merge Robot 9ef2d9dcd9
Merge pull request #16530 from elezar/bump-golang
Bump golang version to 1.18
2022-12-12 08:28:51 -05:00
karta0807913 7bd1dbb756 podman play kube support container startup probe
* podman kube play support startup probe
* make probe use json string array instead of CMD-SHELL

Signed-off-by: Liang Chu-Xuan <karta0807913@gmail.com>
2022-12-10 09:07:45 +08:00
Daniel J Walsh 43e307b84f
Add podman buildx version support
Fixes: https://github.com/containers/podman/issues/16793

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-09 12:03:22 -05:00
OpenShift Merge Robot 859f40a2eb
Merge pull request #16776 from Luap99/http-proxy
remote: allow --http-proxy for remote clients
2022-12-09 05:23:38 -05:00
OpenShift Merge Robot 7d2a19ce67
Merge pull request #16631 from andrei-n-cosma/fix-secret-unmarshal
Fixes secret marshaling for kube play. Merge stringData with data for secrets.
2022-12-09 04:48:42 -05:00
OpenShift Merge Robot 15fca66e78
Merge pull request #16777 from Luap99/build-remote-volume
podman-remote build add --volume support
2022-12-09 04:32:57 -05:00
Paul Holzinger 9f6cf50d52
podman-remote build add --volume support
Just like podman-remote run users should still be able to set volumes,
of course the source must be on the server machine but this is already
the case for podman machine for example.

Fixes #16694

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-08 17:10:46 +01:00
Paul Holzinger 2dde30b93a
remote: allow --http-proxy for remote clients
The remote client should be allowed to specify if the container should
be run with the proxy env vars. It will still use the proxy vars from
the server process and not the client. This makes podman-remote more
consistent with the local version and easier to use in environments
where a proxy is required.

Fixes #16520

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-08 17:08:37 +01:00
Urvashi Mohnani 2f29639bd3 Cleanup kube play workloads if error happens
If an error happening while playing a kube yaml,
clean up any pods, containers, and volumes that might
have been created before the error was hit.
This improves the user experience for when they go to
re-run the same yaml with their fixes and podman doesn't
complain about any existing workloads from the previously
failed run.

Suppress the clean up output when clean up happens after an
error as the user doesn't need to see or know about that.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-12-08 10:30:44 -05:00
Andrei Natanael Cosma db4d018711
Fixes secret (un)marshaling for kube play.
Fixes e2e tests, remove '\n' from base64 encoded data.
Correct test to check that data in secret mounted file is decoded.

Closes #16269
Closes #16625

Signed-off-by: Andrei Natanael Cosma <andrei@intersect.ro>
2022-12-08 10:33:44 +01:00
OpenShift Merge Robot 6e2e9ab227
Merge pull request #16709 from vrothberg/fix-16515
kube sdnotify: run proxies for the lifespan of the service
2022-12-07 18:10:31 -05:00
OpenShift Merge Robot 4096d04123
Merge pull request #16569 from rst0git/run-checkpoint-image-v2
Add support for checkpoint images with 'podman run'
2022-12-07 11:39:37 -05:00
OpenShift Merge Robot 5b6a03fbab
Merge pull request #16763 from sstosh/e2e-http_proxy
e2e: keeps the http_proxy value
2022-12-07 09:30:08 -05:00
dependabot[bot] 1bfaf51941
build(deps): bump golang.org/x/tools from 0.3.0 to 0.4.0 in /test/tools
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-07 12:09:43 +00:00
Valentin Rothberg 97c56eef6f [CI:DOCS] test/README.md: run tests with podman-remote
Drop a note on how to run single tests with the remote client.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-07 09:25:32 +01:00
Toshiki Sonoda 8b87665f23 e2e: keeps the http_proxy value
In a proxy environment, http_proxy needs to keep
the value to use a proxy.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-12-07 16:30:32 +09:00
OpenShift Merge Robot 7784f1d165
Merge pull request #16758 from Luap99/nv-ipam-none
test/e2e: enable "podman run with ipam none driver" for nv
2022-12-06 20:02:43 -05:00
OpenShift Merge Robot 1b62e9049e
Merge pull request #16684 from sstosh/e2e-proxy
e2e: fix e2e tests in proxy environment
2022-12-06 19:57:10 -05:00
OpenShift Merge Robot 883ff665b2
Merge pull request #16748 from ygalblum/quadlet_kube_userns
Quadlet Kube: Add support for userns flag
2022-12-06 18:03:41 -05:00
OpenShift Merge Robot 2e9eb170c6
Merge pull request #16668 from karta0807913/main
fix an override logic in Inherit function
2022-12-06 17:58:31 -05:00
Paul Holzinger c7b936a415
test/e2e: enable "podman run with ipam none driver" for nv
This should work since nv v1.1.

Fixes #13931

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-06 18:25:34 +01:00
OpenShift Merge Robot 7cdf37624e
Merge pull request #16747 from Luap99/ipvlan-parent
network create: support "-o parent=XXX" for ipvlan
2022-12-06 10:54:11 -05:00
OpenShift Merge Robot 4a8d953425
Merge pull request #16371 from alexlarsson/transient-store
Support transient store mode
2022-12-06 09:39:19 -05:00
OpenShift Merge Robot 293f1cd14d
Merge pull request #16713 from alexlarsson/quadlet-drop-cid-remove
quadlet: Drop ExecStartPre=rm %t/%N.cid
2022-12-06 09:00:57 -05:00
Valentin Rothberg 4fa307f149 kube sdnotify: run proxies for the lifespan of the service
As outlined in #16076, a subsequent BARRIER *may* follow the READY
message sent by a container.  To correctly imitate the behavior of
systemd's NOTIFY_SOCKET, the notify proxies span up by `kube play` must
hence process messages for the entirety of the workload.

We know that the workload is done and that all containers and pods have
exited when the service container exits.  Hence, all proxies are closed
at that time.

The above changes imply that Podman runs for the entirety of the
workload and will henceforth act as the MAINPID when running inside of
systemd.  Prior to this change, the service container acted as the
MAINPID which is now not possible anymore; Podman would be killed
immediately on exit of the service container and could not clean up.

The kube template now correctly transitions to in-active instead of
failed in systemd.

Fixes: #16076
Fixes: #16515
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-06 14:15:11 +01:00
Toshiki Sonoda 86f4bd4f54 e2e: fix e2e tests in proxy environment
- podman generate kube inheritents the proxy environment valiable by default.
  Therefore, Env field is not empty if it is set.

- systemd-socket-acrivate needs to pass an proxy environment variable.

- busybox wget with an proxy doesn't work.
  Network tests should use not wget but curl.
  https://gitlab.alpinelinux.org/alpine/aports/-/issues/10446

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-12-06 11:14:19 +09:00
Ygal Blum 1ea00ebda1 Quadlet Kube: Add support for userns flag
Move the handling of userns keys from ConvertContainer to a separate method
Adjust the method according to the different supported values
Use the new method in both ConvertContainer and ConvertKube
Pass isUser to ConvertKube as well
Add tests

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-12-05 21:26:23 +02:00
OpenShift Merge Robot 68e51834a9
Merge pull request #16738 from ygalblum/quadlet_kube_relative_path
Quadlet Kube: Add support for relative path for YAML file
2022-12-05 14:21:10 -05:00
OpenShift Merge Robot 2f2df58fc9
Merge pull request #16745 from Luap99/docker-compose-mac
compat API: allow MacAddress on container config
2022-12-05 13:57:53 -05:00
OpenShift Merge Robot c942f77887
Merge pull request #16581 from mtrmac/modified-test
Update c/storage after https://github.com/containers/storage/pull/1436
2022-12-05 13:16:57 -05:00
Alexander Larsson 93d2ec148c Add podman system prune --external
This just calls GC on the local storage, which will remove any leftover
directories from previous containers that are not in the podman db anymore.
This is useful primarily for transient store mode, but can also help in
the case of an unclean shutdown.

Also adds some e2e test to ensure prune --external works.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-05 18:09:21 +01:00
Alexander Larsson f1dbfda807 Add some tests for transient store
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-05 18:09:21 +01:00
Paul Holzinger c9961e18c0
network create: support "-o parent=XXX" for ipvlan
Just like macvlan the ipvlan driver accepts a specific parent interface.

Fixes #16621

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-05 18:02:46 +01:00
Paul Holzinger 2f5025a2d7
compat API: allow MacAddress on container config
docker-compose sets the mac address in the container config and not the
network endpoint config. This is ugly when you have more than one
network, in this case docker just chooses the first network.

Fixes #16411

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-05 16:52:36 +01:00
Ygal Blum a55413c802 Quadlet Kube: Add support for relative path for YAML file
If the provided path is relative, turn path to absolute
Add regex verification option in tests

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-12-05 16:08:50 +02:00
Valentin Rothberg 8c3af71862 notify k8s system test: move sending message into exec
The flake in #16076 is likely related to the notify message not being
delivered/read correctly.  Move sending the message into an exec session
such that flakes will reveal an error message.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-12-05 14:32:06 +01:00
Giuseppe Scrivano a651cdfbc3
runtime: do not chown idmapped volumes
do not chown a volume when idmap is used.

Closes: https://github.com/containers/podman/issues/16724

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-12-05 14:10:43 +01:00
OpenShift Merge Robot a9c1fe2f4c
Merge pull request #16731 from ygalblum/quadlet_syslogidentifier
Quadlet Kube: Set SyslogIdentifier if was not set
2022-12-05 04:46:40 -05:00
Alexander Larsson f3c5b0f9d1 quadlet: Drop ExecStartPre=rm %t/%N.cid
Since https://github.com/containers/podman/pull/16394 was merged
we now always delete the cid file if --replace=true was specified,
so we can avoid this extra command being launched.

[NO NEW TESTS NEEDED] Already tested in above PR.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-05 08:26:03 +01:00
Ygal Blum d61618ad44 Quadlet Kube: Set SyslogIdentifier if was not set
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-12-04 15:53:44 +02:00
Daniel J Walsh af86b4f62a
Fix handling of readonly containers when defined in kube.yaml
The containers should be able to write to tmpfs mounted directories.

Also cleanup output of podman kube generate to not show default values.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-03 07:05:58 -05:00
Alexander Larsson 16cf34dc3a quadlet: Use same default capability set as podman run
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-02 16:37:22 +01:00
Alexander Larsson b34ab8b5fa quadlet: Drop --pull=never
This is to match podman run default behaviour.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-02 16:33:09 +01:00
Alexander Larsson 098ad52ecb quadlet: Change default of ReadOnly to no
This matches the default podman run behaviour.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-02 16:30:15 +01:00
Alexander Larsson 1c3fddfaf7 quadlet: Change RunInit default to no
This matches the default of podman run.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-02 16:25:47 +01:00
Alexander Larsson d19ea6a60d quadlet: Change NoNewPrivileges default to false
This matches the default of podman run.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-02 16:24:47 +01:00
Radostin Stoyanov a93a390b8c test: podman run with checkpoint image
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-12-02 14:39:33 +00:00
Radostin Stoyanov 3a362462c1 test: Add tests for checkpoint images
These tests were unintentionally removed in commit
b47b48f (Revert "Add checkpoint image tests"). They
verify the functionality of the `--create-image` option for
`podman container checkpoint`.

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-12-02 14:34:59 +00:00
Miloslav Trmač c83efd0f07 Update c/storage after https://github.com/containers/storage/pull/1436
... and update to remove the now-deprecated Locker interface.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-12-01 16:05:13 +01:00
karta0807913 d19e1526d3 add friendly comment
Signed-off-by: karta0807913 <karta0807913@gmail.com>
2022-12-01 11:35:51 +08:00
karta0807913 1d84f0adb9 fix an overriding logic and load config problem
Fix an overriding logic in Inhearit function.
Alos, ToSpecGen function doesn't load the cgroup/image volume config from containers.conf.

Signed-off-by: karta0807913 <karta0807913@gmail.com>
2022-12-01 08:01:02 +08:00
OpenShift Merge Robot c00d8a27d9
Merge pull request #13909 from mheon/startup_probe
Add support for startup healthchecks
2022-11-30 15:23:15 -05:00
Valentin Rothberg 71f92d263c container create: add inspect data to event
When the new `events_container_create_inspect_data` option is enabled in
containers.conf set the `ContainersInspectData` event field for each
container-create event.

The data was requested for the purpose of auditing (e.g., intrusion
detection).

Jira: https://issues.redhat.com/browse/RUN-1702
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-29 10:40:24 +01:00
Daniel J Walsh f17479c711
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-28 15:13:43 -05:00
Matthew Heon d16129330d Add support for startup healthchecks
Startup healthchecks are similar to K8S startup probes, in that
they are a separate check from the regular healthcheck that runs
before it. If the startup healthcheck fails repeatedly, the
associated container is restarted.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-11-28 13:30:29 -05:00
OpenShift Merge Robot 37563b9f12
Merge pull request #16637 from ygalblum/secret_volume
Kube Play: fix the handling of the optional field of SecretVolumeSource
2022-11-28 11:49:27 -05:00
Evan Lezar 3eeb50d48b Bump golang version to 1.18
Signed-off-by: Evan Lezar <elezar@nvidia.com>
2022-11-28 13:17:54 +01:00
Ygal Blum 9a6b701558 Kube Play: fix the handling of the optional field of SecretVolumeSource
If the secret exists, set optional in the KubeVolume to false to always use it
If the secret does not exist, if optional, set the same in the KubeVolume to skip it, otherwise fail

Add e2e tests

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-11-28 13:42:09 +02:00
OpenShift Merge Robot ab7f6095a1
Merge pull request #16580 from giuseppe/specgen-support-cdi-devices
specgen: support CDI devices from containers.conf
2022-11-28 06:36:33 -05:00
OpenShift Merge Robot c1db4f85ae
Merge pull request #16329 from gupttaru/encryption-decryption-feature
Add encryption decryption feature
2022-11-28 06:33:59 -05:00
OpenShift Merge Robot d5f806eb05
Merge pull request #16607 from vrothberg/BZ-2144754
container restart: clean up healthcheck state
2022-11-28 06:20:50 -05:00
Paul Holzinger 64a450c51a
test/tools: rebuild when files are changed
Add all go files as source to make sure we rebuild the tools when
required.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-11-25 14:42:26 +01:00
Paul Holzinger 2ddf1c5cbd
ginkgo tests: apply ginkgolinter fixes
I found the ginkgolinter[1] by accident, this looks for not optimal
matching and suggest how to do it better.

Overall these fixes seem to be all correct and they will give much
better error messages when something fails.
Check out the repo to see what the linter reports.

[1] https://github.com/nunnatsa/ginkgolinter

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-11-25 14:41:43 +01:00
Paul Holzinger c7827957a4
ginkgo: restructure install work flow
- move the ginkgo deps into test/tools which is more consitent with the
  other tools there, listing in dependencies always causes errors with
  linters
- do not install it globally on the system, instead we use it in a
  subdir of this project

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-11-25 14:41:43 +01:00
Giuseppe Scrivano 5d26628df6
specgen: support CDI devices from containers.conf
Closes: https://github.com/containers/podman/issues/16232

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-11-25 11:44:38 +01:00
gupttaru 3bb9ed4f09 Adding encryption decryption feature
Signed-off-by: Tarun1 Gupta <gupttaru@deshaw.com>
2022-11-24 04:53:59 -05:00
Valentin Rothberg e2fa94e8ac container restart: clean up healthcheck state
When restarting a container, clean up the healthcheck state by removing
the old log on disk.  Carrying over the old state can lead to various
issues, for instance, in a wrong failing streak and hence wrong
behaviour after the restart.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2144754
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-24 10:22:22 +01:00
Toshiki Sonoda a4ba5f449f Add support for podman-remote manifest annotate
Now that podman manifest annotate is supported
in the remote environment.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-11-24 14:11:08 +09:00
OpenShift Merge Robot 1b583a709b
Merge pull request #16563 from ygalblum/quadlet_k8s
Quadlet: Add support for running podman kube play via .kube files
2022-11-22 14:52:32 -05:00
OpenShift Merge Robot 1aa28b18c2
Merge pull request #16570 from edsantiago/systemtest_cleanup
ssh system test: skip until it becomes a test
2022-11-22 10:17:48 -05:00
Ygal Blum 3084ed4686 Quadlet: Add support for .kube files
Get the path to the yaml file and call podman kube play
Add tests

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-11-22 16:58:01 +02:00
OpenShift Merge Robot d202416302
Merge pull request #16571 from giuseppe/honor-userns-size
specgen: honor user namespace value
2022-11-22 05:43:46 -05:00
OpenShift Merge Robot b570b9d66f
Merge pull request #16574 from alexlarsson/quadlet-usermap
quadlet: Rework uid/gid remapping
2022-11-22 04:13:22 -05:00
Giuseppe Scrivano a891199b9a
specgen: honor user namespace value
honor eventual options set in the containers.userns setting in the
containers.conf file, e.g.:

[containers]
userns = "auto:size=8192"

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-11-21 21:27:22 +01:00
Alexander Larsson 285d6c9ba0 quadlet: Rework uid/gid remapping
Quadlet was doing some custom handling of uid/gid remapping, originating
from pre --userns=auto support, including its own user for getting subuids
which kinda conflicts with the "container" user used for that.

This drops all the old support for id remapping in favour of a new set
of keys that more directly map to the podman run options.

We have essentially 3 modes now:

```
RemapUsers=manual
RemapUid=0:10000:10
RemapUid=10:20000:10
RemapGid=0:10000:10
RemapGid=10:20000:10
```

This maps to --uidmap and --gidmap options.

```
RemapUsers=auto
```

This maps to --userns=auto. But you can additionally specify RemapUid,
RemapGid and RemapUidSize which gets applied as options to the
--userns podman option.

```
RemapUsers=keep-id
```
This maps to --userns=keep-id and only works for user units.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-11-21 18:02:19 +01:00
Ed Santiago 50d72bc639 ssh system test: skip until it becomes a test
The 900-ssh test is not an actual test, and I'm unable to
figure out how to make it one. Skip it for now, but add a
bunch of FIXMEs some someone can come in later and actually
implement it.

Also removed lots of dead code and misleading comments.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-21 08:02:00 -07:00
Ygal Blum dd4d212b0a E2E Tests: change the registry for the search test to avoid authentication
The current test uses registry.redhat.io which does not support unauthenticated access
Replace the registry with registry.access.redhat.com which does

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-11-21 10:34:52 +02:00
Erik Sjölund a1b32866cc Fix language. Mostly spelling a -> an
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-11-20 19:41:06 +01:00
OpenShift Merge Robot cea9340242
Merge pull request #16299 from alexlarsson/quadlet-shortname-warning
quadlet: Warn in generator if using short names
2022-11-18 20:01:39 +00:00
OpenShift Merge Robot d8fed62c96
Merge pull request #16439 from sstosh/proxy-tests
system tests: fix a system test in proxy environment
2022-11-18 00:51:30 +00:00
OpenShift Merge Robot 44a9014641
Merge pull request #16526 from cdoern/containerHost
fix port issues for CONTAINER_HOST
2022-11-17 17:47:12 +00:00
Charlie Doern 14ef6a91bd fix port issues for CONTAINER_HOST
if no port is specified for an ssh style url, default to 22

resolves #16509

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-11-16 11:01:30 -05:00
OpenShift Merge Robot 54b1fd35bd
Merge pull request #16518 from ashley-cui/noout
Fix podman --noout to suppress all output
2022-11-15 21:57:33 +00:00
OpenShift Merge Robot d1ac0dcd49
Merge pull request #16513 from vrothberg/fix-16502
remove pod if creation has failed
2022-11-15 21:54:57 +00:00
OpenShift Merge Robot 5502ddb3c5
Merge pull request #16506 from edsantiago/healthcheck_flake
healthcheck system tests: try to fix flake
2022-11-15 16:28:15 +00:00
Ed Santiago 58869dcc30 e2e tests: fix restart race
It's so easy to forget that "podman start" is nonblocking.
So podman create, start, restart has a race where "restart"
can run before the container actually starts.

Solution: start --attach. Thanks to @vrothberg for noticing that.

There are still a handful of other suspicious-looking restarts
in this test, but all involve "top" which of course has to be
detached. Since those don't have any flakes that I know of, I
choose to ignore them.

Fixes: #16505

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-15 07:44:52 -07:00
Ashley Cui 7c1ad8a582 Fix podman --noout to suppress all output
Podman --noout was not suppressing output from commands that do not
create the podman engine. Now, podman --noout properly suppresses output
from every command.

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

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-11-15 08:16:46 -05:00
OpenShift Merge Robot 6c37cf3324
Merge pull request #16380 from flouthoc/compat-build-fix
compat,build: handle `docker's` preconfigured `cacheTo`,`cacheFrom`
2022-11-15 12:44:50 +00:00
Valentin Rothberg 9610d4c7b4 remove pod if creation has failed
Make sure to remove the pod if its creation has failed.

Fixes: #16502
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-15 13:36:57 +01:00
Ed Santiago 21f6902ec3 Fix more podman-logs flakes
No issue filed, because I thought these were related to 16132.
They're not: they're actual test bugs, running "play kube"
without actually waiting for the container to run. Fix that.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-14 13:09:45 -07:00
Ed Santiago 1a839a96dc healthcheck system tests: try to fix flake
Weird one-off flake seen:

   # ... healthcheck run <containername>
   Error: container SHA is not running

The only way I can see this happening is if the healthcheck
auto-timer triggered, which seems impossible because that
should be 30s and the log timestamps show this test taking
18s. But, shrug, let's see if disabling the timer works. I
don't have high hopes that this will fix anything, but it's
probably a good idea regardless.

Also, since this test loops over different policies, include
policy name in error messages as a courtesy. (It's obtainable
anyway by scrolling up)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-14 12:33:34 -07:00
Aditya R c7073b5fc5
compat,build: handle docker's preconfigured cacheTo,cacheFrom
Docker's newer clients popuates `cacheFrom` and `cacheTo` parameter
by default as empty array for all commands but buildah's design of
distributed cache expects this to be a repo not image hence parse
only the first populated repo and igore if empty array.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-11-14 22:08:09 +05:30
OpenShift Merge Robot 94e34cc795
Merge pull request #16498 from vrothberg/fix-16421
podman cp: fix copying with "." suffix
2022-11-14 13:46:44 +00:00
OpenShift Merge Robot e656cf43fe
Merge pull request #16328 from cdoern/config
fix connection usage with containers.conf
2022-11-14 12:46:03 +00:00
Valentin Rothberg 3371c9d25e podman cp: fix copying with "." suffix
Fix a bug for special-casing "." where Podman has mistakenly been
looking for a "." suffix instead of interpreting it as a path.

Add regression tests for the host-to-container, container-to-host and
container-to-container use cases.  Have separate tests for each to
verify that previous Podman versions fail each case.

Fixes: #16421
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-14 09:38:02 +01:00
OpenShift Merge Robot 25c67d6b9b
Merge pull request #16462 from rhatdan/manifest
Add hidden podman manifest inspect -v option
2022-11-12 10:51:53 +00:00
Charlie Doern 69d737ef15 fix connection usage with containers.conf
--connection was failing due to the servicedestinations array being empty on runtime.
Fix by making sure the cached config is used

resolves #16282

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-11-11 16:15:02 -05:00
Daniel J Walsh 00b2bc9b65
Add hidden podman manifest inspect -v option
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-11 15:22:31 -05:00
Daniel J Walsh 836ca6c008
Add podman volume create -d short option for driver
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-11 14:43:07 -05:00
OpenShift Merge Robot c75b05996d
Merge pull request #16464 from rhatdan/events
Add podman system events alias to podman events
2022-11-11 19:23:27 +00:00
OpenShift Merge Robot 21122631e1
Merge pull request #16474 from containers/dependabot/go_modules/test/tools/golang.org/x/tools-0.3.0
Bump golang.org/x/tools from 0.1.12 to 0.3.0 in /test/tools
2022-11-11 18:05:15 +00:00
Daniel J Walsh bc77c034f8
Add podman system events alias to podman events
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-11 12:57:49 -05:00
Daniel J Walsh ae9a2d26df
Fix search_test to return correct version of alpine
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-11 12:57:49 -05:00
dependabot[bot] 75fdbea63d
Bump golang.org/x/tools from 0.1.12 to 0.3.0 in /test/tools
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.12 to 0.3.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.12...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-11 15:50:28 +00:00
Chris Evich 653ac775c7
Merge pull request #16466 from rhatdan/manifest1
Allow podman manifest push --purge|-p as alias for --rm
2022-11-11 10:50:06 -05:00
OpenShift Merge Robot 6555e69354
Merge pull request #16446 from Luap99/format-json
fix --format {{json .}} output to match docker
2022-11-11 15:48:58 +00:00
OpenShift Merge Robot 3bc236dca0
Merge pull request #16475 from Darth-Mera/restartsec-fix
Add restart-sec for container service files
2022-11-10 20:23:06 +00:00
OpenShift Merge Robot aaa88f4554
Merge pull request #16141 from sbrivio-rh/pasta
Add pasta networking mode
2022-11-10 17:44:38 +00:00
Veronika Fuxova a2c43d4340
Add restart-sec for container service files
Attempts to fix #16419

podman generate systemd --restart-sec pod
^now generates RestartSec= both in pod service file and in container service file.

podman generate systemd --restart-sec container
^now generates RestartSec= in container service file.

Signed-off-by: Veronika Fuxova <vfuxova@redhat.com>
2022-11-10 13:12:10 +01:00
Valentin Rothberg 4513fde805 test/tools: bump module to go 1.17
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-10 11:02:40 +01:00
dependabot[bot] 69ed903b20 build(deps): bump golang.org/x/tools from 0.1.12 to 0.2.0 in /test/tools
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.12 to 0.2.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.12...v0.2.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 10:24:59 +01:00
OpenShift Merge Robot e86cef13a1
Merge pull request #16004 from sstosh/remote-manifest-annotate
remote: fix manifest add --annotation
2022-11-10 09:02:10 +00:00
Daniel J Walsh d9aceadeaa
Allow podman manigest push --purge|-p as alias for --rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-09 16:17:38 -05:00
Paul Holzinger 3e08f85353
fix --format {{json .}} output to match docker
`--format json` should not be the same as `--format {{json .}}`, the
later should actually run through the go template and thus create one
json object per entry instead of an json array.

Includes a vendor of c/common@main since it requires a fix from there as
well.

This matches docker compat.
Fixes #16436

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-11-09 17:59:05 +01:00
Toshiki Sonoda f807b6784f remote: fix manifest add --annotation
* `manifest add --annotation option` adds annotations
  field on remote environment.
* `manifest inspect` prints annotations field
  on remote environment.

Fixes: #15952

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-11-09 13:24:09 +09:00
Hironori Shiina 314cba2590 Skip test if `--events-backend` is necessary with podman-remote
`podman-remote` does not support `--events-backend`, which overrides a
log driver. When `--events-backend` is necessary in a test for
`podman-remote`, the test should be skipped.

We don't need to fix the other cases with
`_additional_events_backend()` because `_log_test_follow()` already has
the same skipping logic and `_log_test_multi()` always skips a test when
testing `podman-remote`.

Signed-off-by: Hironori Shiina <shiina.hironori@fujitsu.com>
2022-11-08 16:10:30 -05:00
OpenShift Merge Robot d720440d78
Merge pull request #16420 from ygalblum/kube_volume_down
kube play: update the handling of PersistentVolumeClaim
2022-11-08 09:37:01 -05:00
Ygal Blum 1c8196a9ac kube play: update the handling of PersistentVolumeClaim
Up - do not fail if volume already exists, use the existing one
Down - allow the user to remove the volume by passing --force
Add tests
Update the documentation

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-11-08 11:08:50 +02:00
Toshiki Sonoda 616fca9ffd system tests: fix a system test in proxy environment
When we are using a proxy, 'podman build - basic test'
will be failed on remote.
This test needs to add the '--http-proxy' option.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-11-08 15:13:43 +09:00
Stefano Brivio cb8c9af5d3 test/system: Add, use tcp_port_probe() to check for listeners rather than binds
_test_skopeo_credential_sharing() used port_is_free() to check if a
port has no active listeners. With the new implementation, this is
not equivalent anymore: a port might be in TIME_WAIT, so it's not
free, but the listener might be long gone.

Add tcp_port_probe() to check if there's an active listener on a
given port, and use it in _test_skopeo_credential_sharing().

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-11-08 00:16:36 +01:00
Stefano Brivio 348c3f2833 test/system: Add tests for pasta(1) connectivity
These tests should cover all the basic networking functionality with
pasta(1). Namely, they check:

- IPv4 and IPv6 addressing and routing settings

- TCP and UDP port forwarding over IPv4 and IPv6

- data transfers and ICMP/ICMPv6 echo requests

- the (exceedingly simple) lifecycle handling

These tests need some new helpers, to obtain IPv4 and IPv4 addresses
and routes, as well as MTU and interface names. Those use jq(1) for
parsing.

Some availability checks are implemented as well, to skip tests if
pasta(1) is not available, or if IPv4 and IPv6 are not usable.

To get consistent outcomes across distributions, and to enable
uncomplicated termination for UDP tests based on zero-sized packets,
use socat(1), which, unlike netcat, doesn't suffer from option
inconsistencies depending on flavours (traditional, BSD, NMAP) and
versions.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-11-08 00:16:36 +01:00
Stefano Brivio b3cf836841 test/system: Move network-related helpers to helpers.network.bash
The main helpers.bash file is rather bloated and it's difficult to
find stuff there. Move networking functions to their own helper
file.

While at it, apply a consistent style, and rearrange logically
related functions into sections.

Suggested-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-11-08 00:16:36 +01:00
Stefano Brivio ea4f168b3a test/system: Use procfs to find bound ports, with optional address and protocol
Using bash /dev/tcp/ pseudo-device files to probe for bound ports has
indeed the advantage of simplicity, but comes with a few drawbacks:

- it will actually send data to unsuspecting services that might be
  running in the same network namespace as the tests, possibly
  causing unwanted interactions

- it doesn't allow for UDP probing

- it makes it impossible to clearly distinguish between different
  address bindings

Replace that approach with a new helper, port_is_bound(), that uses
procfs entries at /proc/net to detect bound ports, without the need
for active probing.

We can now implement optional parameters in callers, to check if a
port if free for binding to a given address, including any IPv4
(0.0.0.0) or any IPv6 (::0) address, and for a given protocol, TCP
or UDP.

Extend random_free_port() and random_free_port_range() to support
that.

The implementation of one function in the file
test/system/helpers.bash, namely ipv6_to_procfs(), and the
implementation of the corresponding own test, delimited by the
markers "# BEGIN ipv6_to_procfs" and "# END   ipv6_to_procfs" in the
file test/system/helpers.c was provided, on the public forum at:

  https://github.com/containers/podman/pull/16141

by Ed Santiago <santiago@redhat.com>, who expressly invited me to
include them in this code submission.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-11-08 00:16:35 +01:00
Stefano Brivio 7e3d04fbc6 test/system: Use port_is_free() from wait_for_port()
Currently, wait_for_port() duplicates the check logic implemented by
port_is_free().

Add an optional argument to port_is_free(), representing the bound
address to check, and call it, dropping the direct check in
wait_for_port().

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-11-08 00:16:35 +01:00
Ed Santiago 6dd508b8e0 More log-flake work
It looks like #16132 was my fault: a missing 'wait' for a container
to exit. Let's see if this fixes the flake.

And, while poking through flake logs, I found another missing wait.

And... in wait_for_output(), address a potential race.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-07 14:35:24 -07:00
OpenShift Merge Robot ec03579aa2
Merge pull request #16435 from edsantiago/fix_static_race
Fix test flakes caused by improper podman-logs
2022-11-07 14:39:50 -05:00
OpenShift Merge Robot 781ecec469
Merge pull request #16386 from bjorndown/feature/pod-create-with-netns
Allow namespace path network option for pods.
2022-11-07 14:29:24 -05:00
Ed Santiago 3ebcfdbbc6 Fix test flakes caused by improper podman-logs
This one has been a thorn in my side: it's a podman-log issue,
but not remote, so I _almost_ retitled #16132 (removing "remote").

Nope, it's a bug in the tests themselves. One solution would be to
podman-wait, but I see no reason for logs to be involved, so I
went with podman start -a instead. This removes the k8s-log stuff
which is no longer necessary. Cleanup all around.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-07 11:29:06 -07:00
OpenShift Merge Robot 9e04bab722
Merge pull request #16418 from jakegt1/main
Fix compat build API returning two JSON objects at once
2022-11-07 09:49:57 -05:00
Jake Torrance 85f4d37173 Make sure we can build and read each line of docker py's api client
Signed-off-by: Jake Torrance <jaket1234@hotmail.com>
2022-11-06 10:30:18 +00:00
OpenShift Merge Robot afc84151fc
Merge pull request #15591 from snprajwal/go-criu/v6
Upgrade go-criu to v6
2022-11-04 15:48:52 -04:00
OpenShift Merge Robot 5aa32e45ad
Merge pull request #16377 from giuseppe/add-check-for-valid-pod-systemd-cgroup
runtime: add check for valid pod systemd cgroup
2022-11-04 07:59:22 -04:00
Daniel J Walsh 017521c283
Merge pull request #16399 from Luap99/no-apk
test/e2e: do not use apk in builds
2022-11-04 06:50:19 -04:00
Björn Mosler 049a5d82f1 Allow namespace path network option for pods.
Closes #16208.

Signed-off-by: Björn Mosler <dev@bjoern.mosler.ch>
2022-11-04 11:26:06 +01:00
OpenShift Merge Robot 013bd81417
Merge pull request #16394 from vrothberg/fix-16387
remove container/pod id file along with container/pod
2022-11-04 05:22:57 -04:00
OpenShift Merge Robot 0702b4cf4c
Merge pull request #15359 from rhatdan/manifest
Add --insecure flag to podman manifest inspect for Docker compatibility
2022-11-04 05:14:46 -04:00
Paul Holzinger 4174901283
test/e2e: do not use apk in builds
As far as I can tell there is no reason to use apk in these tests. They
just build an image and check for it and never use the installed binary.
Network calls are always unstable and therefore should be avoided when
possible, this ensures no/less flakes.

Fixes #16391

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-11-03 17:32:49 +01:00
Valentin Rothberg 3fee351c35 remove container/pod id file along with container/pod
Remove the container/pod ID file along with the container/pod.  It's
primarily used in the context of systemd and are not useful nor needed
once a container/pod has ceased to exist.

Fixes: #16387
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-03 17:07:09 +01:00
Daniel J Walsh 274d0f4956
Add --insecure,--tls-verify,--verbose flags to podman manifest inspect
--insecure and --verbose flags for docker compatibility

--tls-verify for syntax compatibility and allow users to inspect
manifests at remote Container Registiries without requiring tls.

Helps fix: https://github.com/containers/podman/issues/14917

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-03 08:00:15 -04:00
Giuseppe Scrivano cac4919bf6
runtime: add check for valid pod systemd cgroup
there is already the same check when using cgroupfs, but not when
using the systemd cgroup backend.  The check is needed to avoid a
confusing error from the OCI runtime.

Closes: https://github.com/containers/podman/issues/16376

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-11-03 12:23:44 +01:00
Ed Santiago d7e70c7489 CI: set and verify DESIRED_NETWORK (netavark, cni)
We have CI tests running in netavark mode when CNI is desired.
Add a new .cirrus.yml envariable, CI_DESIRED_NETWORK, which
we then force-check in e2e and system tests. Simple copy/paste
of #14912 (the RUNTIME check) with manual s/RUNTIME/NETWORK/
and other minor changes.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-03 04:40:42 -06:00
OpenShift Merge Robot c35ed35081
Merge pull request #15091 from umohnani8/lift
Add podman kube apply command
2022-11-02 14:38:13 -04:00
OpenShift Merge Robot c772c00f6f
Merge pull request #16384 from edsantiago/budtests_remote
buildah bud tests: better handling of remote
2022-11-02 10:48:24 -04:00
Ed Santiago 56fae7dd0e buildah bud tests: better handling of remote
When I first enabled buildah-bud tests under podman-remote (#9887),
I got one aspect all wrong: I added a podman-remote() helper function
to match the podman() one. Turns out it's never actually called,
even when $PODMAN_BINARY=podman-remote, because functions/aliases
don't work that way.

The way it works is, those few cases in which bud.bats runs
podman are not magically remapped to podman-remote, they use
the podman() function. That's where we need to check if
we're using podman-remote, and that's where we need to
remove the registry-and-rootdir options.

With this fix, we can reenable two previously-skipped bud tests.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-02 05:59:40 -06:00
Alexander Larsson 7ec743fe74 quadlet: Warn in generator if using short names
These are both slow (trigger loading alias files) and risky (its not
clear which image you mean).

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-11-02 11:55:08 +01:00
Urvashi Mohnani f6c74324bc Add podman kube apply command
Add the abilitiy to deploy the generated kube yaml to a
kubernetes cluster with the podman kube apply command.
Add support to directly apply containers, pods, or volumes
by passing in their names or ids to the command.
Use the kubernetes API endpoints and http requests to connect
to the cluster and deploy the various kubernetes object kinds.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-11-01 15:30:17 -04:00
Ed Santiago d1f3dd9e5b docs: offer advice on installing test dependencies
Basically, acknowledge the need for dependencies and link
to Fedora specfile which is the only sane place to find
such a list.

Closes: #16365

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-01 12:46:14 -06:00
Prajwal S N b8e03ab44d
deps: bump go-criu to v6
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2022-11-01 13:57:24 +05:30
OpenShift Merge Robot aca9807d59
Merge pull request #16336 from rhatdan/VENDOR
Do not report that /usr/share/containers/storage.conf has been edited.
2022-10-31 09:42:08 -04:00
Daniel J Walsh 9003cdbf62
Do not report that /usr/share/containers/storage.conf has been edited.
Only want to report if user created local customized storage in
/etc/containers/storage.conf or in
$HOME/.config/containers/storage.conf, when resetting storage.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-10-29 11:24:56 -04:00
Daniel J Walsh 71f0c9f33a
Eval symlinks on XDG_RUNTIME_DIR
Partial Fix for https://github.com/containers/podman/issues/14606

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-10-28 14:32:39 -04:00
Daniel J Walsh 6fe64591d6
Update vendor containers/(common,storage,buildah,image)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-10-28 06:16:22 -04:00
OpenShift Merge Robot b057a6ade8
Merge pull request #16309 from edsantiago/remove_usr_bin_podman_in_tests
Test runners: nuke podman from $PATH before tests
2022-10-28 05:44:12 -04:00
OpenShift Merge Robot 0c38fc826d
Merge pull request #16322 from Luap99/remote-ginkgo
ginkgo testing: fix podman usernamespace join
2022-10-27 13:47:23 -04:00
Paul Holzinger d50a55233a
ginkgo testing: fix podman usernamespace join
When there is a podman pause process running the local podman ginkgo
tests will join the usernamespace. This because pkg/rootless will
automatically join the ns on startup when possible. To fix this we
need to use the remote build tag which disables that behavior.

However since the remote tag is also used in the e2e test itself we
would always run remote tests which is wrong, this is fixed by using a
new `remote_testing` tag for the test.

see discussion here: https://github.com/containers/podman/pull/16309#discussion_r1006166930

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-10-27 15:16:19 +02:00
Ed Santiago f0f12658de Test runners: nuke podman from $PATH before tests
We've had some oopsies in system tests:

    podman foo bar
    run podman foo bar

...all of which should be run_podman with underscore. Those
have been passing because /usr/bin/podman is the fallback
from $PATH. In those (few) cases, we haven't actually been
testing the podman we should be testing.

Solution: nuke /usr/bin/podman and podman-remote before
invoking system and unit tests. As an extra level of
paranoia, check for other podmans in $PATH - if any
exist, bail out with a fatal error.

Also: in a few cases where runner.sh invokes podman for
containerized something-something, run bin/podman instead
of podman from $PATH.

Also: fix existing dependencies on /usr/bin/podman

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-26 19:07:20 -06:00
Kristian Klausen 3e6637a3b0
volumes: Fix idmap not working for volumes
idmap is documented as supported for volumes, but it was not added to
the getNamedVolume() function.

Fixes: e83d36665 ("volumes: add new option idmap")
Signed-off-by: Kristian Klausen <kristian@klausen.dk>
2022-10-27 01:23:16 +02:00
OpenShift Merge Robot 47bcd10f61
Merge pull request #16243 from alexlarsson/volume-create-ignore
Add podman volume create --ignore
2022-10-26 15:00:51 -04:00
OpenShift Merge Robot 6dd0c83c6d
Merge pull request #16308 from edsantiago/fix_ubi8_b0rkage
FIXME: Temporary workaround for ubi8 CI breakage
2022-10-26 14:43:45 -04:00
Ed Santiago 237d41f3fb FIXME: Temporary workaround for ubi8 CI breakage
Emergency import of https://github.com/containers/buildah/pull/4377
required because the ubi8 image changed behind our backs.

On podman main, this commit will be reverted by Ed's
treadmill as soon as a new buildah is vendored into podman.

On side branches, the human doing the vendoring will need to
perform manual surgery. I hope the instructions are good enough.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-26 10:54:56 -06:00
Ed Santiago 11e4c04038 System tests: teardown: clean up volumes
One of the system tests was creating a volume and not cleaning up
after itself. Fix that: do cleanup in the test itself. And, add
a 'volume rm -af' to global teardown() to leave things clean for
the next tests.

Also, OOPS! Correct some instances of 'podman' in two system
tests to 'run_podman'. And remove an unused (misleading) variable.

And, one more: in auto-update test, unit file, use $PODMAN,
not /usr/bin/podman

UGH! Yet one more: found/fixed a 'run<space>podman'

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-26 09:56:58 -06:00
Ed Santiago fdc9ca076b system tests: runlabel: use podman-under-test
I have no idea what this usage means, but the test fails
on a system with no /usr/bin/podman ... and that suggests
to me that the test is broken, in that it's been using
/usr/bin/podman instead of the $PODMAN we're testing.

Solution: 'podman', not '/usr/bin/podman'. Per @Luap99,
podman will replace the string 'podman' with /proc/self/exe

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-26 05:35:10 -06:00
OpenShift Merge Robot 9062dede65
Merge pull request #16293 from edsantiago/random_port_in_network_create
system tests: podman network create: use random port
2022-10-26 07:18:59 -04:00
OpenShift Merge Robot ac8b401c48
Merge pull request #16237 from alexlarsson/quadlet-updates
Various quadlet updates
2022-10-26 04:05:40 -04:00
Ed Santiago 05bdc72941 system tests: podman network create: use random port
One test was using a hardcoded fixed port, with a comment
referring to #10806. That issue seems fixed, so let's
try switching to a pseudorandom open port.

Does not actually fix #16289 but I'm going to close that
anyway, will reopen if it recurs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-25 12:38:35 -06:00
OpenShift Merge Robot 589ff20aa3
Merge pull request #16287 from vrothberg/fix-16091
sig-proxy test: bump timeout
2022-10-25 10:18:43 -04:00
OpenShift Merge Robot 1c9c321d3c
Merge pull request #15979 from ygalblum/play_kube_volume_import
play kube: Allow the user to import the contents of a tar file into a volume
2022-10-25 10:05:45 -04:00
Valentin Rothberg f0ba2d89e8 sig-proxy test: bump timeout
Bump the timeout waiting for the container to process the signal.
The comparatively short timeout is most likely responsible for
flakes in gating tests.

Fixes: #16091
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-25 15:12:56 +02:00
Ygal Blum 0ce234425a play kube: Allow the user to import the contents of a tar file into a volume
Add a new annotation to allow the user to point to a local tar file
If the annotation is present, import the file's content into the volume
Add a flag to PlayKubeOptions to note remote requests
Fail when trying to import volume content in remote requests
Add the annotation to the documentation
Add an E2E test to the new annotation

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2022-10-25 15:11:25 +03:00
OpenShift Merge Robot 86f7b99924
Merge pull request #16273 from vrothberg/cidfile
container/pod id file: truncate instead of throwing an error
2022-10-25 07:32:55 -04:00
Alexander Larsson bac907abf8 Clarify the docs on DropCapability
It was a bit unclear what setting it to empty means.

Also, add to the tests verification that this works.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:10:18 +02:00
Alexander Larsson 33eb45c475 quadlet tests: Disable kmsg logging while testing
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:09:51 +02:00
Alexander Larsson 8716de2ac3 quadlet: Add support for Network=...
This just gets translated to --network=...

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:09:51 +02:00
Alexander Larsson 6042ca7fd0 quadlet: Add support for AddDevice=
This lets you add custom device nodes into the container

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:09:51 +02:00
Alexander Larsson f6f65f49db quadlet: Add support for setting seccomp profile
Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:09:48 +02:00
Alexander Larsson a9f0957c24 quadlet: Allow multiple elements on each Add/DropCaps line
You can still use multiple lines, but this is not necessary.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:09:22 +02:00
Alexander Larsson 2b0d9cd94b quadlet: Drop the SocketActivated key
This was added in the old quadlet to work around issues with podman
not passing on notify fds and pids. However, these are now fixed with:

https://github.com/containers/podman/pull/11316
https://github.com/openSUSE/catatonit/pull/15

So, remove this key (which was never in a podman release anyway)

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:08:55 +02:00
Alexander Larsson d7e248dcff quadlet: Switch log-driver to passthrough
This is much better for the systemd case becase we pass the journal
socket fds directly to the container. This means less copying of the
logs, but it also means the journal will correctly get the peer
process id when it tries to extract things like the name of what
is logging something.

With this we correctly name the logging process rather than claim
everything comes from conmon.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:08:24 +02:00
Alexander Larsson 998f834b04 quadlet: Change ReadOnly to default to enabled
This makees much more sense for typical service loads, and can
easily be reverted by `ReadOnly=no`.

Also updates and adds various tests for this.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:08:21 +02:00
Alexander Larsson 0de98b1b6c quadlet tests: Run the tests even for (exected) failed tests
Otherwise the noimage test doesn't look at the stderr assertion.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:01:36 +02:00
Alexander Larsson 8d41c7d2eb quadlet tests: Fix handling of stderr checks
We were looking at stdout, not stderr, and one of the testcases were
wrong.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-25 13:01:36 +02:00
Valentin Rothberg 221cfc6872 container/pod id file: truncate instead of throwing an error
Truncate the container and pod ID files instead of throwing an error.
The main motivation is to prevent redundant work when starting systemd
units.  Throwing an error when the file already exists is not preventing
races or file corruptions, so let's leave that to the user which in
almost all cases are generated (and tested) systemd units.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-25 09:37:35 +02:00
OpenShift Merge Robot 51a9bc8205
Merge pull request #16191 from odra/fix-16180_ancestor-filter-regex
adding regex support to the ancestor ps filter function
2022-10-24 18:55:56 -04:00
OpenShift Merge Robot 63a8f9aeaa
Merge pull request #16234 from jakecorrenti/system-df-verbose-format-usability
Fix `system df` issues with `-f` and `-v`
2022-10-24 11:44:09 -04:00
Alexander Larsson b7f05cef0b quadlet: Use the new podman create volume --ignore
This way we don't have to use the `ExecCondition=podman volume exist`,
which saves one process start.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-24 17:30:36 +02:00
Alexander Larsson 734c435e01 Add podman volume create --ignore
This ignores the create request if the named volume already exists.
It is very useful when scripting stuff.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-24 17:30:31 +02:00
Valentin Rothberg 7a9c14d626 fix search flake
There's no guarantee that the searched image will be returned, so only
make sure that "alpine" is mentioned somewhere.

Fixes: #16248
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-21 14:52:43 +02:00
Leonardo Rossetti 6c7ae378c3
adding regex support to the ancestor ps filter function
Signed-off-by: Leonardo Rossetti <lrossett@redhat.com>
2022-10-21 08:33:51 -03:00
Jake Correnti e5032a8dea Fix `system df` issues with `-f` and `-v`
Fixed the issue of `--format` and `--verbose` flags being allowed in
combination with one another.

Implemented functionality for `--format json` or `--format '{{ json }}' `.

Implemented command-completion help for `--format`.

Fixes: #16204

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
2022-10-20 23:12:09 -04:00
OpenShift Merge Robot 5af1c42119
Merge pull request #16211 from vrothberg/fix-16135
system df: fix image-size calculations
2022-10-19 10:46:01 -04:00
OpenShift Merge Robot a301ec164c
Merge pull request #16223 from vrothberg/quadlet
move quadlet packages into pkg/systemd
2022-10-19 09:58:43 -04:00
OpenShift Merge Robot 2936e60210
Merge pull request #16220 from edsantiago/testimage_iproute_socat
testimage: add iproute2 & socat, for pasta networking
2022-10-19 08:45:55 -04:00
Valentin Rothberg b4374f2bd9 move quadlet packages into pkg/systemd
Reduce the number of top-level packages in ./pkg by moving quadlet
packages under ./pkg/systemd.

[NO NEW TESTS NEEDED] - no functional change.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-19 13:38:27 +02:00
Valentin Rothberg 34235b2726 system df: fix image-size calculations
Fix two bugs in `system df`:

1.  The total size was calculated incorrectly as it was creating the sum
    of all image sizes but did not consider that a) the same image may
    be listed more than once (i.e., for each repo-tag pair), and that
    b) images share layers.

    The total size is now calculated directly in `libimage` by taking
    multi-layer use into account.

2.  The reclaimable size was calculated incorrectly.  This number
    indicates which data we can actually remove which means the total
    size minus what containers use (i.e., the "unique" size of the image
    in use by containers).

NOTE: The c/storage version is pinned back to the previous commit as it
      is buggy.  c/common already requires the buggy version, so use a
      `replace` to force/pin.

Fixes: #16135
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-19 11:20:41 +02:00
Ed Santiago 120a77e394 testimage: add iproute2 & socat, for pasta networking
PR #16141 introduces a new network type, "pasta". Its tests
rely on running 'ip -j' and socat in the container. Add them.

Also: bump to alpine 3.16.2 (from 3.16.0)
Also: clean up apk cache, this saves us 2MB+ in the image

Also (unrelated): clean up two broken uses of '$(< ...)' that
are causing tests to blow up under bats 1.8 on my laptop

New testimage is 20221018 and, sigh, is 12.7MB (up 4MB).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-18 11:50:48 -06:00
Urvashi Mohnani 30e66d6003 Set up minikube for k8s testing
Install and set up minikube so that we can
create a k8s cluster for testing.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-10-18 10:51:27 -04:00
OpenShift Merge Robot 1a60b30e51
Merge pull request #16035 from alexlarsson/quadlet
Initial quadlet version integrated in golang
2022-10-17 15:13:39 -04:00
Alexander Larsson 62bb59d3b0 Initial quadlet version integrated in golang
Based on the initial port in https://github.com/containers/quadlet/pull/41

This contains the unit tests and the testcases from the C code as well
as modification to the podman spec file based on what the quadlet
spec file looks like, producing a podman-quadlet subpackage.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-10-17 15:56:03 +02:00
Daniel J Walsh 75222add5a
Allow volume mount dups, iff source and dest dirs
Also create one constant for ErrDuplicateDest, rather then have the same
value set three times.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-10-15 07:38:08 -04:00
OpenShift Merge Robot c5c57f0c50
Merge pull request #16144 from presztak/vendor_psgo
vendor containers/psgo@v1.8.0
2022-10-15 07:07:19 -04:00
OpenShift Merge Robot 8656ffa563
Merge pull request #15662 from mtrmac/c-image-errors
Update for https://github.com/containers/image/pull/1299 + update tests
2022-10-14 17:56:16 -04:00
Piotr Resztak 04c126a3b4 vendor containers/psgo@v1.8.0
Signed-off-by: Piotr Resztak <piotr.resztak@gmail.com>
2022-10-14 17:28:15 +02:00
Valentin Rothberg b35fab6f1c kill: wait for the container
Make sure to wait for the container to exit after kill. While the
cleanup process will take care eventually of transitioning the state, we
need to give a guarantee to the user to leave the container in the
expected state once the (kill) command has finished.

The issue could be observed in a flaking test (#16142) where
`podman rm -f -t0` failed because the preceding `podman kill`
left the container in "running" state which ultimately confused
the "stop" backend.

Note that we should only wait for the container to exit when SIGKILL is
being used.  Other signals have different semantics.

[NO NEW TESTS NEEDED] as I do not know how to reliably reproduce the
issue.  If #16142 stops flaking, we are good.

Fixes: #16142
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-14 13:21:52 +02:00
Miloslav Trmač 33858c1cf8 Update tests for changed error messages
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-13 22:33:18 +02:00
Daniel J Walsh 8356621249
Merge pull request #16125 from containers/dependabot/go_modules/github.com/spf13/cobra-1.6.0
build(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.0
2022-10-12 16:13:56 -04:00
Paul Holzinger 5da54e1834
docs: add missing options
The new cobra update fixed a bug which caused some options to not be
included in --help when there was already a option with the same name
on a parent command.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-10-12 17:00:27 +02:00
OpenShift Merge Robot 695a848968
Merge pull request #16078 from rhatdan/main
Revert "cmd/podman: add support for checkpoint images"
2022-10-12 10:12:41 -04:00
Ed Santiago f16e9acc64 system tests: health-on-failure: fix broken logic
Basically, in the timeout loop where we checked for new CID
on the restarted container, we were running 'podman inspect'
(not 'inspect --format ID'), and comparing full hundred-line
output against single-line CID string.

While I'm in here, add 'c_' prefix to container to make it
easier for my old eyes to recognize "oh, that's a container name"
vs "is that a name? a SHA? a woozle?"

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-12 06:29:59 -06:00
Daniel J Walsh b47b48fd03
Revert "Add checkpoint image tests"
This reverts commit bbe1063a5a.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-10-11 10:04:55 -04:00
Valentin Rothberg 4dd67272ed healthcheck: fix --on-failure=stop
Fix the "stop" on-failure action by not removing the transient systemd
timer and service during container stop.  Removing the service will
in turn cause systemd to terminate the Podman process attempting to
stop the container and hence leave it in the "stopping" state.

Instead move the removal into the restart sequence.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-11 13:01:07 +02:00
Valentin Rothberg 02040089a6 health checks: make on-failure action retry aware
Make sure that the on-failure actions only kick in once the health check
has passed its retries.  Also fix race conditions on reading/writing the
log.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-07 15:43:48 +02:00
OpenShift Merge Robot ab3d3f818d
Merge pull request #16067 from tyler92/fix-directory-or-create
Create a full path to a directory when DirectoryOrCreate is used
2022-10-06 19:43:47 +02:00
Mikhail Khachayants 8b189c0a06
Create full path to a directory when DirectoryOrCreate is used with play kube
Signed-off-by: Mikhail Khachayants <tyler92@inbox.ru>
2022-10-06 15:37:36 +03:00
Boaz Shuster d4f622da7d Return error in podman system service if URI scheme is not unix/tcp
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2022-10-06 14:47:03 +03:00
Andrei Natanael Cosma f250560a80
Add pods created by kube play to a default network
In order to allow pods to reach other pods (as in Kubernetes) they all
need to be added to the same network. A network is created (if it
doesn't exist) and pods created by play-kube are added to that network.
When network options are passed to kube command the pods are not
attached to the default kube network.

Signed-off-by: Andrei Natanael Cosma <andrei@intersect.ro>
2022-10-04 21:59:57 +02:00
OpenShift Merge Robot 5da3e1187e
Merge pull request #15846 from jakecorrenti/pod-logs-latest
`podman pod logs -l` no longer panics
2022-10-03 12:44:39 +02:00
Valentin Rothberg 02b0f9fc39 container inspect: include image digest
Include the digest of the image in `podman container inspect`. The image
digest is a key information for auditing as it defines the identify of
an image.  This way, it can be determined whether a container used an
image with a given CVE etc.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-09-30 14:10:21 +02:00
OpenShift Merge Robot d88acd83a1
Merge pull request #16005 from sstosh/fix-typo
Fix typo about e2e tests name
2022-09-30 12:20:56 +02:00
OpenShift Merge Robot 5aa194b1ed
Merge pull request #15868 from rst0git/podman-run-checkpoint-img
cmd/podman: add support for checkpoint images
2022-09-30 12:18:24 +02:00
Toshiki Sonoda f304a1757c Fix typo about e2e tests name
* podman stop --all -> podman kill --all
* podman pause --filter -> podman restart --filter

[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-09-30 13:28:16 +09:00
OpenShift Merge Robot 61068649fa
Merge pull request #15909 from cdoern/restore
fix restore API endpoint
2022-09-29 23:02:00 +02:00
OpenShift Merge Robot 0513349355
Merge pull request #15998 from Luap99/play-kube-hostnet
podman kube play allow --network host
2022-09-29 20:26:03 +02:00
OpenShift Merge Robot 472e8243e5
Merge pull request #15994 from Luap99/flake-15990
fix "podman system prune networks" flake
2022-09-29 18:30:27 +02:00
Paul Holzinger fe2b4df382
podman kube play allow --network host
I see no reason to block --network host with kube play and force users
to have to set it in the yaml file.

This is just confusing when compared to the other podman create/run
--network options, see discussion in #15945.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-29 18:07:41 +02:00
Jake Correnti 6f821f03d9 `podman pod logs -l` no longer panics
Fixed issue where executing the command `podman pod logs -l` would panic
because it was indexing into an empty arguments array.

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
2022-09-29 08:56:02 -04:00
Paul Holzinger 3b5171d0ee
fix "podman system prune networks" flake
Since by default the network config dir is shared in the e2e tests any
other parallel running test could remove a network and cause this test to
fail.

Fixes #15990

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-29 14:39:25 +02:00
Radostin Stoyanov ebff193f8b Add test for podman run with checkpoint image
The `podman run` command has been extended with support for checkpoint
images. A checkpoint image contains image files generated by criu that
allow to restore the runtime state of containerized applications. This
patch adds a test case for this functionality.

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-09-29 13:33:09 +01:00
Paul Holzinger e2fe9eabac
Revert "remote: fix manifest add --annotation"
This reverts commit 32f54a81ed.

`pkg/bindings` is supported outside of podman and we have to keep it
stable.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-29 14:16:42 +02:00
OpenShift Merge Robot f52feded3c
Merge pull request #15988 from sstosh/manifest-annotate-remote
remote: fix manifest add --annotation
2022-09-29 13:22:22 +02:00
Toshiki Sonoda 32f54a81ed remote: fix manifest add --annotation
* `manifest add --annotation option` adds annotations
  field on remote environment.
* `manifest inspect` prints annotations field
  on remote environment.

Fixes: #15952

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-09-29 18:14:41 +09:00
Ed Santiago 496d4c7533 System tests: stop deep-checking log-level
I was testing --log-level by --storage-opt=mount_program=/bin/false

Stop doing that. It's just constantly breaking everything (#15698
and #15977).

I am violently of the opinion that a command-line option must
not destroy a user's system (except for --set-something, --config,
something that makes it very very clear that it is a lasting
change). I seem to be in the minority on this opinion. So, I
give up.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-09-28 09:30:23 -06:00
OpenShift Merge Robot dca5ead2d7
Merge pull request #15946 from rhatdan/kube
Default missing hostPort to containerPort is defined in kube.yaml
2022-09-27 22:21:54 +02:00
Daniel J Walsh f5fc0960e5
Default missing hostPort to containerPort is defined in kube.yaml
If user does not specify hostPort in a kube.yml file but does specify
a containerPort, then the hostPort should default to the containerPort.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-27 14:04:24 -04:00
Ed Santiago 3e80931529 System tests: light cleanup
Followup to #15895:
 - add a normal-case test, to ensure that --privileged without
   systemd continues to pass through /dev/ttyN devices
 - explain why we die() if host has no ttyN devices
 - I find grep -vx slightly easier to read than sed backslash-slash
 - run cleanup with '-t 0', to shave ten seconds from CI run

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-09-27 05:53:18 -06:00
OpenShift Merge Robot a0c0971e63
Merge pull request #15933 from vrothberg/fix-15879
auto-update: validate container image
2022-09-26 20:45:30 +02:00
Valentin Rothberg 7bc36602f6 auto-update: validate container image
Auto updates using the "registry" policy require container to be created
with a fully-qualified image reference.  Short names are not supported
due the ambiguity of their source registry.  Initially, container
creation errored out for non FQN images but it seems that Podman has
regressed.

Fixes: #15879
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-09-26 17:07:05 +02:00
Paul Holzinger 52656887e1
compat API: network inspect do not show isolate option
We force the isolate option on new newtworks because that is the docker
behavior. However when we inspect them they should not be displayed to
the caller since they have no idea about it and docker-compose throws an
error because of that.

Fixes #15580

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-25 22:10:22 -04:00
OpenShift Merge Robot 40e8bcb848
Merge pull request #15900 from rhatdan/VENDOR
Update vendor of containers(image, common, buildah, storage)
2022-09-23 22:00:37 +02:00
OpenShift Merge Robot 4d475ae87b
Merge pull request #15873 from ashley-cui/prettysecrets
Add --pretty to podman secret inspect
2022-09-23 20:57:51 +02:00
OpenShift Merge Robot f658bbd230
Merge pull request #15463 from mheon/fix_15408
Events for containers in pods now include the pod's ID
2022-09-23 20:39:56 +02:00
Ed Santiago f5e83f6849
Fixup Buildah merge
Changes since 2022-09-09:
 - man page: add --skip-unused-stages (buildah 4249)
 - man page: bring in new Note for --cache-ttl (4248)
 - system tests: de-stutter (4205)

 - (internal): in skip() applier: escape asterisk, otherwise
   the "bud with --dns* flags" sed expression never applies.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-23 14:13:12 -04:00
cdoern 2478e32ca3 fix restore API endpoint
restore endpoint was totally ignoring --pod, it was missing from the schema and from query handling
on the api handlers side. add support for it here.

resolves #15018

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2022-09-22 15:11:19 -04:00
Matthew Heon 6ee582315b Events for containers in pods now include the pod's ID
This allows tools like Cockpit to know that the pod in question
has also been updated, so they can refresh the list of containers
in the pod.

Fixes #15408

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-09-22 14:18:56 -04:00
Ashley Cui dc05d1212c Add --pretty to podman secret inspect
Pretty-print podman secret inspect output in a human-readable format

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-09-22 14:07:11 -04:00
Matthew Heon fc6dcd12b3 Add support for 'image' volume driver
We added the concept of image volumes in 2.2.0, to support
inspecting an image from within a container. However, this is a
strictly read-only mount, with no modification allowed.

By contrast, the new `image` volume driver creates a c/storage
container as its underlying storage, so we have a read/write
layer. This, in and of itself, is not especially interesting, but
what it will enable in the future is. If we add a new command to
allow these image volumes to be committed, we can now distribute
volumes - and changes to them - via a standard OCI image registry
(which is rather new and quite exciting).

Future work in this area:
- Add support for `podman volume push` (commit volume changes and
  push resulting image to OCI registry).
- Add support for `podman volume pull` (currently, we require
  that the image a volume is created from be already pulled; it
  would be simpler if we had a dedicated command that did the
  pull and made a volume from it)
- Add support for scratch images (make an empty image on demand
  to use as the base of the volume)
- Add UOR support to `podman volume push` and
  `podman volume pull` to enable both with non-image volume
  drivers

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-09-22 13:07:40 -04:00
OpenShift Merge Robot 08993516a9
Merge pull request #15895 from dcermak/don-expose-dev-for-privileged
Don't mount /dev/ inside privileged containers running systemd
2022-09-22 19:03:15 +02:00
OpenShift Merge Robot 8bf3535447
Merge pull request #15131 from boaz0/closes_14707
Add support to sig-proxy for podman-remote
2022-09-22 17:06:45 +02:00
Dan Čermák 5a2405ae1b
Don't mount /dev/tty* inside privileged containers running systemd
According to https://systemd.io/CONTAINER_INTERFACE/, systemd will try take
control over /dev/ttyN if exported, which can cause conflicts with the host's tty
in privileged containers. Thus we will not expose these to privileged containers
in systemd mode, as this is a bad idea according to systemd's maintainers.

Additionally, this commit adds a bats regression test to check that no /dev/ttyN
are present in a privileged container in systemd mode

This fixes https://github.com/containers/podman/issues/15878

Signed-off-by: Dan Čermák <dcermak@suse.com>
2022-09-22 16:44:26 +02:00
OpenShift Merge Robot 828fae1297
Merge pull request #15870 from idleroamer/podman-save
podman-save: Add signature-policy flag
2022-09-22 15:18:41 +02:00