Commit Graph

3923 Commits

Author SHA1 Message Date
Chris Evich d865fcc5ec
Fix e2e tests referencing generic env. var.
Use of `$DEBUG` is highly likely to clash.  Fortunately this one is in
a very specific/special context, so a rename fix should be perfectly
adequate.

See also https://github.com/containers/automation/pull/96
and https://github.com/containers/podman/issues/13932

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-04-20 14:02:08 -04:00
Radostin Stoyanov bbe1063a5a
Add checkpoint image tests
The patch introduces the following test cases:

1. An attempt to checkpoint a container that does not exist should fail.
2. Checkpoint of a running container with --create-image should create a
   checkpoint image.
3. A single checkpoint image can be used to restore multiple containers,
   each with a different name.
4. Restoring multiple containers from checkpoint images with a single
   restore command.

Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
2022-04-20 18:55:43 +01:00
OpenShift Merge Robot 3571a7e2eb
Merge pull request #13835 from vrothberg/run-1436
benchmarking Podman: proof of concept
2022-04-20 08:41:54 -04:00
Aditya R 519535daa0
healthcheck: set default healthcheck Interval if not specified in image
Set appropriate defaults for `--interval` when
processing a Containerfile with build format as docker.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-04-20 16:12:45 +05:30
Valentin Rothberg 0162f678c0 benchmarking Podman: proof of concept
Add a proof of concept for benchmarking Podman.  The benchmarks are
implemented by means of the end-to-end test suite but hidden behind
a `benchmarks` build tag.  Running `make localbenchmarks` will run
`test/e2e` with the specific build tag and set ginkgo's "focus" to
the specific "Podman Benchmark Suite" to only run this spec and skip
all others.

ginkgo will print a report before terminating listing the CPU and memory
stats for each benchmark.  New benchmarks can easily be added via the
`newBenchmark` function that also supports adding an `init()` function
to each benchmark which allows for performing certain setups for the
specific benchmark.  For instance, benchmarking `podman start` requires
creating a container beforehand.

Podman may be called more than once in the main function of a benchmark
but note that the displayed memory consumption is then a sum of all
Podman invocations.  The memory consumption is collected via
`/usr/bin/time`.

A benchmark's report is split into CPU and memory as displayed below:

```
[CPU] podman images:
  Fastest Time: 0.146s
  Slowest Time: 0.187s
  Average Time: 0.180s ± 0.015s
[MEM] podman images:
  Smallest: 41892.0KB
   Largest: 42792.0KB
   Average: 42380.7KB ± 286.4KB
```

Note that the benchmarks are not wired into the CI yet.  They are meant
as a proof of concept.  More benchmarks and the plumbing into CI will
happen in a later change.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-20 11:31:28 +02:00
cdoern be0da4a222 Translate Memory Limit to Swap in API
in specgen, CLI path uses the given memory limit to define the swap value (if not already specified)
add a route to this piece of code from within the api handlers

resolves #13145

Signed-off-by: cdoern <cdoern@redhat.com>
2022-04-18 15:38:24 -04:00
OpenShift Merge Robot 8d3075e332
Merge pull request #13583 from rhatdan/ipc
Add support for ipc namespace modes "none, private, sharable"
2022-04-16 12:30:01 -04:00
OpenShift Merge Robot 92625eadc6
Merge pull request #13641 from nicrowe00/logfile
Add log rotation based on log size
2022-04-15 06:02:02 -04:00
OpenShift Merge Robot f2ab79cc02
Merge pull request #13868 from cdoern/cloneSwap
Fix Memory Swappiness passing in Container Clone
2022-04-15 05:54:05 -04:00
OpenShift Merge Robot 6076e1a9a5
Merge pull request #13616 from giuseppe/passwd-entry
run, create: add --passwd-entry
2022-04-14 15:35:20 -04:00
cdoern f38b03d375 Fix Memory Swappiness passing in Container Clone
`DefineCreateFlags` was excluding clone from using the memory-swappiness flag leading the value to be zero
when our deafult is -1. Rearrange the if/else to give clone these memory related options

resolves #13856

Signed-off-by: cdoern <cdoern@redhat.com>
2022-04-14 10:40:29 -04:00
Valentin Rothberg 2a75164e23 add a regression test for CVE-2022-1227
Will also be included in the upcoming backports.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-14 14:42:12 +02:00
OpenShift Merge Robot 90293da292
Merge pull request #13866 from edsantiago/bats
System tests: Usage checks: better error messages
2022-04-14 07:28:51 -04:00
OpenShift Merge Robot 5771f82260
Merge pull request #13857 from rhatdan/logs
Fix --tail log on restart problem
2022-04-14 07:22:52 -04:00
OpenShift Merge Robot 001f619eab
Merge pull request #13872 from vrothberg/revert-size
Revert "images --size"
2022-04-14 07:18:52 -04:00
Giuseppe Scrivano 3f2939c2ef
run, create: add --passwd-entry
It allows to customize the entry that is written to the `/etc/passwd`
file when --passwd is used.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-04-14 11:22:13 +02:00
Valentin Rothberg 97f93dc78e Revert "images --size"
This reverts commit e133a06d2f.

@nalind found a proper fix in c/storage [1] to address the performance
issue.  So we really don't need the flag anymore.  Note the flag has
never made it into any release.

[1] d76b3606fc

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-14 10:58:36 +02:00
Niall Crowe 3da3afa576 Add log rotation based on log size
Add new functions to logfile.go for rotating and truncating
the events log file once the log file and its contents
exceed the maximum size limit while keeping 50% of the
log file's content

Also add tests to verify log rotation and truncation

Signed-off-by: Niall Crowe <nicrowe@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-14 09:35:29 +01:00
Ed Santiago 9ef745d541 System tests: Usage checks: better error messages
Current error messages are really awful, and cause great
suffering every time someone adds a new subcommand. Let's
see if these are better.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-13 14:09:24 -06:00
Daniel J Walsh 63c38b99f4
Fix --tail log on restart problem
--tail=1 is not working f you restart a container with journald logging.

We see the exit status and then call into the logging a second time
causing all of the logs to print.

Removing the tail log on exited seems to fix the problem.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-13 14:07:15 -04:00
Paul Holzinger 970c8d4724
compat api: use network mode bridge as default
For better docker compatibility we should use the bridge network mode as
default for rootless. This was already done previously but commit
535818414c introduced this regression in v4.0.

Since the apiv2 test are only run rootful we cannot catch this problem
in CI.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-13 15:43:47 +02:00
OpenShift Merge Robot d16e3144e9
Merge pull request #13846 from edsantiago/bats
System tests: fix oops in start --filter tests
2022-04-12 15:37:42 -04:00
Daniel J Walsh 3987c529f4
Add support for ipc namespace modes "none, private, sharable"
Fixes: #13265

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-12 13:35:51 -04:00
OpenShift Merge Robot a82ec1be45
Merge pull request #13787 from Luap99/nohost-api
API: use no_hosts from containers.conf
2022-04-12 13:35:00 -04:00
Ed Santiago 2c800a717c System tests: fix oops in start --filter tests
Bad code got committed by accident: test description on run_podman
line, not test line.

Did not seem to affect tests, but fix it anyway.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-12 11:24:33 -06:00
OpenShift Merge Robot 87d129e805
Merge pull request #13788 from flouthoc/support-volume-opts
run, mount: allow setting driver specific option using `volume-opt=`
2022-04-12 13:17:02 -04:00
Aditya R 81a95fade5
run, mount: allow setting driver specific option using volume-opt
`--mount` should allow setting driver specific options using
`volume-opt` when `type=volume` is set.

This ensures parity with docker's `volume-opt`.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-04-12 12:30:09 +05:30
Paul Holzinger d8a902a167
API: use no_hosts from containers.conf
The API endpoints should properly honour the `no_hosts=true` setting in
containers.conf.

Fixes #13719

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-11 18:41:19 +02:00
OpenShift Merge Robot 4a53689c56
Merge pull request #13822 from edsantiago/buildah_3544_fixed
System tests: reenable ps --external test
2022-04-11 10:37:54 -04:00
Ed Santiago 615099ddb9 System tests: reenable ps --external test
Buildah issue 3544 has been fixed and vendored into podman.
We can reenable a long-skipped test.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-11 05:39:39 -06:00
Paul Holzinger 784a13f577
network create: add support for ipam-driver none
Add a new flag to set the ipam-driver. Also adds a new ipam driver none
mode which only creates interfaces but does not assign addresses.

Fixes #13521

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-11 11:09:15 +02:00
OpenShift Merge Robot 343778f61a
Merge pull request #13811 from flouthoc/container_inspect_entrypoint
container,inspect: convert `Entrypoint` to an array instead of a string
2022-04-08 12:40:23 -04:00
OpenShift Merge Robot cdbc33112e
Merge pull request #13687 from rhatdan/VENDOR
Vendor in new opencontainers/selinux
2022-04-08 10:42:44 -04:00
Aditya R 0cebd158b6
container,inspect: convert Entrypoint to array instead of a string
Convert container entrypoint from string to an array inorder to make
sure there is parity between `podman inspect` and `docker inspect`

Signed-off-by: Aditya R <arajan@redhat.com>
2022-04-08 18:43:37 +05:30
Daniel J Walsh dc17195bd9
Vendor in new opencontainers/selinux
Also update vendor of containers/common,buildah,storage,image

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2069586

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-08 09:02:52 -04:00
Valentin Rothberg e133a06d2f images --size
Add a --size option to podman images to allow for disabling computing
the size of listed images.  If listing images is critical to
performance, user may chose to turn off size computation to speed things
up.

Context: #13755
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-08 10:09:38 +02:00
OpenShift Merge Robot 839744af56
Merge pull request #13696 from Luap99/apiv2-netavark
test/apiv2: support netavark
2022-04-04 14:07:28 -04:00
OpenShift Merge Robot 330205ebed
Merge pull request #13490 from gcalin/13266
pod logs enhancements: option to color logs
2022-04-04 13:43:27 -04:00
OpenShift Merge Robot 4f31ade2b2
Merge pull request #13765 from giuseppe/do-not-set-oom-score-adj
specgen: do not set OOMScoreAdj by default
2022-04-04 13:19:35 -04:00
Giuseppe Scrivano 164b64ea3b
specgen: do not set OOMScoreAdj by default
do not force a value of OOMScoreAdj=0 if it is wasn't specified by the
user.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-04-04 15:40:12 +02:00
Andrew Aylett bf4318e606 Allow creating anonymous volumes with --mount
This fixes #13756.

All the mechanics to create anonymous volumes is already present, but
there's still a validation preventing that path from being taken.  We
remove the validation, which allows the volume to be created
successfully.

Signed-off-by: Andrew Aylett <andrew@aylett.co.uk>
2022-04-02 21:10:40 +01:00
OpenShift Merge Robot d4394ea368
Merge pull request #13665 from jwhonce/issues/13535
Add build test for .containerignore tar file
2022-04-01 11:59:46 -04:00
OpenShift Merge Robot 23e57575b0
Merge pull request #13594 from cdoern/podVolumes
fix pod volume passing and alter infra inheritance
2022-04-01 09:51:23 -04:00
Giuseppe Scrivano 1cd529b22d
specgen: permit --privileged and --cap-add
--cap-add is useful when running a privileged container with UID != 0,
so that individual capabilities can be added to the container process.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-04-01 10:15:17 +02:00
Jhon Honce f8c2df87cb Add build test for .containerignore tar file
Ensure a directory added to .containerignore on client is not included
in tar sent to remote podman API service

* Clean up podman invocations to not include duplicate --remote and
  --url flags
* Use pkill vs. pgrep when cleaning up podman API service in tests
* Add exit code when logging error when testing

Closes #13535

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-31 08:48:54 -07:00
Paul Holzinger e5745139a7
cli commands: better error for unsupported commands
When you run podman-remote unsahre for example you currently get:
Error: unrecognized command `podman-remote unshare`

This is because we do not add the command to the cobra tree when we run
in remote mode. However this is a bad user experience since it is not
clear that the command is only supported for local podman. Users are
left wondering why this does not work and could think the documentation
is wrong.

To fix it we add a clear error message:
Error: cannot use command "podman-remote unshare" with the remote podman client

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-31 16:20:18 +02:00
Aditya R daeea48df5
kube: configmap volume should be reused if already exists
`podman play kube` creates a new volume for configmap, if same configmap
is applied again volume can be re-used, there is no need to remove and
re-create the volume again

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-31 15:07:22 +05:30
OpenShift Merge Robot c08e8c30a1
Merge pull request #13697 from edsantiago/upgrade_test_matrix
Upgrade tests: reexamine cross-testing matrix
2022-03-30 16:41:21 -04:00
OpenShift Merge Robot fbbf5e88fd
Merge pull request #13646 from Luap99/slirp4netns-portrange
fix slirp4netns port forwarding with ranges
2022-03-30 13:25:20 -04:00
Paul Holzinger 23cdbf322d
test/apiv2: support netavark
Since netavark does not support dhcp yet we have to create a macvlan
network with a static subnet. Since we do not use the network to run
containers the actual subnet does not matter.

Also stop hard coding the network id. Unlike the cni backend the
netavark backend creates random ids that are not predictable.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-30 13:38:47 +02:00
John Matthews 1ffcc4a888 Add 'Os' to be queried via 'version' output
Signed-off-by: John Matthews <jwmatthews@gmail.com>
2022-03-29 18:10:59 -04:00
Ed Santiago 2a882b7703 Upgrade tests: reexamine cross-testing matrix
- removed: v1.9.0, v2.0.6
 + added:   v3.4.0

(Cannot add v4 because there's no such image on quay. As soon
as one appears, we should add it.)

Add a workaround for a UTS namespace conflict new in v3.4

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-03-29 15:24:36 -06:00
Paul Holzinger eedaaf33cd
fix slirp4netns port forwarding with ranges
The slirp4netns port forwarder was not updated to make use of the new
port format. This results in a problem when port ranges are used since
it does not read the range field from the port.

Update the logic to iterate through all ports with the range and
protocols. Also added a system test for port ranges with slirp4netns,
rootlesskit and the bridge network mode.

Fixes #13643

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-29 19:18:40 +02:00
OpenShift Merge Robot 3990f9c51e
Merge pull request #13692 from Luap99/upgrade-test
upgrade tests: fix networking problems
2022-03-29 18:32:03 +02:00
gcalin c185d8c0d6
Add option for pod logs to display different colors per container.
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
Signed-off-by: gcalin <caling@protonmail.com>
2022-03-29 17:29:13 +02:00
cdoern 7a53428049 fix pod volume passing and alter infra inheritance
the infra Inherit function was not properly passing pod volume information to new containers
alter the inherit function and struct to use the new `ConfigToSpec` function used in clone
pick and choose the proper entities from a temp spec and validate them on the spegen side rather
than passing directly to a config

resolves #13548

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2022-03-29 11:10:46 -04:00
Paul Holzinger 61c518627d
upgrade tests: fix networking problems
With podman4 we support netavark, however old versions will still use
cni. Since netavark and cni can conflict we should not mix them.
Remove the network setup from the inital podman command and create the
directories manually to prevent such conflicts.

Also the update to 4.0 changes the network db structure. While it is
compatible from 3.X to 4.0 it will fail the other way around. In this
test it will happen because the cleanup process still uses the old
podman while the network connect/disconnect test already changed the db
format. Therefore the cleanup process cannot see any networks and will
not tear it down. The following start will fail because the ip address
is already assigned.

Fixes #13679

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-29 16:42:50 +02:00
Daniel J Walsh cdf74f2082
Set systemd mode if entrypoint begins with /bin/sh -c
Fixes: https://github.com/containers/podman/issues/13324

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-28 16:30:47 -04:00
OpenShift Merge Robot 54f808e4dd
Merge pull request #13651 from jwmatthews/fix13650
Fixes errors from 'manifest push' being dropped in remote case
2022-03-28 15:37:50 +02:00
OpenShift Merge Robot ffe87c0bdf
Merge pull request #13677 from flouthoc/rename-event
libpod, event: generate a valid event on container `rename` operation
2022-03-28 15:15:51 +02:00
Aditya R 82ed99b6af
event: generate a valid event on container rename operation
Following commit ensures that podman generates a valid event on `podman
container rename` where event specifies that it is a rename event and
container name swtichted to the latest name.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-28 15:07:02 +05:30
John Matthews 7989880509 Fixes errors from 'manifest push' being dropped in remote case
Signed-off-by: John Matthews <jwmatthews@gmail.com>
2022-03-27 07:33:13 -04:00
Daniel J Walsh d106b294b4
Switch all calls to filepath.Walk to filepath.WalkDir
WalkDir should be faster the Walk, since we often do
not need to stat files.

[NO NEW TESTS NEEDED] Existing tests should find errors.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-27 07:18:25 -04:00
OpenShift Merge Robot 56b2937f87
Merge pull request #13653 from jmontleon/fix-manifest-push-header
Resolves #13629 Add RegistryAuthHeader to manifest push
2022-03-27 13:13:42 +02:00
OpenShift Merge Robot ddfa087d00
Merge pull request #13660 from rhatdan/error
Remove error stutter
2022-03-27 13:11:31 +02:00
jason 3cc1739373 Resolves #13629 Add RegistryAuthHeader to manifest push
Signed-off-by: Jason Montleon <jmontleo@redhat.com>
2022-03-26 16:39:11 -04:00
Daniel J Walsh 7680211ede
Remove error stutter
When podman gets an error it prints out "Error: " before
printing the error string.  If the error message starts with
error, we end up with

Error: error ...

This PR Removes all of these stutters.

logrus.Error() also prints out that this is an error, so no need for the
error stutter.

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-25 21:47:04 -04:00
Daniel J Walsh ffbab30d7b
Run codespell to cleanup typos
[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-25 15:34:41 -04:00
Giuseppe Scrivano 640c2d53a8
test: fix podman run test as rootless
aafa80918a introduced the regression.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-03-25 15:50:31 +01:00
OpenShift Merge Robot 7934b77dd5
Merge pull request #13531 from cdoern/build
Add Context Directory to tar
2022-03-24 19:15:46 +01:00
OpenShift Merge Robot e657c7a170
Merge pull request #13622 from rhatdan/systemd1
When running systemd in a container set container_uuid
2022-03-24 19:05:44 +01:00
OpenShift Merge Robot caaaf07c1e
Merge pull request #13587 from giuseppe/clone-to-pod
container: allow clone to an existing pod
2022-03-24 18:09:43 +01:00
Giuseppe Scrivano ab8e15f6ac
Merge pull request from GHSA-qvf8-p83w-v58j
do not set the inheritable capabilities
2022-03-24 17:02:20 +01:00
Giuseppe Scrivano b469bf5c05
container: allow clone to an existing pod
Closes: https://github.com/containers/podman/issues/3979

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-03-24 14:24:50 +01:00
Daniel J Walsh 5e28cbc5fc
When running systemd in a container set container_uuid
systemd expects the container_uuid environment variable be set
when it is running in a container.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-23 15:05:30 -04:00
OpenShift Merge Robot a8743d3327
Merge pull request #13588 from flouthoc/import-os-arch
import: allow users to set `--os`, `--arch` and `--variant` of image imports
2022-03-23 13:15:47 +01:00
Giuseppe Scrivano aafa80918a
do not set the inheritable capabilities
The kernel never sets the inheritable capabilities for a process, they
are only set by userspace.  Emulate the same behavior.

Closes: CVE-2022-27649

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-03-23 09:05:18 +01:00
Aditya R eedce31eb4
import: allow users to set os, arch and variant of imports
Allows users to set `--os` , `--arch` and `--variant` of the image
created from the custom import.

Following is useful when user is already aware of the values which are
correct for their generated rootfs

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-23 11:22:55 +05:30
OpenShift Merge Robot c840f64e41
Merge pull request #13593 from Luap99/compose-flakev2
fix compose test error in retry logic
2022-03-22 19:36:28 +01:00
cdoern 5e1e13c18c add contextDir to tar on remote
podman build fails on remote build when using a relative context directory.
This is because the context dir was not being added to the tar, so when remote
the compat build function would not be able to stat the contextDir.

resolves #13293

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2022-03-22 10:33:05 -04:00
Paul Holzinger c25213c8f8
fix compose test error in retry logic
We cannot use local var outside of a function. We have to use a global
one.

Log: https://storage.googleapis.com/cirrus-ci-6707778565701632-fcae48/artifacts/containers/podman/5970023511490560/html/compose_v2-podman-fedora-35-root-host.log.html

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-22 15:22:17 +01:00
OpenShift Merge Robot 901066acd1
Merge pull request #13580 from vrothberg/enable-linters
enable linters
2022-03-22 15:14:38 +01:00
Valentin Rothberg 06dd9136a2 fix a number of errcheck issues
Numerous issues remain, especially in tests/e2e.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:15:28 +01:00
Valentin Rothberg 6c030cd573 fix a number of `godot` issues
Still an unknown number remains but I am running out of patience.
Adding dots is not the best use of my time.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Valentin Rothberg 0f12b6fe55 linter: enable nilerr
A number of cases looked suspicious, so I marked them with `FIXME`s to
leave some breadcrumbs.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Valentin Rothberg 9e8cca26a1 test/e2e/inspect_test.go: wait for sessions
Make sure we're waiting for the ls container to finish to prevent
potential flakes or future regressions.

Spotted while enabling a linter.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Valentin Rothberg fb792f7ed4 linter: enable ineffassign
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Valentin Rothberg f72a678f2a linter: enable errchkjson
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Aditya R 6d6bdabc8c
healthcheck: stop showing wrong status when --no-healthcheck is set
Containers started with `--no-healthcheck` are configured to contain no
healthcheck and test configured as `NONE`. Podman shows wrong status as
such use cases.

Following commit fixes the faulty behavior of stauts field for
containers started with `--no-healthcheck`

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-22 12:28:55 +05:30
OpenShift Merge Robot e034db16bf
Merge pull request #13575 from Luap99/percent
podman system df: fix percent calculation
2022-03-21 15:04:46 +01:00
Paul Holzinger e3cc0717b2
podman system df: fix percent calculation
The calculate the percentage we need floating point numbers. The current
code however casted the result of reclaimable/size to an int first.
Casting to an int in go will just discard the decimal points, thus the
result was either 0 or 1 so if multiplied by 100 it would show up as 0%
or 100%.

To fix this we have to multiply by 100 first before casting the result
to an int. Also add a check for div by zero which results in NaN and use
math.Round() to correctly round a number.

Ref #13516

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-21 13:19:31 +01:00
Ed Santiago 53e770566b pod system tests: clean up stray image
One of the pod tests was leaving a stray image behind,
causing scary red warnings in CI logs. Clean that up.

Also, now that #13541 has merged, use 'rmi --ignore' instead of
ignoring exit status from rmi

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-03-21 05:07:34 -06:00
OpenShift Merge Robot 248dbf6089
Merge pull request #13541 from vrothberg/rmi-ignore
podman rmi --ignore
2022-03-21 10:34:40 +01:00
OpenShift Merge Robot 0248ba4897
Merge pull request #13558 from Luap99/compose-flake
fix compose test flake
2022-03-19 11:26:40 +01:00
Valentin Rothberg 95dad4d8a4 podman rmi --ignore
Add an `--ignore` flag to `podman image rm` to instruct ignoring image
if a specified image does not exist and to not throw an error.  Other
commands (e.g., `podman container rm`) already support this flag.

Such an `--ignore` flag can come in handy in clean-up scripcts such as
the teardown phases in the Podman tests.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-19 10:05:43 +01:00
OpenShift Merge Robot c2eae35c60
Merge pull request #13554 from vrothberg/vendor-common
vendor c/common@0ededd18a1
2022-03-18 22:52:55 +01:00
Paul Holzinger 54641f5f76
fix compose test flake
Reading from the nc socket is flaky because docker-compose only starts
the containers. We cannot know at this point if the container did already
send the message. Give the container 5 seconds time to send the message
to prevent flakes.

This happened rarely with compose v1 but it looks like it will happen a
lot more with compose v2.

Example failure log:
https://storage.googleapis.com/cirrus-ci-6707778565701632-fcae48/artifacts/containers/podman/6567556239589376/html/compose_v2-podman-fedora-35-rootless-host.log.html

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-18 16:59:14 +01:00
Paul Holzinger 622d0068e4
fix dual stack network e2e flake
We need to use different ipv6 subnets for the tests since they can
collide otherwise when the tests are run in parallel.

In the future we should rethink hardcoding subnets for ipv4/ipv6. This
will make it impossible to run these tests if the subnet is already used
on the host.

Example log: https://storage.googleapis.com/cirrus-ci-6707778565701632-fcae48/artifacts/containers/podman/5711403297275904/html/int-podman-fedora-35-root-host-netavark.log.html#t--podman-network-create-with-multiple-subnets-dual-stack-with-gateway-and-range--1

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-18 15:35:00 +01:00
Valentin Rothberg 57cdc21b00 vendor c/common@0ededd18a1
Update the login tests to reflect the latest changes to allow http{s}
prefixes (again) to address bugzilla.redhat.com/show_bug.cgi?id=2062072.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-18 15:18:30 +01:00
OpenShift Merge Robot 3853ef9b59
Merge pull request #13540 from mheon/fix_11822
Deduplicate between Volumes and Mounts in compat API
2022-03-18 12:48:41 +01:00
Valentin Rothberg ea08765f40 go fmt: use go 1.18 conditional-build syntax
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-18 09:11:53 +01:00
Matthew Heon 4b359e4598 Set names in compose tests based on version
Compose v2 uses dashes as separators instead of hyphens. This
broke some tests that relied upon container names. Set the name
conditionally to make it safe for both.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-03-17 15:16:13 -04:00
OpenShift Merge Robot e59f71d230
Merge pull request #13530 from vrothberg/fix-13529
podman create: building local pause image: do not read ignore files
2022-03-17 18:28:24 +01:00
Valentin Rothberg ff54aaa634 podman create: building local pause image: do not read ignore files
Make sure to ignore local {container,docker}ignore files when building a
local pause image.  Otherwise, we may mistakenly not be able to copy
catatonit into the build container.

Fixes: #13529
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-17 14:18:16 +01:00
Nirmal Patel 714e5a13d9 Separator is no longer prepended when prefix is empty on podman generate systemd
When podman generate systemd is invoked, it previously did not check if
container-prefix or pod-prefix are empty. When these are empty, the file name
starts with the separator, which is hyphen by default. This results in files
like '-containername.service'.

The code now checks if these prefixes are empty. If they are, the filename no
longer adds a separator. Instead, it uses name or ID of the container or pod.

Closes #13272

Signed-off-by: Nirmal Patel <npate012@gmail.com>
2022-03-16 20:26:59 -04:00
OpenShift Merge Robot b1d37a7e21
Merge pull request #13450 from jwhonce/bz/2052697
Exit code change BZ #2052697
2022-03-16 17:23:50 -04:00
Jhon Honce 1387b5bd8a Add test for BZ #2052697
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-16 11:27:07 -07:00
Jhon Honce ca7376bb11 Exit with 0 when receiving SIGTERM
* systemctl stop podman.service will now return exit code 0
* Update test framework to support JSON boolean and numeric values

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-15 14:45:11 -07:00
Paul Holzinger a0ad1f2ad4
remove unneeded k8s code
There is a lot of unneeded code, k8s is the by far the biggest
dependency in podman. We should remove as much as possible so that we
only have the stuff left that we use.

This is just a quick skim over the code which removes a lot of the
generated code and many packages that are now unused.
I know that this will be impossible to properly review. I will try to
make smaller changes in follow up work.

Right now this reduces about 8 MB in binary size!!!

[NO NEW TESTS NEEDED] Hopefully existing tests will catch any problems.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-15 14:48:08 +01:00
Paul Holzinger 918fc88a98
move k8s deps into podman
We only need a small part of the k8s dependencies but they are the
biggest dependencies in podman by far. Moving them into podman allows us
to remove the unnecessary parts.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-15 14:46:29 +01:00
OpenShift Merge Robot 68ce83fe91
Merge pull request #13238 from lsm5/e2e-aardvark
test/e2e: add aardvark specific tests
2022-03-15 06:34:07 -04:00
OpenShift Merge Robot 758f2c7a09
Merge pull request #13498 from flouthoc/podman-vendor-buildah
vendor: update `c/buildah`, `c/image` and `c/storage`
2022-03-15 06:32:07 -04:00
Aditya R daebf50b89
apply-podman-deltas: skip modified test case for --add-host which adds anomaly
All podman tests in CI expects exit code 125, which might not be true since exit code from runtime
is relayed as it is without any modification both in `buildah` and `podman`. Following behviour is seen when PR https://github.com/containers/buildah/pull/3809
added a test here https://github.com/containers/buildah/blob/main/tests/bud.bats#L3183 which relays exit code from runtime as it
is, in case of both `podman` and `buildah`. However apart from this test case no other test case was able to trigger this behviour hence
marking this test as an anomaly. Since its debatable if we should override this returned error number or not hence adding a note here.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-14 20:41:38 +05:30
LStandman e8968c867f Add support for --chrootdirs
Signed-off-by: LStandman <65296484+LStandman@users.noreply.github.com>
2022-03-14 10:31:58 +02:00
Aditya R 780d4b2d65
vendor: bump buildah, c/image and c/storage
Bumps

c/buildah to -> `v1.24.3-0.20220310160415-5ec70bf01ea5`
c/storage to -> `v1.38.3-0.20220308085612-93ce26691863`
c/image to -> `v5.20.1-0.20220310094651-0d8056ee346f`

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-14 12:26:12 +05:30
Daniel J Walsh feaa1a134a
Add podman play kube --annotation
Allow users to add annotions in the podman play kube command.
This PR Also fixes the fact that annotations in the pod spec were
not being passed down to containers.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-09 17:30:01 -05:00
OpenShift Merge Robot acfcecf2ae
Merge pull request #12913 from rhatdan/kube
Add --context-dir option to podman play kube
2022-03-09 16:19:59 -05:00
OpenShift Merge Robot 4e21acd7b8
Merge pull request #13455 from rhatdan/docker
Fix handling of tmpfs-mode for tmpfs creation in compat mode
2022-03-09 15:53:58 -05:00
OpenShift Merge Robot 418ab2e5e1
Merge pull request #13421 from hshiina/device-rule
Set default rule at the head of device configuration
2022-03-09 10:28:24 -05:00
Daniel J Walsh 166edf00a1
Fix handling of tmpfs-mode for tmpfs creation in compat mode
The permissions on disk were wrong since we were not converting to
octal.

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

[NO NEW TESTS NEEDED] Since we don't currently test using the docker
client

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-09 08:03:42 -05:00
Lokesh Mandvekar 8cfdddf509
test/e2e: add aardvark specific tests
Co-authored-by: Brent Baude <bbaude@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2022-03-08 15:07:55 -05:00
Ed Santiago e66c46441a Skip flaky pprof tests
pprof tests are way too flaky, and are causing problems for
community contributors who don't have privs to press Re-run.

There has been no activity or interest in fixing the bug,
and it's not something I can fix. So, just disable the test.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-03-08 11:26:43 -07:00
OpenShift Merge Robot a08e4e5b46
Merge pull request #13457 from ashley-cui/flake
Move secret-verify-leak containerfile into its own Directory
2022-03-08 13:18:11 -05:00
Ashley Cui 9ce3c0a87a Move secret-verify-leak containerfile into its own Directory
Secret-verify-leak is causing flakes, when running in parallel tests.
This is because remote secrets are copied into the context directory to
send to the API server, and secret-verify-leak is doing a COPY * and
then checking if the temporary secret file ends up in the container or
not. Since all the temporary files are prefixed with
"podman-build-secret", this test checks if podman-build-secret is in the
image. However, when run in parallel with other tests, other temporary
podman-build-secrets might be in the context dir. Moving
secret-verify-leak into its own directory makes sure that the context
dir is used only by this one test.

Also renamed Dockerfile -> Containerfile and cleaned up unused
Containerfiles.

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-03-08 10:05:42 -05:00
😎 Mostafa Emami 611b45c517 Inspect network info of a joined network namespace
Closes: https://github.com/containers/podman/issues/13150
Signed-off-by: 😎 Mostafa Emami <mustafaemami@gmail.com>
2022-03-08 11:00:36 +01:00
Hironori Shiina d2f77c2568 Set default rule at the head of device configuration
The default rule should be set at the head of device configuration.
Otherwise, rules for user devices are overridden by the default rule so
that any access to the user devices are denied.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
2022-03-07 18:12:17 -05:00
OpenShift Merge Robot be3858bcf1
Merge pull request #13406 from jwhonce/wip/docker-py
Move all python tests to pytest
2022-03-07 06:30:57 -05:00
Urvashi Mohnani d302c08cff Throw an error if kube yaml has duplicate ctr names
Error out if the kube yaml passed to play kube has more
than one container or init container with the same name.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-03-04 15:08:52 -05:00
Jhon Honce dca2e7924b Move all python tests to pytest
* Add configuration to add report header for python client used in tests
* Move report headers into the individual test runners vs runner.sh

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-04 10:35:29 -07:00
OpenShift Merge Robot f4d6e87772
Merge pull request #13413 from giuseppe/pod-no-use-cgroups-if-disabled
libpod: pods do not use cgroups if --cgroups=disabled
2022-03-04 04:26:22 -05:00
OpenShift Merge Robot 3cfb70f953
Merge pull request #13404 from flouthoc/bump-to-race-free-deps
deps: bump to race-free `c/image` and `c/storage` along with test to verify `concurrent/parallel` builds
2022-03-03 12:15:19 -05:00
Aditya R 63f92d0a66
test: add a test to verify race free concurrent/parallel builds
Invoking parallel/concurrent builds from podman race against each other
following behviour was fixed in
https://github.com/containers/storage/pull/1153 and https://github.com/containers/image/pull/1480

Test verifies if following bug is fixed in new race-free API or not.
Read more about this issue, see bz 2055487 for more details.

More details here: https://github.com/containers/buildah/pull/3794 and https://github.com/containers/podman/pull/13339

Co-authored-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-03 21:03:35 +05:30
Giuseppe Scrivano a901c919ab
libpod: pods do not use cgroups if --cgroups=disabled
do not attempt to use cgroups with pods if the cgroups are disabled.
A similar check is already in place for containers.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-03-03 13:23:07 +01:00
Aditya R 0bd0ad5943
container: workdir resolution must consider symlink if explicitly configured
While resolving `workdir` we mostly create a `workdir` when `stat`
fails with `ENOENT` or `ErrNotExist` however following cases are not
true when user explicitly specifies a `workdir` while `running` using
`--workdir` which tells `podman` to only use workdir if its exists on
the container. Following configuration is implicity set with other
`run` mechanism like `podman play kube`

Problem with explicit `--workdir` or similar implicit config in `podman play
kube` is that currently podman ignores the fact that workdir can also be
a `symlink` and actual `link` could be valid.

Hence following commit ensures that in such scenarios when a `workdir`
is not found and we cannot create a `workdir` podman must perform a
check to ensure that if `workdir` is a `symlink` and `link` is resolved
successfully and resolved link is present on the container then we
return as it is.

Docker performs a similar behviour.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-02 19:02:33 +05:30
OpenShift Merge Robot f0c6114a39
Merge pull request #13380 from jwhonce/wip/docker-py
Refactor docker-py compatibility tests
2022-03-01 15:20:38 -05:00
Jhon Honce 7729afe979 Refactor docker-py compatibility tests
* Add which python client is being used to run tests, see "python
  client" below.
* Remove redundate code from test classes
* Update/Add comments to modules and classes

======================================================= test session starts ========================================================
platform linux -- Python 3.10.0, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
python client -- DockerClient
rootdir: /home/jhonce/Projects/go/src/github.com/containers/podman
plugins: requests-mock-1.8.0
collected 33 items

test/python/docker/compat/test_containers.py ...s..............  [ 54%]
test/python/docker/compat/test_images.py ............  [ 90%]
test/python/docker/compat/test_system.py ...  [100%]

Note: Follow-up PRs will verify the test results and expand the tests.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-01 09:06:52 -07:00
Daniel J Walsh 675d775eb5
Add --context-dir option to podman play kube
This option was requested so that users could specify alternate
locations to find context directories for each image build. It
requites the --build option to be set.

Partion Fix: https://github.com/containers/podman/issues/12485

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-01 08:47:09 -05:00
OpenShift Merge Robot 8bdda91ab7
Merge pull request #13362 from keonchennl/pod-logs-add-flag
Add the names flag for pod logs
2022-03-01 08:43:50 -05:00
Xueyuan Chen 40c6192e9e Add the names flag for pod logs
Fixes containers#13261

Signed-off-by: Xueyuan Chen <X.Chen-47@student.tudelft.nl>
2022-03-01 00:18:39 +01:00
Daniel J Walsh 3dc1b8e83f
Add podman volume mount support
Fixes: https://github.com/containers/podman/issues/12768

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-28 14:26:22 -05:00
OpenShift Merge Robot 991c90de1f
Merge pull request #13314 from flouthoc/container-commit-squash
container-commit: support `--squash` to squash layers into one if users want.
2022-02-23 13:07:00 -05:00
Aditya R fbbcb957c7
container-commit: support --squash to squash layers into one
Allow users to commit containers into a single layer.

Usage
```bash
podman container commit --squash <name>
```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-23 17:38:28 +05:30
OpenShift Merge Robot 8b2432422f
Merge pull request #13232 from rhatdan/volumes
Don't log errors on removing volumes inuse, if container --volumes-from
2022-02-23 03:26:59 -05:00
Daniel J Walsh 6f7a803d06
Cleanup display of trust with transports
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-22 15:08:58 -05:00
OpenShift Merge Robot fab82a7c9c
Merge pull request #13059 from cdoern/clone
Implement Podman Container Clone
2022-02-22 10:10:49 -05:00
Daniel J Walsh c4dfbd58f5
Don't log errors on removing volumes inuse, if container --volumes-from
When removing a container created with a --volumes-from a container
created with a built in volume, we complain if the original container
still exists.  Since this is an expected state, we should not complain
about it.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-21 16:47:12 -05:00
Paul Holzinger b19251242e
system tests: cleanup networks on teardown
When a test which creates a network fail it will not remove the network.
The teardown logic should remove the networks. Since there is no --all
option for network rm we use network prune --force.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-21 21:57:08 +01:00
OpenShift Merge Robot a746a61a17
Merge pull request #13286 from flouthoc/kube-build-false-default
kube: honor `--build=false` if specified.
2022-02-21 15:33:39 -05:00
OpenShift Merge Robot b3963e7081
Merge pull request #13296 from Romain-Geissler-1A/url-and-connection-implies-remote
Option --url and --connection should imply --remote.
2022-02-21 15:21:37 -05:00
OpenShift Merge Robot c9359e1494
Merge pull request #13306 from Luap99/flag-error
provide better error on invalid flag
2022-02-21 15:11:37 -05:00
Aditya R 9ce61e3a49
kube: honor --build=false and make --build=true by default
`podman play kube` tries to build images even if `--build` is set to
false so lets honor that and make `--build` , `true` by default so it
matches the original behviour.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-21 23:52:48 +05:30
Paul Holzinger 44d037898e
provide better error on invalid flag
Add a extra `See 'podman command --help'` to the error output.
With this patch you now get:
```
$ podman run -h
Error: flag needs an argument: 'h' in -h
See 'podman run --help'
```

Fixes #13082
Fixes #13002

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-21 19:12:12 +01:00
Ed Santiago f018c07edf System tests: show one-line config overview
We're running into problems that are impossible to diagnose
because we have no idea if the SUT is using netavark or CNI.
We've previously run into similar problems with runc/crun,
or cgroups 1/2.

This adds a one-line 'echo' with important system info. Now,
when viewing a full test log, it will be possible to view
system settings in one glance.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-02-21 08:49:11 -07:00
cdoern 94df701512 Implement Podman Container Clone
podman container clone takes the id of an existing continer and creates a specgen from the given container's config
recreating all proper namespaces and overriding spec options like resource limits and the container name if given in the cli options

this command utilizes the common function DefineCreateFlags meaning that we can funnel as many create options as we want
into clone over time allowing the user to clone with as much or as little of the original config as they want.

container clone takes a second argument which is a new name and a third argument which is an image name to use instead of the original container's

the current supported flags are:

--destroy (remove the original container)
--name (new ctr name)
--cpus (sets cpu period and quota)
--cpuset-cpus
--cpu-period
--cpu-rt-period
--cpu-rt-runtime
--cpu-shares
--cpuset-mems
--memory
--run

resolves #10875

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-20 21:11:14 -05:00
Romain Geissler 23a7f4e0de Option --url and --connection should imply --remote.
Closes #13242

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2022-02-19 14:53:37 +00:00
David Gibson db4d15e852 Propagate $CONTAINERS_CONF to conmon
The CONTAINERS_CONF environment variable can be used to override the
configuration file, which is useful for testing.  However, at the moment
this variable is not propagated to conmon.  That means in particular, that
conmon can't propagate it back to podman when invoking its --exit-command.
The mismatch in configuration between the starting and cleaning up podman
instances can cause a variety of errors.

This patch also adds two related test cases.  One checks explicitly that
the correct CONTAINERS_CONF value appears in conmon's environment.  The
other checks for a possible specific impact of this bug: if we use a
nonstandard name for the runtime (even if its path is just a regular crun),
then the podman container cleanup invoked at container exit will fail.
That has the effect of meaning that a container started with -d --rm won't
be correctly removed once complete.

Fixes #12917

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-02-18 12:35:25 +11:00
David Gibson d615ab81f9 tests: Remove inaccurate comment
This comment refers to overiding $PODMAN although the code below does
nothing of the sort.  Presumbly the comment has been outdated by altering
the containers.conf / $CONTAINERS_CONF instead.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-02-18 12:35:25 +11:00
Matthew Heon 1252f9dd33 Fix a potential flake in volume plugins tests
We could remove the container running the volume plugins, before
the containers using the volume plugins; this could cause
unmounting the volumes to fail because the plugin could not be
contacted.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-02-17 09:46:35 -05:00
Valentin Rothberg b62816578e e2e: merge after/since image-filter tests
Merge the two tests to speed up testing.  Both built the exact same
images.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-02-16 10:33:57 +01:00
Brent Baude 6a8d29eead Changes of docker descriptions
It looks like some descriptions have changed on the docker registry
where we had been searching for images that include 'alpine'.  We are
now seeing an image in the initial list that has 'alpine' in its
description.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-15 15:21:00 -06:00
Brent Baude 5b98efe1d1 Fix images since/after tests
For the since and after imagve filter tests, instead of using the
read-only cache of images, we just use the empty r/w store.  We then
build three images that are strictly predictable.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-15 12:33:51 -06:00
OpenShift Merge Robot eb19a7582e
Merge pull request #13144 from lsm5/e2e-netavark
enable netavark specific tests
2022-02-11 20:44:07 -05:00
OpenShift Merge Robot 1b22ad95c1
Merge pull request #13214 from adrianreber/2022-02-11-fix-tests
Fix checkpoint/restore pod tests
2022-02-11 16:46:08 -05:00
Lokesh Mandvekar 6f9f78f7f2 enable netavark specific tests
These are copies of the CNI tests with modifications wherever
neccessary.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2022-02-11 13:34:28 -05:00
Adrian Reber 4b90542d5b
Fix checkpoint/restore pod tests
Checkpoint/restore pod tests are not running with an older runc and now
that runc 1.1.0 appears in the repositories it was detected that the
tests were failing. This was not detected in CI as CI was not using runc
1.1.0 yet.

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-02-11 15:11:48 +00:00
Daniel J Walsh 4966adddbb
Make sure building with relative paths work correctly.
Fixes: https://github.com/containers/podman/issues/12763

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-10 20:40:09 -05:00
OpenShift Merge Robot 0144413a5a
Merge pull request #13191 from mheon/resolvconf_fixes
Modify /etc/resolv.conf when connecting/disconnecting
2022-02-10 12:24:03 -05:00
Matthew Heon 87cca4e5e3 Modify /etc/resolv.conf when connecting/disconnecting
The `podman network connect` and `podman network disconnect`
commands give containers access to different networks than the
ones they were created with; these networks can also have DNS
servers associated with them. Until now, however, we did not
modify resolv.conf as network membership changed.

With this PR, `podman network connect` will add any new
nameservers supported by the new network to the container's
/etc/resolv.conf, and `podman network disconnect` command will do
the opposite, removing the network's nameservers from
`/etc/resolv.conf`.

Fixes #9603

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-02-10 09:44:00 -05:00
Jhon Honce c4676c5719 Add version guard to libpod API endpoints
* Ensure meaningful behaviour when called with /v3.x.x semantics
* Change return code to 409 from 500 when client attempts to use an
  existing network name
* Update API bats test runner to support /v4.0.0 endpoints by default

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-02-09 14:22:42 -07:00
OpenShift Merge Robot cbd0980d5b
Merge pull request #13159 from Luap99/slirp4-scope
move rootless netns slirp4netns process to systemd user.slice
2022-02-08 07:10:15 -05:00
Paul Holzinger 8d0fb0a4ed
move rootless netns slirp4netns process to systemd user.slice
When running podman inside systemd user units, it is possible that
systemd kills the rootless netns slirp4netns process because it was
started in the default unit cgroup. When the unit is stopped all
processes in that cgroup are killed. Since the slirp4netns process is
run once for all containers it should not be killed. To make sure
systemd will not kill the process we move it to the user.slice.

Fixes #13153

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-07 17:38:53 +01:00
OpenShift Merge Robot 46d9a2570a
Merge pull request #13156 from flouthoc/fix-compat-build-response-header
compat: endpoint `/build` must set header `content type` as `application/json` in response header.
2022-02-07 10:34:22 -05:00
Ed Santiago d0d1ffa43e Cleanup: remove obsolete/misleading bug workaround
Followup to #13129: remove a no-longer-necessary workaround
for a healthcheck bug.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-02-07 06:58:19 -07:00
OpenShift Merge Robot b1dcd025c6
Merge pull request #13129 from flouthoc/healthcheck-session-read-from-pipe
healthcheck, libpod: Read healthcheck event output from os pipe
2022-02-07 08:52:23 -05:00
Aditya R 3b561a4682
compat: endpoint /build must set header content type as application/json in reponse
Lot of clients are expecting proper `Content-type: application/json`
configured in response headers of `/build` compat api. Following commit
fixes that.

Fixes issues where code is setting header field after writing header
which is wrong. We must set `content-type` before we write and flush
http header.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-07 13:38:19 +05:30
OpenShift Merge Robot ec390d5d35
Merge pull request #13143 from Luap99/dns
append podman dns search domain
2022-02-04 11:49:11 -05:00
Aditya R 3cf64a8e9a
tests: retrofit healthcheck system tests
All the healthcheck return output now but systems tests is written to
expect empty output which seems wrong.

Modify jq output to contain newline character rather than actual newline

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-04 21:15:15 +05:30
Aditya R 4f77331c9d
healthcheck, libpod: Read healthcheck event output from os pipe
It seems we are ignoring output from healthcheck session.
Open a valid pipe to healthcheck session in order read its output.

Use common pipe for both `stdout/stderr` since that was the previous
behviour as well.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-04 21:15:03 +05:30
Paul Holzinger d733c3baa2
append podman dns search domain
Append the podman dns seach domain to the host search domains when we
use the dnsname/aardvark server. Previously it would only use podman
seach domains and discard the host domains.

Fixes #13103

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-04 16:16:06 +01:00
OpenShift Merge Robot 956664f65b
Merge pull request #12930 from cdoern/podCgroup
Podman pod create --share-parent vs --share=cgroup
2022-02-04 09:41:12 -05:00
Ed Santiago 7cfe4d3fe7 System tests: revert emergency skip of checkpoint tests
Revert #13049. criu-3.16.1-6.fc36 fixes the problem and is
now in fc36 stable:

   https://bodhi.fedoraproject.org/updates/FEDORA-2022-183b337712

(Yes, I confirmed that tests pass on a rawhide vm)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-02-03 14:48:35 -07:00
Chris Evich 642a691cbb
Cirrus: Add netavark/aardvark system test task
Also add a system-test that verifies netavark driver is in use when
magic env. var. is set.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-02-03 13:07:56 -05:00
OpenShift Merge Robot 08930b24b9
Merge pull request #13117 from Luap99/resolv
Revert "Move each search dns to its own line"
2022-02-03 09:37:20 -05:00
cdoern 9eb88ea474 Podman pod create --share-parent vs --share=cgroup
separated cgroupNS sharing from setting the pod as the cgroup parent,
made a new flag --share-parent which sets the pod as the cgroup parent for all
containers entering the pod

remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent.

resolves #12765

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-03 09:30:17 -05:00
Paul Holzinger 55c4a1468b
system prune: remove all networks
podman system prune should also remove all networks. When we want to
users to migrate to the new network stack we recommend to run podman
system reset. However this did not remove networks and if there were
still networks around we would continue to use cni since this was
considered an old system.

There is one exception for the default network. It should not be removed
since this could cause other issues when it no longer exists. The
network backend detection logic ignores the default network so this is
fine.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-03 13:14:07 +01:00
OpenShift Merge Robot 89f71177aa
Merge pull request #12859 from baude/netavarke2e
Enable e2e tests with netavark
2022-02-02 16:41:26 -05:00
Brent Baude 7d3ad6081f netavark e2e tests
enabled e2e tests for netavark

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-02 13:03:45 -06:00
Paul Holzinger 25e073492f
Revert "Move each search dns to its own line"
This reverts commit a1bc8cb52c.
Please see resolv.conf(5) search domains must be on the same line. If
you use multiple seach key words only the last one is used. I tested this
with alpine and it works correctly when they are on the same line so I
am not sure what issues Dan had with it but this is not correct.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-02 19:33:21 +01:00
Daniel J Walsh a1bc8cb52c
Move each search dns to its own line
Alpine does not seem to use search correctly when there are multiple
search domains on the same line. It only uses the first with the advent.
When podman runs within a separate network we are appending on
dns.podman as a search, if you add a search domain, then this causes the
local search on network to fail.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-02 11:01:09 -05:00
Daniel J Walsh 4ddc4e79d7
Only change network fields if they were actually changed by the user
Fixes: https://github.com/containers/podman/issues/13065

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-02 10:28:34 -05:00
OpenShift Merge Robot 72c505a181
Merge pull request #13107 from rhatdan/shm
Fix size to match Docker selection
2022-02-02 09:36:45 -05:00
Giuseppe Scrivano c4dfd004ad
libpod: enforce noexec,nosuid,nodev for /dev/shm
these mount flags are already used for the /dev/shm mount on the host,
but they are not set for the bind mount itself.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-02 10:03:18 +01:00
Daniel J Walsh b6fe7d1191
Fix size to match Docker selection
Fixes: https://github.com/containers/podman/issues/13096

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-01 17:19:19 -05:00
OpenShift Merge Robot 71c3bdba0e
Merge pull request #13085 from ydayagi/main
play kube envVar.valueFrom.fieldRef
2022-02-01 15:31:37 -05:00
Giuseppe Scrivano 865f0a1977
libpod: report slirp4netns network stats
by default slirp4netns uses the tap0 device.  When slirp4netns is
used, use that device by default instead of eth0.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-01 16:23:58 +01:00
Daniel J Walsh 6609bb73aa
Fix use of infra image to clarify default
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-31 17:21:25 -05:00
Yaron Dayagi 2ceab11947 play kube envVar.valueFrom.fieldRef
add support for env vars values from pod spec fields
see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#envvarsource-v1-core

relates to issue https://github.com/containers/podman/issues/12756

Signed-off-by: Yaron Dayagi <ydayagi@redhat.com>
2022-01-31 21:49:38 +02:00
OpenShift Merge Robot 1b544b7424
Merge pull request #12712 from flouthoc/volume_overlay_advanced
volume: add support for non-volatile `upperdir`,`workdir` for overlay volumes
2022-01-28 07:06:02 -05:00
Aditya Rajan e64e6500d3
volume: add support for non-volatile upperdir,workdir for overlay volumes
Often users want their overlayed volumes to be `non-volatile` in nature
that means that same `upper` dir can be re-used by one or more
containers but overall of nature of volumes still have to be `overlay`
so work done is still on a overlay not on the actual volume.

Following PR adds support for more advanced options i.e custom `workdir`
and `upperdir` for overlayed volumes. So that users can re-use `workdir`
and `upperdir` across new containers as well.

Usage
```console

$ podman run -it -v myvol:/data:O,upperdir=/path/persistant/upper,workdir=/path/persistant/work alpine sh

```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-01-28 13:10:15 +05:30
Daniel J Walsh 908329c390
Merge pull request #13049 from edsantiago/bats
System tests: emergency skip of checkpoint tests
2022-01-27 13:20:41 -05:00