Commit graph

3878 commits

Author SHA1 Message Date
Daniel J Walsh 81fc9f1dea
Merge pull request #14159 from vrothberg/service-container
play kube: service container
2022-05-12 13:35:56 -04:00
Valentin Rothberg 03af8213ce sdnotify: send MAINPID only once
Send the main PID only once.  Previously, `(*Container).start()` and
the conmon handler sent them ~simultaneously and went into a race.

I noticed the issue while debugging a WIP PR.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-12 11:11:37 +02:00
Valentin Rothberg 840c120c21 play kube: service container
Add the notion of a "service container" to play kube.  A service
container is started before the pods in play kube and is (reverse)
linked to them.  The service container is stopped/removed *after*
all pods it is associated with are stopped/removed.

In other words, a service container tracks the entire life cycle
of a service started via `podman play kube`.  This is required to
enable `play kube` in a systemd unit file.

The service container is only used when the `--service-container`
flag is set on the CLI.  This flag has been marked as hidden as it
is not meant to be used outside the context of `play kube`.  It is
further not supported on the remote client.

The wiring with systemd will be done in a later commit.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-12 10:51:13 +02:00
Valentin Rothberg ecf0177a01 vendor c/common@main
In hope to fix a CI flake.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-12 10:51:13 +02:00
Giuseppe Scrivano 60258925a8
test: update fedora toolbox image
f32 is already EOL.  Let's use the latest version.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-05-11 20:44:37 +02:00
OpenShift Merge Robot ed1ba27f8d
Merge pull request #14176 from giuseppe/test-parallel-rm-cleanup
test: simplify cleanup code
2022-05-11 02:39:57 -04:00
Giuseppe Scrivano d0ca90b3ed
test: simplify cleanup code
do not try to first stop and then rm but combine the two operations in
a single command.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-05-10 20:11:16 +02:00
Giuseppe Scrivano 0774a4ce13
kube: add support for --userns=
add support to override the user namespace to use for the pod.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-05-10 16:51:01 +02:00
Giuseppe Scrivano 9e1ee081f8
kube: honor pod security context IDs
If the RunAsUser, RunAsGroup, SupplementalGroups settings are not
overriden in the container security context, then take the value from
the pod security context.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-05-10 09:09:14 +02:00
Paul Holzinger 8ecd0b5bc8
fix broken CI test
Commit b58e7e7f11 was not fully rebased before merging and is now
breaking CI because commit 69c479b16e made the underlying error
visible. Using journald inside the container tests is not supported.

Fixes #14162

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-09 18:08:38 +02:00
OpenShift Merge Robot 2dcf3067ec
Merge pull request #14152 from giuseppe/fix-ci-search-json
test: fix "podman search format json"
2022-05-09 05:16:28 -04:00
OpenShift Merge Robot ccb6211c7b
Merge pull request #14121 from cdoern/kube
play kube log tag handling
2022-05-09 04:48:49 -04:00
Giuseppe Scrivano bb8f53a727
test: fix "podman search format json"
the alpine image used previously returns a description that contains
'...':

$ podman search --format json alpine | fgrep ...\"\,
        "Description": "alpine 3.7 with bash, perl, gzip, wget...",

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-05-08 17:33:26 +02:00
cdoern b58e7e7f11 play kube log tag handling
currently tags cause a panic due to an uninitialized map. Initialize the map
and add parsing to make sure we are only tagging with journald

resolves #13356

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2022-05-06 15:59:06 -04:00
OpenShift Merge Robot 09b8831fa2
Merge pull request #14124 from vrothberg/e2e-cleanups
e2e cleanups
2022-05-05 08:37:35 -04:00
Valentin Rothberg 6ddccd94f6 e2e: pull_test: speed up --all-tags
Pulling the K8s pause image seems unnecessarily expensive to me. Let's
use the testgitest_v2s2 one which is under our control and weighs only a
couple of KB.

This cut the execution time in less than half on my machine.  Since it's
network bound and I am running on fibre, I expect more significant speed
ups in slower networks.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-05 13:00:47 +02:00
OpenShift Merge Robot 8ed517576c
Merge pull request #14118 from rhatdan/VENDOR
Vendor in containers/buildah@v1.26.1
2022-05-05 06:31:39 -04:00
OpenShift Merge Robot 88f8d398b3
Merge pull request #14098 from Luap99/test-tools
vendor test dependencies instead of installing via network
2022-05-05 05:53:18 -04:00
OpenShift Merge Robot 7af4612d6b
Merge pull request #14059 from cdoern/clone
pass networks to container clone
2022-05-05 05:51:19 -04:00
Valentin Rothberg 140fb3ae17 e2e: pull_test: squash --quiet test
Squash the --quiet test into another one.  The test was more complex
than necessary and can easily be squashed into another one to avoid one
more expensive pull.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-05 11:03:14 +02:00
Valentin Rothberg 669401c314 e2e: pull_test: move tests around
Let's keep simple tests at the top and complex ones at the bottom.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-05 11:03:14 +02:00
Valentin Rothberg 2fa906ccae e2e: pull_test: remove redundant tests
Once upon a time, the tests actually pulled from Docker Hub.  This has
changed with the rate limits, so we can safely remove the redundant
tests to speed up CI.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-05 11:03:14 +02:00
Valentin Rothberg 6eaa9ca264 e2e: manifest_test: use cached registry
Used the cached registry archive instead of pulling down the image from
Quay.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-05 11:03:14 +02:00
Daniel J Walsh ed159f864d
Vendor in containers/buildah@v1.26.1
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-05 04:41:06 -04:00
OpenShift Merge Robot f1703abea1
Merge pull request #14092 from vrothberg/benchmarks
benchmarks: push/pull
2022-05-05 03:40:19 -04:00
OpenShift Merge Robot bdaac4b2b6
Merge pull request #14037 from rhatdan/remoteuri
Report correct RemoteURI
2022-05-04 14:52:19 -04:00
OpenShift Merge Robot ad93318370
Merge pull request #14066 from ashley-cui/sysres
podman system reset removed machines incorrectly
2022-05-04 13:20:09 -04:00
Daniel J Walsh 5fa6f686db
Report correct RemoteURI
Rather than assuming a filesystem path, the API service URI is recorded
in the libpod runtime configuration and then reported as requested.

Note: All schemes other than "unix" are hard-coded to report URI exists.

Fixes #12023

Signed-off-by: Jhon Honce <jhonce@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-04 12:11:32 -04:00
Paul Holzinger 3866143675
exclude new tools vendor dir from validate
We have no control over the code in the vendored files.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-04 17:11:50 +02:00
Paul Holzinger 3b9177995e
vendor test tools in submodule
Instead of using the main module we should vendor the test tools in a
different directory. That way we do not add extra dependencies to the
main module which can be problemetic for packages or other users.

This is already done in buildah so this makes us more consitent.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-04 17:11:43 +02:00
Ashley Cui 80744c6441 podman system reset removed machines incorrectly
podman system reset did not clean up machines fully, leaving some config
files, and breaking machines. Now it removes all machines files fully.

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-05-04 10:31:42 -04:00
Niall Crowe ccd576504e play kube default log driver
The default log driver is not used when using play kube
without --log-driver. The LogDriver function needs to
be called in order to use the default log driver.

fixes #13781
Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-05-04 12:52:27 +01:00
Valentin Rothberg 8781a3635a benchmarks: push/pull
Polish the push and pull benchmarks.  In particular, make sure to not be
network bound during these benchmarks by running a local registry and
pushing a local image that can later on be pulled.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-04 12:15:45 +02:00
cdoern 1585b175db pass networks to container clone
since the network config is a string map, json.unmarshal does not recognize
the config and spec as the same entity, need to map this option manually

resolves #13713

Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
2022-05-03 23:04:08 -04:00
Jhon Honce 8da5f3f733 Add podman machine events
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-05-03 13:49:01 -07:00
Paul Holzinger 9166894c69
vendor test dependencies instead of installing via network
We can vendor the test dependencies such as go-md2man, git-validation
and goimports. This allows us to always install the same version as
specified in go.mod. Also we do not rely on a network connection for
this.

The advantage with this method is that dependabot will also update the
dependencies for us and we do not have to hardcode versions in the
Makefile.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-03 18:43:18 +02:00
Valentin Rothberg 4eff0c8cf2 pod: add exit policies
Add the notion of an "exit policy" to a pod.  This policy controls the
behaviour when the last container of pod exits.  Initially, there are
two policies:

 - "continue" : the pod continues running. This is the default policy
                when creating a pod.

 - "stop" : stop the pod when the last container exits. This is the
            default behaviour for `play kube`.

In order to implement the deferred stop of a pod, add a worker queue to
the libpod runtime.  The queue will pick up work items and in this case
helps resolve dead locks that would otherwise occur if we attempted to
stop a pod during container cleanup.

Note that the default restart policy of `play kube` is "Always".  Hence,
in order to really solve #13464, the YAML files must set a custom
restart policy; the tests use "OnFailure".

Fixes: #13464
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-02 13:29:59 +02:00
OpenShift Merge Robot 2e75cb72ca
Merge pull request #14062 from Luap99/resolv.conf
libpod: host netns keep same /etc/resolv.conf
2022-04-29 13:45:59 -04:00
Paul Holzinger 01acc2565a
libpod: host netns keep same /etc/resolv.conf
When a container is run in the host network namespace we have to keep
the same resolv.conf content and not use the systemd-resolve detection
logic.

But also make sure we still allow --dns options.

Fixes #14055

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 15:37:14 +02:00
Paul Holzinger 5198209269
fix incorrect permissions for /etc/resolv.conf in userns
The files /etc/hosts, /etc/hostname and /etc/resolv.conf should always
be owned by the root user in the container. This worked correct for
/etc/hostname and /etc/hosts but not for /etc/resolv.conf.

A container run with --userns keep-id would have the reolv.conf file
owned by the current container user which is wrong.

Consolidate some common code in a new helper function to make the code more
cleaner.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 15:30:55 +02:00
Paul Holzinger a48c37df37
fix broken hooks-dir test
The test has been broken since it was added 4 years ago. Instead of
using hardcoded paths we should use tmp files.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 14:06:54 +02:00
Paul Holzinger 69c479b16e
enable errcheck linter
The errcheck linter makes sure that errors are always check and not
ignored by accident. It spotted a lot of unchecked errors, mostly in the
tests but also some real problem in the code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-29 14:06:38 +02:00
Daniel J Walsh 7f28fd9386
Report properly whether pod shares host network
Fixes: https://github.com/containers/podman/issues/14028

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-28 10:27:21 -04:00
OpenShift Merge Robot 87454cf87a
Merge pull request #14040 from edsantiago/gomega_havefield
e2e tests: use HaveField() for better error checking
2022-04-28 10:25:46 -04:00
OpenShift Merge Robot d0b96a541d
Merge pull request #14051 from giuseppe/volume-create-noquota-option
volume: add new option -o o=noquota
2022-04-28 10:23:58 -04:00
Ed Santiago a5aea8e503 Three manual fixes
Two for this error:

    invalid indirect of pod.Spec.DNSConfig.Options[0]

...and one for a gofmt error (spaces).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-28 05:43:41 -06:00
Ed Santiago b3f38c31b2 Ginkgo: use HaveField() for better error checking
This is a very late followup to my ginkgo-improving work of 2021.
It has been stuck since December because it requires gomega 1.17,
which we've just enabled.

This commit is simply a copy-paste of a command I saved in
my TODO list many months ago:

     sed -i -e 's/Expect(\([^ ]\+\)\.\([a-zA-Z0-9]\+\))\.To(Equal(/Expect(\1).To(HaveField(\"\2\", /' test/e2e/*_test.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-28 05:41:53 -06:00
Giuseppe Scrivano 91ead15283
volume: add new option -o o=noquota
add a new option to completely disable xfs quota usage for a volume.

xfs quota set on a volume, even just for tracking disk usage, can
cause weird errors if the volume is later re-used by a container with
a different quota projid.  More specifically, link(2) and rename(2)
might fail with EXDEV if the source file has a projid that is
different from the parent directory.

To prevent such kind of issues, the volume should be created
beforehand with `podman volume create -o o=noquota $ID`

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-04-28 13:29:01 +02:00
OpenShift Merge Robot 7321f5e462
Merge pull request #14034 from rhatdan/history
Add CreatedSince & CreatedAt format fields to podman image history
2022-04-27 17:08:44 -04:00
Daniel J Walsh 22b421dd7e
Add CreatedSince & CreatedAt format fields to podman image history
Fixes: https://github.com/containers/podman/issues/14012

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-27 15:15:03 -04:00