Commit Graph

5133 Commits

Author SHA1 Message Date
OpenShift Merge Robot cfa38114ad
Merge pull request #17483 from vyasgun/pr/filter-fix
fix != filter in volume prune
2023-02-15 05:22:41 -05:00
danishprakash 828708bac2
create: add support for --group-entry
* add test
* update documentation

Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-02-15 11:20:18 +05:30
vyasgun 33a918711f fix != filter in volume prune
Signed-off-by: vyasgun <vyasgun20@gmail.com>
2023-02-15 10:55:21 +05:30
Daniel J Walsh 4c5b79120c
Allow specification of podman --remote build -f -
Fixes: https://github.com/containers/podman/issues/17495

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-15 05:44:15 +02:00
Daniel J Walsh 3d8936642e
Quadlet use crun specified in containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-15 05:39:56 +02:00
Urvashi Mohnani c0f983db87 Don't set hostPort when generating a service
When generating a kube yaml with kube generate, do not
set the hostPort in the pod spec if the service flag is
set and we are generating a service kind too.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-02-14 11:00:28 -05:00
danishprakash 0999991b20
add support for limiting tmpfs size for systemd-specific mnts
* add tests
* add documentation for --shm-size-systemd
* add support for both pod and standalone run

Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-02-14 14:56:09 +05:30
OpenShift Merge Robot 1e06c1a47a
Merge pull request #17379 from umohnani8/ulimit
Add ulimit annotation to kube gen & play
2023-02-13 21:59:49 -05:00
OpenShift Merge Robot 26ed4f3447
Merge pull request #17488 from containers/dependabot/go_modules/test/tools/golang.org/x/tools-0.6.0
build(deps): bump golang.org/x/tools from 0.5.0 to 0.6.0 in /test/tools
2023-02-13 16:21:45 -05:00
OpenShift Merge Robot 4debbd108b
Merge pull request #17487 from vrothberg/quadlet-stop
quadlet: add ExecStop
2023-02-13 13:45:40 -05:00
OpenShift Merge Robot aab06f5724
Merge pull request #17489 from vrothberg/fix-16091
install sigproxy before start/attach
2023-02-13 13:06:50 -05:00
Urvashi Mohnani 35d16ea027 Add ulimit annotation to kube gen & play
Add a podman ulimit annotation to kube generate and play.
If a container has a container with ulimits set, kube gen
will add those as an annotation to the generated yaml.
If kube play encounters the ulimit annotation, it will set
ulimits for the container being played.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-02-13 11:38:24 -05:00
Valentin Rothberg 7c54d14232 quadlet: add ExecStop
Remove the container in ExecStop to make sure that Quadlet's adheres to
Podman's customizable stop signal/timeout.  Certain programs ignore
SIGTERM which renders the services generated by Quadlet less user
friendly compared to the ones from podman-generate-systemd.

Previously, `systemctl stop` would just hang until systemd's stop
timeout is hit.  Since `podman rm` also removes the CID file, the
additional `rm` can be removed.  Note that `podman rm` will return
immediately if the specified CID file isn't present.

I am working on a short tutorial on Quadlet and hit the issue with a
simple container running `sleep`.  `sleep` ignores SIGTERM and stopping
the service would take forever even with `PodmanArgs=--stop-timeout=0`.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-13 15:21:48 +01:00
Valentin Rothberg d2ac85f7aa install sigproxy before start/attach
Install the signal proxy before attaching to/starting the container to
make sure there's no race-condition as revealed in the failing start/run
tests in #16901.  The tests had the valid expectation that signal
forwarding works once the container is running.

Further update the tests to account for the attach test where the
expectation is that signal forwarding works once Podman has attached to
container (or even before).

Fixes: #16901
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-13 15:13:42 +01:00
dependabot[bot] 191e4ce40c
build(deps): bump golang.org/x/tools from 0.5.0 to 0.6.0 in /test/tools
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.5.0...v0.6.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-02-13 13:07:08 +00:00
Erik Sjölund a5ca732256 Fix typos
Software version used
https://github.com/crate-ci/typos/releases/tag/v1.13.10

The binary was downloaded from
https://github.com/crate-ci/typos/releases/download/v1.13.10/typos-v1.13.10-x86_64-unknown-linux-musl.tar.gz

Command that was run:

typos --write-changes docs cmd cni contrib dependencies docs hack libpod pkg utils

False positives were manually removed.
A few marshaling/existant typos were manually fixed.

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-02-11 18:23:24 +01:00
Valentin Rothberg 1541ce56cf kube play: set service container as main PID when possible
Commit 4fa307f149 fixed a number of issues in the sdnotify proxies.
Whenever a container runs with a custom sdnotify policy, the proxies
need to keep running which in turn required Podman to run and wait for
the service container to stop.  Improve on that behavior and set the
service container as the main PID (instead of Podman) when no container
needs sdnotify.

Fixes: #17345
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-10 13:31:03 +01:00
Erik Sjölund 08e13867a9 Fix typos. Improve language.
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-02-09 21:56:27 +01:00
OpenShift Merge Robot d5e1e278a3
Merge pull request #17221 from mtrmac/eof-range-requests
Vendor c/image after https://github.com/containers/image/pull/1816
2023-02-09 14:02:28 -05:00
OpenShift Merge Robot 9eaf965a21
Merge pull request #17449 from rhatdan/codespell
Run codespell on codebase
2023-02-09 13:59:35 -05:00
OpenShift Merge Robot d8de65bb8b
Merge pull request #17412 from umohnani8/alias
Add ctrName to network alias during kube play
2023-02-09 13:56:19 -05:00
Ed Santiago 9cba0474b5 events + container inspect test: RHEL fixes
Primarily, add skip_if_journald_unavailable because RHEL.

Secondarily, reverse a flipped actual/expect assertion
that made it difficult to understand the RHEL failure.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-09 06:49:32 -07:00
Urvashi Mohnani 5a9074dabb Add ctrName to network alias during kube play
We currently name the container being created during kube play
as ctrName-podName, but this is not how it is done in k8s.
Since we can't change this at the CLI level as it will be a breaking
change (it will be planned for podman 5.0), add only ctrName as an alias
to the network of the pod.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-02-09 08:25:13 -05:00
Daniel J Walsh 5865159766
Run codespell on codebase
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-09 08:02:43 -05:00
Miloslav Trmač e308ba0215 Vendor c/image after https://github.com/containers/image/pull/1816
Also includes unreleased https://github.com/openshift/imagebuilder/pull/246 to work
with the updated docker/docker dependency.

And updates some references to newly deprecated docker/docker symbols.

[NO NEW TESTS NEEDED]

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-08 22:37:38 +01:00
OpenShift Merge Robot 34e76a46ab
Merge pull request #17423 from ygalblum/quadlet_container_secret
Quadlet: Add support for the Secret key in Container group
2023-02-08 15:45:41 -05:00
OpenShift Merge Robot bd40dbc553
Merge pull request #17420 from vrothberg/fix-kube-start
kube play: do not teardown unconditionally on error
2023-02-08 09:29:26 -05:00
OpenShift Merge Robot 82af4dd531
Merge pull request #17380 from sbrivio-rh/pasta
tests: pasta: Mitigation for socat connect() getting EINTR and two other fixes
2023-02-08 09:24:17 -05:00
Ygal Blum d6dd17fdfe Quadlet: Add support for the Secret key in Container group
Add E2E tests
Add system test
Add to man page

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-02-08 16:12:08 +02:00
OpenShift Merge Robot b829588a32
Merge pull request #17421 from sstosh/e2e-fix-remote
e2e: fix some tests on remote
2023-02-08 07:29:47 -05:00
Toshiki Sonoda 43b3570680 e2e: fix some tests on remote
- podman-remote unshare returns an error message
  with the exit code '125'.

- Need to run RestartRemoteService() to apply
  changes to the TMPDIR.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-02-08 18:07:41 +09:00
Valentin Rothberg 83367a6b3b kube play: do not teardown unconditionally on error
Commit 2f29639bd3 added a UX improvement to cleanup/teardown when
running the specified YAML has failed.  However, the teardown happens
unconditionally such that rerunning the same YAML file will teardown the
previously created workload instead of just failing with a name-conflict
error (e.g., "pod already exists").  The regression popped up testing
the Ansible system role with Podman v4.4.0.

For now, do not teardown at all on error to quickly fix this regression
for the upcoming Podman v4.4.1 release.  The UX improvement is still
desired but must be conditional and only happen on newly created
resources, which probably requires moving it down to the backend.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-08 09:20:16 +01:00
Alex Jia ac71fa01c3 Fix typos in comments
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2023-02-08 10:05:27 +08:00
OpenShift Merge Robot 6ce76720be
Merge pull request #17402 from Luap99/update-lint
update golangci-lint to version 1.51.1
2023-02-07 11:00:16 -05:00
Paul Holzinger 77e4b19397
update golangci-lint to version 1.51.1
The new version contains the ginkgolinter, which makes sure the
assertions are more helpful.

Also replace the deprecated os.SEEK_END with io.SeekEnd.

There is also a new `musttag` linter which checks if struct that are
un/marshalled all have json tags. This results in many warnings so I
disabled the check for now. We can reenable it if we think it is worth
it but for now it way to much work to fix all report problems.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-02-07 14:16:21 +01:00
Valentin Rothberg f1352521ff Quadlet: exit 0 when there are no files to process
Quadlet should not exit with failure if no files to process have been
found.  Otherwise, even simple operations such as reloading systemd
will fail as it retriggers generators.

Fixes: #17374
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-07 10:48:31 +01:00
Toshiki Sonoda 315215020d e2e: adapt play kube test on remote rootless
Use podmanTest.PodmanBinary because podman-remote unshare
cannot be used.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-02-07 17:04:43 +09:00
Stefano Brivio af0f10a227 pasta: Fix ICMPv6 Echo test, skip it for the moment
Similarly to the ICMP test for IPv4, I broke the command line on a
rebase of the initial test import.

Note that, unless we pass an IPv6 resolver directly to pasta, Podman
won't add one to /etc/resolv.conf in the container. We could pass
that explicitly, but then end up hitting the same issue as the one
described in the "Local forwarder, IPv6" case. Skip this test for
the moment being.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2023-02-06 19:10:04 +01:00
Stefano Brivio 859579b6b7 pasta: Fix ICMP Echo Request (IPv4) test
Parameter substitution in the command line went lost on some rebase
of the initial test import. Add it back and actually test that we can
ping the resolver.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2023-02-06 19:10:04 +01:00
Stefano Brivio e33f4e0bc7 pasta: Use two connections instead of three in TCP range forward tests
For some reason I couldn't figure out yet, on CI systems running
Fedora 37, tests for TCP port forwarding with ranges fail on the
third connection, as connect() from the socat client gets
interrupted -- and socat doesn't handle this.

Mitigate this by connecting twice, to two different ports, instead of
using three ports.

Reported-by: Ed Santiago <santiago@redhat.com>
Link: https://github.com/containers/podman/issues/17287
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2023-02-06 19:10:04 +01:00
Daniel J Walsh acaab3fa72
Add SELinux label types support to quadlet
Add support for disabeling SELinux process separation in the container.
Add support for setting the process type of the container.
Add support for setting the process MCS level of the container.
Add support for setting the file type of the container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-06 12:54:34 -05:00
Daniel J Walsh 928d589b7e
Add quadlet support for rootfs= containers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Add rootfs= support for quadlet containers

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-06 12:54:33 -05:00
OpenShift Merge Robot 51dd01c273
Merge pull request #17347 from sstosh/system-nonexistent-labels
system tests: fix noexistent labels test in the remote
2023-02-03 23:01:11 +01:00
OpenShift Merge Robot 5925baa33b
Merge pull request #17302 from rhatdan/selinux
Handle filetype field in kubernetes.yaml files
2023-02-03 22:45:08 +01:00
OpenShift Merge Robot 3654a26421
Merge pull request #17350 from giuseppe/allow-keep-id-for-root
libpod: allow userns=keep-id for root
2023-02-03 15:19:30 +01:00
Giuseppe Scrivano de63ad7044
libpod: allow userns=keep-id for root
copy the current mapping into a new user namespace, and run into a
separate user namespace.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-02-03 12:44:30 +01:00
OpenShift Merge Robot d8ef86a96e
Merge pull request #17325 from flouthoc/clean-cache-api
system-reset: use `CleanCacheMount` to clear build cache
2023-02-03 11:35:13 +01:00
OpenShift Merge Robot 90d338043d
Merge pull request #17343 from giuseppe/fix-cgroup-ro-test-cgroupv1
test: adapt test to work on cgroupv1
2023-02-03 11:10:54 +01:00
Aditya R 9e7f1bea42
system-reset: use CleanCacheMount to clear build cache
Just like buildkit buildah must allow cleaning the buildcache and cache generated on host by --mount=type=cache just like buildkit's prune command.

See: https://github.com/moby/buildkit#cache

Signed-off-by: Aditya R <arajan@redhat.com>
2023-02-03 12:30:28 +05:30
Toshiki Sonoda 3ce07b5567 system tests: fix noexistent labels test in the remote
In the remote environment, this test will be failed,
because an error message is different from the local environment.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-02-03 14:41:06 +09:00
OpenShift Merge Robot 78458e0f89
Merge pull request #17274 from giuseppe/idmap-rootfs
libpod: support idmap for --rootfs
2023-02-03 04:12:25 +01:00
Giuseppe Scrivano 2bb4c7cdde
libpod: support idmap for --rootfs
add a new option idmap to --rootfs that works in the same way as it
does for volumes.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-02-02 22:35:00 +01:00
Giuseppe Scrivano ed1f769176
test: adapt test to work on cgroupv1
when running on a cgroupv1 host validate that the memory controller is
mounted ro.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-02-02 20:41:57 +01:00
OpenShift Merge Robot e64508378f
Merge pull request #17327 from sstosh/system-vol-test
system tests: fix volume exec/noexec test
2023-02-02 19:50:47 +01:00
Daniel J Walsh 02bcf0bac8
Handle filetype field in kubernetes.yaml files
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-02 09:23:12 -06:00
Toshiki Sonoda 68371ff550 system tests: fix volume exec/noexec test
The return code is "126" in the current version of runc.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-02-02 18:18:28 +09:00
Ed Santiago f69efb6eef system tests: minor fix for RHEL8 incompatibility
quadlet tests were using 'systemctl show -P', a shortcut
that doesn't exist on RHEL8. Translate to old-systemd
language.

And, minor tweaks to make future test diagnosing easier.

This is a frontport of #17311; bringing from release branch
to main. Except that was an emergency, so it was a one-line
fix. This is a better long-term fix, not as trivial to review.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-01 16:12:39 -07:00
Toshiki Sonoda 9272cabd38 e2e: fix run_staticip_test about no_proxy
http.Get() could not recognize no_proxy with "ginkgo -nodes <any>".
Therefore, we set http.Client not to use a proxy instead of os.Setenv().

Fixes #17135

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-31 16:55:11 +09:00
Ed Santiago 0e3524b8b2 e2e tests: fix incorrect os.User.Name
Ha ha. This was supposed to be a trivial little followup to #17174:

   https://github.com/containers/podman/pull/17174#discussion_r1085963780
      (safer username check when --userns=keep-id)

It got complicated. TL;DR we need to use User.Username, not User.Name.
The latter is GECOS! Tests were working because, on Fedora, GECOS
for root is "root". Found and fixed all 'u.Name' instances, but
if there are any references with a variable other than 'u', they
still need looking into.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-30 13:54:10 -07:00
OpenShift Merge Robot 929d03a5ea
Merge pull request #17243 from sstosh/e2e-imagecachedir
e2e: Avoid hard-coding ImageCacheDir
2023-01-30 07:04:00 -05:00
Toshiki Sonoda 7e80edd3aa e2e: Avoid hard-coding included in quadlet test
Use .*/podman_test.*... instead of /tmp/podman_test.*...

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-30 11:45:34 +09:00
Toshiki Sonoda 2682d3ad9d e2e: Avoid hard-coding ImageCacheDir
- ImageCacheDir is hard-coded as "/tmp/podman/imagecachedir".
To avoid this hard-coding, I changed it to "os.TempDir()/imagecachedir".

- Change ImageCacheDir permissions from 0777 to 0700.
This directory should be used by per-user.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-30 10:14:08 +09:00
Jason T. Greene 553e53d441 Fix default handling of pids-limit
Add test to verify that updates without a pids-limit specified no longer
overwrite the previous value.

Also fixes erroneous warning generated by remote clients:

"Resource limits are not supported and ignored on cgroups V1 rootless
systems"

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2023-01-27 23:19:44 -06:00
OpenShift Merge Robot 986a3a61a8
Merge pull request #17182 from TomSweeneyRedHat/dev/tsweeney/fixlang3
Clean up more language for inclusiveness
2023-01-27 15:50:35 -05:00
OpenShift Merge Robot 14012491cf
Merge pull request #17088 from mtrmac/sign-by-sigstore
Add … push --sign-by-sigstore
2023-01-27 14:02:52 -05:00
Miloslav Trmač 069edc3adf Add (podman {image,manifest} push --sign-by-sigstore=param-file.yaml)
(podman push) and (podman manifest push) now support --sign-by-sigstore=param-file,
using the containers-sigstore-signing-params.yaml(5) file format.

That notably adds support for Fulcio and Rekor signing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-01-27 16:47:32 +01:00
Toshiki Sonoda 21b82bb687 e2e: Remove the cache with "podman unshare rm" when a rootless user
If rootless, os.RemoveAll() is failed due to permission denied.
Therefore, we use "podman unshare rm" instead of os.RemoveAll().

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-27 23:44:04 +09:00
tomsweeneyredhat 9db657f40c Clean up more language for inclusiveness
We had a number of references, mostly in docs, to the word master that
can now be changed to main.  This PR does that and makes the project a
bit more inclusive.

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2023-01-27 09:40:27 -05:00
OpenShift Merge Robot a096e32ecc
Merge pull request #17251 from quite/status-up-not-ago
fix: don't output "ago" when container is currently up and running
2023-01-27 09:22:24 -05:00
Toshiki Sonoda 814f7c5695 e2e: Remove some directories at SynchronizedAfterSuite
"tempdir" in SynchronizedAftersuite and "LockTmpDir" can be removed.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-27 21:25:44 +09:00
Daniel Lublin 497be102ad fix: don't output "ago" when container is currently up and running
Closes #17250

Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-01-27 12:32:15 +01:00
Valentin Rothberg a745d99a88 fix CI: test fail due to merge
containers/podman/pull/17186 and containers/podman/pull/17201 have been
merged at roughly the same time.  Both work fine in isolation but the
new kube test breaks in combination.

Fix the IPC kube test to make CI healthy.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-27 10:00:56 +01:00
OpenShift Merge Robot 49b809a0cc
Merge pull request #17186 from danishprakash/add-host-ipc
kube-play: add support for HostIPC in pod.Spec
2023-01-26 14:41:48 -05:00
OpenShift Merge Robot 532957eeff
Merge pull request #17217 from ygalblum/ygal-quadlet-blockdev-support
quadlet: Add device support for .volume files
2023-01-26 10:20:52 -05:00
OpenShift Merge Robot 4692b29145
Merge pull request #17208 from sstosh/e2e-tempfile
e2e: reduce dependency on /tmp for e2e tests
2023-01-26 10:00:08 -05:00
Toshiki Sonoda 38d5319f16 e2e: reduce dependency on /tmp for e2e tests
- Use filepath.Join(podmanTest.TempDir, "any") instead of "/tmp/any"

- Add generatePolicyFile() to avoid the hardcording of "keyPath": "tmp/key.gpg"

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-26 22:20:15 +09:00
Ingo Becker e62e42bfa9 quadlet: Add device support for .volume files
The Device, Type, Copy and Options keys are now supported in
quadlet  .volume files. This allows users to create filesystem
based volumes with quadlets .volume files.

Signed-off-by: Ingo Becker <ingo@orgizm.net>
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-01-26 14:46:57 +02:00
Aditya R 70e8f6243a
remote,build: error if containerignore is symlink
Drop support for remote use-cases when `.containerignore` or
`.dockerignore` is a symlink pointing to arbitrary location on host.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-01-26 16:11:51 +05:30
OpenShift Merge Robot 0184ba5d09
Merge pull request #17213 from umohnani8/nonroot
Set runAsNonRoot=true in gen kube
2023-01-26 05:03:07 -05:00
Paul Holzinger 9904fbed33
fix APIv2 python attach test flake
The test was added in commit 1424f0958f, it can flake because the
attach test needs the message in the log. On slow CI systems this can
take longer. Add a retry logic which checks the container log every
second for up to 5 seconds. That should be plenty of time.

Fixes #17204

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-25 14:15:20 +01:00
Urvashi Mohnani 958c94094e Set runAsNonRoot=true in gen kube
If the image being used has a user set that is a positive
integer greater than 0, then set the securityContext.runAsNonRoot
to true for the container in the generated kube yaml.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-01-25 17:14:22 +05:30
OpenShift Merge Robot 3cee9d9d98
Merge pull request #17201 from rhatdan/ipc
Correct output when inspecting containers created with --ipc
2023-01-24 17:29:29 -05:00
Daniel J Walsh 623ad2a636
Correct output when inspecting containers created with --ipc
Fixes: https://github.com/containers/podman/issues/17189

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-24 12:18:39 -05:00
Daniel J Walsh c4aae9b47e
Get correct username in pod when using --userns=keep-id
Fixes: https://github.com/containers/podman/issues/17148

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-24 11:06:06 -05:00
Aditya R b7ab889a7e
systems: retrofit dns options test to honor other search domains
Signed-off-by: Aditya R <arajan@redhat.com>
2023-01-23 19:15:35 +05:30
danishprakash 08186d7dd7
kube-play: add support for HostIPC in pod.Spec
* play_kube_test: add tests

Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-01-23 17:27:57 +05:30
Aditya R 06241077cc
libpod,netavark: correctly populate /etc/resolv.conf with custom dns server
After https://github.com/containers/netavark/pull/452 `netavark` is
incharge of deciding `custom_dns_servers` if any so lets honor that and
libpod should not set these manually.

This also ensures docker parity
Podman populates container's `/etc/resolv.conf` with custom DNS servers ( specified via `--dns` or `dns_server` in containers.conf )
even when container is connected to a network where `dns_enabled` is `true`.

Current behavior does not matches with docker, hence following commit ensures that podman only populates custom DNS server when container is not connected to any network where DNS is enabled and for the cases where `dns_enabled` is `true`
the resolution for custom DNS server will happen via ( `aardvark-dns` or `dnsname` ).

Reference: https://docs.docker.com/config/containers/container-networking/#dns-services
Closes: containers#16172

Signed-off-by: Aditya R <arajan@redhat.com>
2023-01-22 12:48:55 +05:30
OpenShift Merge Robot 8252dcceb3
Merge pull request #17168 from danishprakash/add-host-pid
kube-play: add support for HostPID
2023-01-20 11:57:14 -05:00
OpenShift Merge Robot 4f4dce166c
Merge pull request #17175 from Luap99/default-invalid-netname
network create: do not allow `default` as name
2023-01-20 11:18:01 -05:00
OpenShift Merge Robot 9c79e3bbb0
Merge pull request #17124 from sstosh/e2e-rootless
e2e: use isRootless() instead of rootless.IsRootless()
2023-01-20 09:04:25 -05:00
Paul Holzinger 86699954b1
network create: do not allow `default` as name
`default` is already used as network mode, i.e. podman run --network
default will choose the default mode not a network named `default`.

We already block names from other network modes, default was forgotten.

Fixes #17169

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-20 14:52:07 +01:00
danishprakash 3ae84fe0a3
kube-play: add support for HostPID in podSpec
* test/play_kube: add tests for hostPID

Signed-off-by: danishprakash <danish.prakash@suse.com>
2023-01-20 17:32:59 +05:30
Ed Santiago ca91cf416f Let's see if #14653 is fixed or not
Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-19 12:20:56 -07:00
OpenShift Merge Robot 7689e26c79
Merge pull request #16525 from Luap99/CI-update-image
update CI images to include pasta
2023-01-19 11:30:46 -05:00
Paul Holzinger 7be8ff5644
unskip network update test
They should work with the new VM images.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-19 15:44:17 +01:00
Paul Holzinger 2ad938ec6e
pasta: skip "Local forwarder, IPv4" test
It is not working in CI and locally, I filed #17074 to track it so we
can fix it later.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-01-19 15:44:17 +01:00
Ed Santiago 07d297ca3d Cirrus: preserve podman-server logs
Output from podman system service, on system tests, is
being saved... it just hasn't been collected as an artifact.
Start collecting it. And, remove obsolete-unused-misleading
code that made me think it _was_ being collected.

Also: log system-service output for bud tests, and set
log-level to info per suggestion from @Luap99

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-19 06:27:43 -07:00
Ed Santiago 51836aa47c e2e tests: reenable long-skipped build test
July 2022: test was flaking on new VM images. We needed new
images, so I filed #15014 and skipped the test.

January 2023: no attention from anyone, so I'll try bumping up
a dd timeout from 10s to 30s. But in the interim, the test
has broken: it used to expect "Containerfile" in output (this
was deliberately added in #13655)... but #16810 changed that
so Containerfile no longer appears. @flouthoc argues that
this too is deliberate (#17059). Okay, so let's change the
test then. All I care about is not adding more regressions.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-18 17:31:03 -07:00
Daniel J Walsh ef3f098796
Remove ReservedAnnotations from kube generate specification
Reserved annotations are used internally by Podman and would effect
nothing when run with Kubernetes so we should not be generating these
annotations.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-18 08:46:24 -05:00
Toshiki Sonoda 6d3858b21e e2e: update test/README.md
All ginkgo test must be run with the remote build tag.
See #16322 for details.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-01-18 10:35:19 +09:00
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