Commit graph

3835 commits

Author SHA1 Message Date
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
Chris Evich d4e30b33a1
Temporarily skip netavark/aardvark e2e test
Ref: https://github.com/containers/podman/issues/13931

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-04-27 12:13:54 -04:00
OpenShift Merge Robot 9133a6d044
Merge pull request #13698 from Luap99/version
Bump version to v4.1.0-dev
2022-04-27 10:56:43 -04:00
OpenShift Merge Robot bbe419ef9f
Merge pull request #14023 from rhatdan/kube
Truncate annotations when generating kubernetes yaml files
2022-04-27 09:42:31 -04:00
Paul Holzinger 609b52f726
Bump version to v4.1.0-dev
I think we forgot to bump the version in the main branch. It should be
v4.1.0-dev now.
Also set the min api version to 4.0.0 as on the podman 4.0 branch.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-27 14:32:28 +02:00
Paul Holzinger 70a2c00089
play kube respect hostNetwork
We need to use the host network when it is set in the config and
--network was not used.

This regression was added in 3e9af2029f.

Fixes #14015

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-27 13:28:34 +02:00
OpenShift Merge Robot 053b09660f
Merge pull request #13997 from Luap99/gocritic
enable gocritic linter
2022-04-27 04:50:01 -04:00
Daniel J Walsh 7259a6315c
Truncate annotations when generating kubernetes yaml files
Kubernetes only allows 63 characters in an annotation.  Make sure
that we only add 63 or less charaters when generating kube. Warn
if containers or pods have longer length and truncate.

Discussion: https://github.com/containers/podman/discussions/13901

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-27 04:39:05 -04:00
OpenShift Merge Robot 5ac00a7287
Merge pull request #14009 from vrothberg/add-benchmarks
benchmarks: add more image benchmarks
2022-04-26 14:36:30 -04:00
Paul Holzinger 4f8ece76ff
play kube: do not skip containers by name
We should not exclude contianers by name. If a users has a container
with the name "inf" it is currently skipped. This is wrong. The k8s yaml
does not contain infra containers so we do not have to skip them.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-26 18:12:27 +02:00
Paul Holzinger 51fbf3da9e
enable gocritic linter
The linter ensures a common code style.
- use switch/case instead of else if
- use if instead of switch/case for single case statement
- add space between comment and text
- detect the use of defer with os.Exit()
- use short form var += "..." instead of var = var + "..."
- detect problems with append()
```
newSlice := append(orgSlice, val)
```
  This could lead to nasty bugs because the orgSlice will be changed in
  place if it has enough capacity too hold the new elements. Thus we
  newSlice might not be a copy.

Of course most of the changes are just cosmetic and do not cause any
logic errors but I think it is a good idea to enforce a common style.
This should help maintainability.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-26 18:12:22 +02:00
Daniel J Walsh 49264c7148
vendor in containers/(common,buildah,storage,image)
Changes as of 2022-04-21:

- apply-podman-deltas: minor cleanup
- buildah-tests.diff: deal with:
  . buildah #3894 (the registry one), which affected helpers.bash in
    a way that resulted in conflicts here; and
  . buildah #3917 (etchosts), which caused offset-only diffs
    with no conflicts
- Reevaluate the bud skip list, and reenable some tests that
  seems to be passing now under podman:
  . bud with specified context ...
  . two tests that require a local registry (which buildah now runs)
  . bud with --cgroup-parent

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-26 08:49:38 -04:00
Valentin Rothberg facc009ca0 benchmarks: add more image benchmarks
Add more benchmarks for the most common and performance-critical image
commands.  Benchmarks for `podman build` should go into a separate
section.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-26 14:25:17 +02:00
Ed Santiago ee9d755c5b Robustify nginx tests
[skip ci]

While chasing a flake, I discovered that our alpine_nginx
image is broken: it returns 404 on all requests. We never
caught this because--surprise!--curl exits 0 even when
server returns 4xx/5xx status.

Let's be strict: add -f (--fail) option to all invocations
of curl.

And, although I couldn't identify the root cause of the
flake (in "run two containers with the same IP" test),
I can at least fix the broken wait-for-nginx loop, bump
up the number of retries, and improve diagnostics on
failure. And add a strict error-message check.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-04-25 14:25:10 -06:00
OpenShift Merge Robot 09ef4f2e22
Merge pull request #13978 from Luap99/unparam
enable unparam linter
2022-04-25 13:43:57 -04:00
OpenShift Merge Robot a775e77cba
Merge pull request #13995 from ashley-cui/revrootful
Rootfull -> Rootful
2022-04-25 13:37:59 -04:00
Ashley Cui a615cb2fe2 Docs rootfull -> rootful
Some docs say roofull. Change to rootful.

[NO NEW TESTS NEEDED]

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-04-25 11:53:57 -04:00
OpenShift Merge Robot 9784d97bd6
Merge pull request #13993 from aonoa/main
Modify the pod name suffix '_pod' to '-pod'
2022-04-25 09:37:05 -04:00
OpenShift Merge Robot a9f8fb9cea
Merge pull request #13981 from rhatdan/volume
Add support for passing --volumepath
2022-04-25 09:35:03 -04:00
Ashley Cui 1260bf631f Revert "Switch all rootful to rootfull"
This reverts commit cc3790f332.

We can't change rootful to rootfull because `rootful` is written into the machine config. Changing this will break json unmarshalling, which will break existing machines.

[NO NEW TESTS NEEDED]

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-04-25 09:14:04 -04:00
Paul Holzinger c7b16645af
enable unparam linter
The unparam linter is useful to detect unused function parameters and
return values.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-25 13:23:20 +02:00
aonoa 94d043be8c Modify the pod name suffix '_pod' to '-pod'
Signed-off-by: aonoa <1991849113@qq.com>
2022-04-25 15:47:24 +08:00
Daniel J Walsh 0d83f4b768
Allow filtering of "removing", it is a valid status
Do not use a list of statuses outside of libpod to validate container
statuses.  Removing status was never added to the list.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-24 06:07:10 -04:00
Daniel J Walsh 13079abe3f
Add support for passing --volumepath
Fixes: https://github.com/containers/podman/issues/13860

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-23 08:03:36 -04:00
OpenShift Merge Robot 2df9bdc009
Merge pull request #13973 from Luap99/linter-revive
replace golint with revive linter
2022-04-23 06:32:41 -04:00
Chris Evich ad249222d2
Fix hang in test_connect
Starting the podman service in debug-mode causes aardvark to run in
debug mode.  This does unexpected things with file-descriptors leading
to a test-hang.  Thanks to @Luap99 for the fix.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-04-22 16:16:32 -04:00
Paul Holzinger 5b4af0584d
replace golint with revive linter
golint, scopelint and interfacer are deprecated. golint is replaced by
revive. This linter is better because it will also check for our error
style: `error strings should not be capitalized or end with punctuation or a newline`

scopelint is replaced by exportloopref (already endabled)
interfacer has no replacement but I do not think this linter is
important.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 15:12:33 +02:00
Daniel J Walsh 454468e034
Update test to run network check in both rootless and rootfull mode
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-22 09:02:05 -04:00
OpenShift Merge Robot ad3da638ce
Merge pull request #13918 from Luap99/hosts
use etchosts package from c/common
2022-04-22 08:50:32 -04:00
OpenShift Merge Robot 1bafde2d22
Merge pull request #13881 from rhatdan/userns
Add support for --userns=nomap
2022-04-22 08:40:34 -04:00
OpenShift Merge Robot 22500d797a
Merge pull request #13972 from Luap99/staticcheck
enable staticcheck linter
2022-04-22 08:26:31 -04:00
OpenShift Merge Robot 04acbaa4b1
Merge pull request #13969 from flouthoc/mount-csv-parsing
specgen-volumes: parse `--mount` using csv-reader instead of split.
2022-04-22 07:08:32 -04:00
Paul Holzinger e0f5bf279b
test/system: add containers.conf test for new /etc/hosts options
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 13:06:01 +02:00
Paul Holzinger e4ab8a5bed
shared netns and --add-host should conflict
Because /etc/hosts is shared for all containers with a shared network
namespace you should not be able to add hosts from a joined container.
Only the primary netns container can set the hosts.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 13:06:00 +02:00
Paul Holzinger cf1b0c1965
network dis-/connect: update /etc/hosts
When we connect or disconnect from a network we also have to update
/etc/hosts to ensure we only have valid entries in there.
This also fixes problems with docker-compose since this makes use of
network connect/disconnect.

Fixes #12533

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 13:05:53 +02:00
Paul Holzinger 128086639c
libpod: fix c.Hostname() to respect the utsNsCtr
When we lookup the hostname for a given container we have to check if
the container is joined to another utsns and use this hostname then
instead.
This fixes a problem where the `hostname` command would use the correct
name but /etc/hostname would contain a different name.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 12:59:51 +02:00
Paul Holzinger 696bcd2773
use etchosts package from c/common
Use the new logic from c/common to create the hosts file. This will help
to better allign the hosts files between buildah and podman.

Also this fixes several bugs:
- remove host entries when container is stopped and has a netNsCtr
- add entries for containers in a pod
- do not duplicate entries in the hosts file
- use the correct slirp ip when an userns is used

Features:
- configure host.containers.internal entry in containers.conf
- configure base hosts file in containers.conf

Fixes #12003
Fixes #13224

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 12:59:49 +02:00
OpenShift Merge Robot 0d6af14387
Merge pull request #13964 from rhatdan/rootfull
Switch all rootful to rootfull
2022-04-22 06:56:33 -04:00
Paul Holzinger 2a8e435671
enable staticcheck linter
Fix many problems reported by the staticcheck linter, including many
real bugs!

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-22 12:51:29 +02:00
OpenShift Merge Robot 1fcefc94f9
Merge pull request #13971 from rhatdan/codespell
[CI:DOCS] Run codespell on code
2022-04-22 06:34:32 -04:00
OpenShift Merge Robot 82393e2565
Merge pull request #13935 from edsantiago/bats_assert
system tests: add assert(), and start using it
2022-04-22 06:30:49 -04:00
OpenShift Merge Robot 26a51b2900
Merge pull request #13943 from cdoern/clone
podman container clone -f
2022-04-22 06:24:52 -04:00
Daniel J Walsh e39f4495e7
Run codespell on code
[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-04-22 06:18:20 -04:00
Aditya R f87f23e3b6
specgen-volumes: parse --mount using csv-reader instead of split by comma
Following commit ensures that csv escaping is supported while using
inline `--mount=type=......` flag with `podman run` by using
`encoding/csv` to parse options instead of performing a `split.String(`
by `comma`.

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

Signed-off-by: Aditya R <arajan@redhat.com>
2022-04-22 14:49:56 +05:30