Commit Graph

3923 Commits

Author SHA1 Message Date
Paul Holzinger 205c8c071e
fix podman container restore without CreateNetNS
When a container does not use the default podman netns, for example
--network none or --network ns:/path a restore would fail because the
specgen check validates that c.config.StaticMAC is nil but the
unmarshaller sets it to an empty slice.

While we could make the check use len() > 0 I feel like it is more
common to check with != nil for ip and mac addresses.
Adding omitempty tag makes the json marshal/unmarshal work correctly.
This should not cause any issues.

Fixes #14389

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-31 16:49:40 +02:00
OpenShift Merge Robot dc67e6a182
Merge pull request #14419 from Luap99/volume-import
podman volume export/import: give better error
2022-05-31 09:27:29 -04:00
Paul Holzinger ec576a5491
podman volume export/import: give better error
When the volume does not exist we should output an error stating so and
not some generic one.

Fixes #14411

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-30 18:10:28 +02:00
Niall Crowe 7e69e2b532 Podman no-new-privileges format
In docker, the format of no-new-privileges is
"no-new-privileges:true". However, for Podman
all that's required is "no-new-privileges", leading to issues
when attempting to use features desgined for docker in podman.
Adding support for the ":" format to be used along with the "="
format, depedning on which one is entered by the user.

fixes #14133
Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-05-30 15:06:42 +01:00
Aditya R 66a56ce05a
vendor: bump buildah to v1.26.1-0.20220524184833-5500333c2e06
Bump buildah to v1.26.1-0.20220524184833-5500333c2e06

Signed-off-by: Aditya R <arajan@redhat.com>
2022-05-26 21:01:31 +05:30
Aditya R 6124b51993
build: allow using cache explicitly with --squash-all using --layers
Buildah already supports using `--layers` with `--squash` after https://github.com/containers/buildah/pull/3674
if user wants to do so hence podman must honor similar configuration
in `--squash-all` behaviour if user wants to using cache.

PS: We cannot alter behaviour of `podman build --squash` for
docker-compat reasons hence this feature can be easily supported by
`--squash-all`.

Closes: https://github.com/containers/buildah/issues/4011

Signed-off-by: Aditya R <arajan@redhat.com>
2022-05-26 21:01:18 +05:30
Matthew Heon 9fcfea7643 First batch of resolutions to FIXMEs
Most of these are no longer relevant, just drop the comments.

Most notable change: allow `podman kill` on paused containers.
Works just fine when I test it.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-05-25 13:28:04 -04:00
OpenShift Merge Robot e26ad50669
Merge pull request #14361 from Luap99/netflake
fix f35 integration test network flake
2022-05-25 11:38:57 -04:00
OpenShift Merge Robot dbd4ee04b8
Merge pull request #14358 from vrothberg/todo-part-2
Todo part 2
2022-05-25 10:42:23 -04:00
Paul Holzinger cb76d15230
fix f35 integration test network flake
I am not 100% sure if this is actually causing the problem but I was
able to reproduce locally and this change fixed it there. Without the `-n`
option iptables tries to reverse lookup the ips to domain names. This is
extremely slow for unknown reasons. Given the large amount of iptables
entries due parallel test runs it will not succeed in the default 90 sec
timeout.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-25 15:46:15 +02:00
OpenShift Merge Robot 800a367d73
Merge pull request #14333 from rhatdan/pod
Allow podman pod create --share +pid
2022-05-25 08:57:15 -04:00
Valentin Rothberg c3677f5151 test/system/250-systemd.bats: clean up outdated TODO
`podman auto-update` is now properly exercised in the system tests, so
we can safely remove the outdated TODO.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-25 13:01:14 +02:00
OpenShift Merge Robot b13184dfb4
Merge pull request #14334 from rhatdan/pod1
Allow podman pod create to accept name argument
2022-05-24 22:12:59 -04:00
OpenShift Merge Robot 6f2a40d42e
Merge pull request #14346 from edsantiago/helpmsg_tests
help-message system test: catch more cases
2022-05-24 19:56:54 -04:00
Daniel J Walsh 2ce4755767
Allow podman pod create --share +pid
Fixes: https://github.com/containers/podman/issues/13422

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-24 15:58:31 -04:00
OpenShift Merge Robot c6152f40a0
Merge pull request #14319 from flouthoc/suppress-aux-on-quiet
compat, build: suppress `step` errors when `quiet=1` is set
2022-05-24 13:28:29 -04:00
Daniel J Walsh df394b5218
Allow podman pod create to accept name argument
I am constantly attempting to add the podname to the last
argument to podman pod create. Allowing this makes it match
podman volume create and podman network create.

It does not match podman container create, since podman container create
arguments specify the arguments to run with the container.

Still need to support the --name option for backwards compatibility.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-24 13:17:02 -04:00
OpenShift Merge Robot 2dc4f752c6
Merge pull request #14341 from vrothberg/todo-part-1
TODO's and FIXME's [PART 1]
2022-05-24 12:50:59 -04:00
Ed Santiago 8de3e91024 help-message system test: catch more cases
- Look for and prevent lower-case arg descriptions:
     podman cmd [arg]

 - Look for and prevent optional-mandatory misordering:
     podman cmd [ARG] ARG

 - Tighter whitespace checks (and fix podman pod ps)

 - simplify a no-longer-necessary mess! #8635 fixed the
   horrible "CONTAINER | IMAGE" strings (with spaces),
   so there's no longer a need to special-case those.
   The one-extra-arg check is now much cleaner.

Minor refactoring.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-05-24 09:21:11 -06:00
Valentin Rothberg b3e2324f58 test/e2e/search_test.go: re-enable registry.redhat.io test
The search endpoint is working again.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-24 16:07:39 +02:00
Valentin Rothberg 5268314e53 podman image mount: print pretty table
Make sure that `podman image mount` prints a pretty table unless there
is only argument passed and without a custom format.  Fixing a TODO item
brought me to the specific code location and revealed the fart in the
logic.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-24 16:07:39 +02:00
Valentin Rothberg f5450b1e82 system tests: fix flake waiting for container to run
I have seen some system tests flake waiting for a container to
transition into a specific running state.  My theory is that
the waiting time was not sufficient on nodes under high load.
Hence, increase the waiting time.  Also replace the break with
a return to spare some cycles to redundantly compare with the
already checked state.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-24 13:20:20 +02:00
OpenShift Merge Robot 737b100c5e
Merge pull request #14294 from vrothberg/fix-14291
fix compat image resolution
2022-05-24 03:37:32 -04:00
Aditya R 2133edb2ca
compat, build: suppress step errors when quiet is set
Match with docker API and suppress step errors when field quiet is set.

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

Signed-off-by: Aditya R <arajan@redhat.com>
2022-05-24 00:21:04 +05:30
OpenShift Merge Robot 7d00b0ea0d
Merge pull request #14281 from vrothberg/fix-14251
fix --init with /dev bind mount
2022-05-23 10:17:59 -04:00
OpenShift Merge Robot be255287c9
Merge pull request #14292 from vrothberg/fix-14283
auto update: create an event
2022-05-23 10:12:19 -04:00
OpenShift Merge Robot e11d8d4650
Merge pull request #14266 from tupyy/add-blockdevice-play-kube
Expose block and character devices with play kube
2022-05-23 10:06:07 -04:00
Valentin Rothberg c984956f93 fix compat image resolution
Fix a bug in the resolution of images in the Docker compat API.
When looking up an image by a short name, the name may match
an image that does not live on Docker Hub.  The resolved name
should be used for normalization instead of the input name to
make sure that `busybox` can resolve to `registry.com/busybox`
if present in the local storage.

Fixes: #14291
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-23 15:08:15 +02:00
Valentin Rothberg d66288315d auto update: create an event
Create an auto-update event for each invocation, independent if images
and containers are updated or not.  Those events will be indicated in
the events already but users will now know why.

Fixes: #14283
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-23 14:11:29 +02:00
Valentin Rothberg 633d5f1f8b fix --init with /dev bind mount
The init binary until now has been bind-mounted to /dev/init which
breaks when bind-mounting to /dev.  Instead mount the init to
/run/podman-init.  The reasoning for using /run is that it is already
used for other runtime data such as secrets.

Fixes: #14251
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-23 13:59:05 +02:00
Cosmin Tupangiu 4960a17a56
fix tests by randomize the device folder name
e2e tests tends to fail when running with multiple nodes because
the same device folder name is used accross all nodes

Signed-off-by: Cosmin Tupangiu <cosmin@redhat.com>
2022-05-23 10:33:12 +02:00
Jhon Honce 5b79cf15a0 Swagger refactor/cleanup
* Remove duplicate or unused types and constants
* Move all documetation-only models and responses into swagger package
* Remove all unecessary names, go-swagger will determine names from
  struct declarations
* Use Libpod suffix to differentiate between compat and libpod models
  and responses. Taken from swagger:operation declarations.
* Models and responses that start with lowercase are for swagger use
  only while uppercase are used "as is" in the code and swagger comments
* Used gofumpt on new code

```release-note

```

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-05-19 15:24:18 -07:00
Valentin Rothberg b22143267b linter: enable unconvert linter
Detects unneccessary type conversions and helps in keeping the code base
cleaner.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-19 13:59:15 +02:00
OpenShift Merge Robot 7093885df7
Merge pull request #14228 from rhatdan/api
Deleting an n use image should return conflict not system error
2022-05-18 11:48:06 -04:00
OpenShift Merge Robot 12964c7b93
Merge pull request #14256 from vrothberg/run-1287
k8systemd: run k8s workloads in systemd
2022-05-18 09:39:30 -04:00
Cosmin Tupangiu f5c8c09113
add tests and fix bug when char device pass the test as block device
- add test
- fix bug when a character device set in a volume as a block device
  is seen as block device in _pkg/specgen/generate/kube/volume.go_.
  At this stage the type does not matter much because the devices are
recreated at lower layer but the bug allowed a CharDevice volume to be
passed to lower layer as a BlockDevice.

Signed-off-by: Cosmin Tupangiu <cosmin@redhat.com>
2022-05-18 10:46:45 +02:00
OpenShift Merge Robot 105c6c7dd1
Merge pull request #14254 from flouthoc/api-allow-remote
api: make no-op `remote` functional in `/libpod/build`
2022-05-17 14:19:45 +02:00
Valentin Rothberg 8684d41e38 k8systemd: run k8s workloads in systemd
Support running `podman play kube` in systemd by exploiting the
previously added "service containers".  During `play kube`, a service
container is started before all the pods and containers, and is stopped
last.  The service container communicates its conmon PID via sdnotify.

Add a new systemd template to dispatch such k8s workloads.  The argument
of the template is the path to the k8s file.  Note that the path must be
escaped for systemd not to bark:

Let's assume we have a `top.yaml` file in the home directory:
```
$ escaped=$(systemd-escape ~/top.yaml)
$ systemctl --user start podman-play-kube@$escaped.service
```

Closes: https://issues.redhat.com/browse/RUN-1287
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-17 10:18:58 +02:00
Aditya R 6f9155cbb3
api: make no-op remote functional in /libpod/build
Podman API `libpod/build` accepts paramemter `remote` which overrides
`dockerfile` but currently parameter is no-op. Following commit adds
support for `remote` parameter in libpod API.

See: https://docs.podman.io/en/v3.2.3/_static/api.html#operation/ImageBuildLibpod
Closes: https://github.com/containers/podman/issues/13831

Signed-off-by: Aditya R <arajan@redhat.com>
2022-05-16 22:01:39 +05:30
Daniel J Walsh ee782fcb70
Deleting an n use image should return conflict not system error
Fixes: https://github.com/containers/podman/issues/14208

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-16 09:59:19 -04:00
OpenShift Merge Robot 0c7124289f
Merge pull request #14232 from vrothberg/bz-2083997
[BZ #2083997] pod: build pause image in custom user NS
2022-05-16 13:19:32 +02:00
Valentin Rothberg c45d51899a [BZ #2083997] pod: build pause image in custom user NS
Use the host UID and host GID mapping when building the local pause
image for a Pod with a custom mapping.  Otherwise, the mappings are off
and the build fails. Propagating the mapping to the build container is
not needed since the pause image ships merely a copied `catatonit` from
the host.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2083997
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-13 15:41:28 +02:00
OpenShift Merge Robot 53c39cf256
Merge pull request #14205 from rhatdan/VENDOR
Vendor in latest containers/common
2022-05-13 11:58:26 +02:00
Daniel J Walsh 2b03a1088a
Vendor in latest containers/common
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-12 17:36:44 -04:00
Daniel J Walsh b8103640a2
Make sure tests are cleaned up when they complete
Fixes: https://github.com/containers/podman/issues/13789

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-12 16:31:13 -04:00
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