Commit graph

2813 commits

Author SHA1 Message Date
Matthew Heon
9148568b26 Fix lint
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-04-16 14:41:15 -04:00
Paul Holzinger
9584a2a8a1 podman play kube apply correct log driver
The --log-driver flag was silently ignored by podman play kube. This
regression got introduced during the play kube rework.
Unfortunately the test for this was skipped for no good reason.

Fixes #10015

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-04-16 14:05:27 -04:00
Lokesh Mandvekar
e4c811bb0f Fix build with GO111MODULE=off
Distro builds on Fedora and Kubic projects use GO111MODULE=off
by default which are currently failing. This commit fixes it and
going forward, podman CI will also indicate failures in rpm builds.

The additional LDFLAGS have been removed  from the spec file
which is not ideal. But, currently we only use the spec file
to check if the rpm builds fine. We can fix the LDFLAGS in a
later commit when we're working on packit integration.

conmon build has also been removed from podman.spec.in because the COPR
for which it was provided has been discontinued.

[NO TESTS NEEDED]

Fixes: #10009

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2021-04-16 14:02:57 -04:00
Jhon Honce
d42f6e3cd2 [CI:DOCS] Set all operation id to be compatibile
Libpod operation id's changed to better match compatibile id

Builds on https://github.com/containers/podman/pull/9123 and corrects
a duplicated ID.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-16 14:02:43 -04:00
Tom Deseyn
430ecf41a1 Move operationIds to swagger:operation line
Signed-off-by: Tom Deseyn <tom.deseyn@gmail.com>
2021-04-16 14:02:36 -04:00
Tom Deseyn
611a4a0ceb swagger: add operationIds that match with docker
Signed-off-by: Tom Deseyn <tom.deseyn@gmail.com>
2021-04-16 14:02:28 -04:00
Daniel J Walsh
af5dba34b2 Fix missing podman-remote build options
Fix handling of SecurityOpts
   LabelOpts
   SeccompProfilePath
   ApparmorProfile

Fix Ulimits

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 14:00:29 -04:00
Daniel J Walsh
32f61dbf73 [NO TESTS NEEDED] Shrink the size of podman-remote
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 14:00:14 -04:00
pendulm
c8130be174 Move socket activation check into init() and set global condition.
So rootless setup could use this condition in parent and child, child
podman should adjust LISTEN_PID to its self PID.

Add system test for systemd socket activation

Signed-off-by: pendulm <lonependulm@gmail.com>
2021-04-16 13:46:54 -04:00
Giuseppe Scrivano
c042b4c820 rootless: use is_fd_inherited
since we already have an exported function that does the check,
refactor the code to use it instead of duplicating the logic.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-04-16 13:46:39 -04:00
Jakub Guzik
b76cc706ad Recreate until container prune tests for bindings
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-04-16 13:42:06 -04:00
Jakub Guzik
f5a25c59e3 Containers prune endpoint should use only prune filters
Containers endpoints for HTTP compad and libpod APIs allowed usage of list HTTP
endpoint filter funcs. Documentation in case of libpod and compat API does not allow that.
This commit aligns code with the documentation.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-04-16 13:34:49 -04:00
Jhon Honce
10a58c976b Trim white space from /top endpoint results
Versions of the ps command have additional spaces between fields, this
manifests as the container asking to run "top" and API reporting "top "
as a process.

Endpoint and tests updated to check that "top" is reported.

There is no libpod specialized endpoint to update.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-16 13:33:48 -04:00
Daniel J Walsh
10bc6233bb Fix handling of remove --log-rusage param
Fixes: https://github.com/containers/podman/issues/9889

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 13:32:00 -04:00
Kellen Dunham
ea0e530050 Fixed podman-remote --network flag
Updated reference to network

[NO TESTS NEEDED]

Signed-off-by: Kellen Dunham <kellen@oneaib.com>
2021-04-16 13:27:44 -04:00
Daniel J Walsh
b3ef9e4dd8 Allow users to override default storage opts with --storage-opt
We define in the man page that this overrides the default storage
options, but the code was appending to the existing options.

This PR also makes a change to allow users to specify --storage-opt="".
This will turn off all storage options.

https://github.com/containers/podman/issues/9852

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 13:11:25 -04:00
Matthew Heon
0cbd322590 Ensure that --userns=keep-id sets user in config
One of the side-effects of the `--userns=keep-id` command is
switching the default user of the container to the UID of the
user running Podman (though this can still be overridden by the
`--user` flag). However, it did this by setting the UID and GID
in the OCI spec, and not by informing Libpod of its intention to
switch users via the `WithUser()` option. Because of this, a lot
of the code that should have triggered when the container ran
with a non-root user was not triggering. In the case of the issue
that this fixed, the code to remove capabilities from non-root
users was not triggering. Adjust the keep-id code to properly
inform Libpod of our intention to use a non-root user to fix
this.

Also, fix an annoying race around short-running exec sessions
where Podman would always print a warning that the exec session
had already stopped.

Fixes #9919

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-04-16 13:05:11 -04:00
Jhon Honce
1df7f8e969 [CI:DOCS] Update swagger definition of inspect manifest
* Changed reference in swagger to correct struture that was being
  returned.
* Added summary to ManifestAddLibpod to clean up generated web site
* Added serve target to Makefile, to aid in debugging generated
  web site

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-16 11:56:59 -04:00
Jakub Guzik
3338901c4f Volumes prune endpoint should use only prune filters
Volumes endpoints for HTTP compat and libpod APIs allowed
usage of list HTTP endpoint filter funcs. Documentation in
case of compat API does not allow that. This commit aligns
code with the documentation and also ligns libpod with compat API.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-04-16 11:55:51 -04:00
Pablo Correa Gómez
850ead4932 Adjust libpod API Container Wait documentation to the code
Closes #9960

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
2021-04-16 11:55:04 -04:00
Jhon Honce
7ccccd22cd Add missing return
libpod df handler missing a return after writing error to client. This
caused a null to be appended to JSON and crashed python decoder.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-16 11:46:49 -04:00
Giuseppe Scrivano
a23aecf1a6 cgroups: force 64 bits to ParseUint
[NO TESTS NEEDED]

force bitsSize==64 so that the string is always parsed to a uint64
instead of using the native int size, that could be not big enough on
32 bits arches.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-04-16 11:43:35 -04:00
Jhon Honce
f218d8849d [CI:DOCS] Correct status code for /pods/create
Swagger documentation reported that the API endpoint /pods/create
returned 200 while the as-built code returned 201. 201 is more
correct so documentation updated.

Tests already checked for 201 so no updated needed.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-16 11:40:27 -04:00
Jakub Guzik
0e28e3da3f Reflect current state of prune implementation in docs
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-04-16 11:26:32 -04:00
Nalin Dahyabhai
044c0a5437 pkg/errorhandling.JoinErrors: don't throw away context for lone errors
When our multierror contains just one error, don't extract its text only
to rewrap it, because doing so discards any stack trace information that
might have been added closer to where the error actually originated.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-16 11:22:18 -04:00
Daniel J Walsh
4d4babac76 Fix handling of $NAME and $IMAGE in runlabel
Fixes: https://github.com/containers/podman/issues/9405

Add system runlabel tests.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:17:43 -04:00
Daniel J Walsh
fc99c7d0a3 Fix flake on failed podman-remote build : try 2
This time we are checking if the function actually succeeded,
otherwise we will report an error.

Also if we did not get the id, report unexpected failure.

[NO TESTS NEEDED] Still no good way to test this, but manually.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:16:36 -04:00
Daniel J Walsh
5c21861b5d Fix flake on failed podman-remote build
We have a race condition where podman build can fail
but still return an exit code of 0.  This PR ensures
that as soon as the build fails, the failed flag is set
eliminating the race.

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

[NO TESTS NEEDED] Tests of failed builds are already in place, and
the elimination of the race should be enough.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:16:15 -04:00
Daniel J Walsh
670e1ac67c [NO TESTS NEEDED] Turn on podman-remote build --isolation
Currently podman only works with --isolation chroot.  This PR
fixes this by allowing the isolation mode to default to OCI and to
also allow users to pass the isolation mode into the containers.

The current tests for --isolation should cause this code to be tested.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-29 13:54:14 -04:00
Jakub Guzik
96ffce2198 Fix containers list/prune http api filter behaviour
The problem described in #9711 and followed by #9758 affects
containers as well. When user provides wrong filter input, error
message should occur, not fallback to full list/prune command.
This change fixes the issue. Additionally, there are error message
fixes for docker http api compat.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 13:48:59 -04:00
Jakub Guzik
a01b387e82 Unification of until filter across list/prune endpoints
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 13:26:24 -04:00
Jakub Guzik
183a68a817 Unification of label filter across list/prune endpoints
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 13:26:18 -04:00
Matej Vasek
d1589f2804 fixup
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-29 13:25:40 -04:00
Matej Vasek
31351ad94b fix: build endpoint for compat API
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-29 13:25:32 -04:00
Eduardo Vega
6b69892064 Support multi doc yaml for generate/play kube
Signed-off-by: Eduardo Vega <edvegavalerio@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 13:16:49 -04:00
Jhon Honce
d560f168f6 Correct json field name
[NO TESTS NEEDED]

* When using the Namespace type, the field Value was json encoded
  with the name "string" vs "value".

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-03-29 11:58:52 -04:00
Jakub Guzik
573ed9220b Fix filters in image http compat/libpod api endpoints
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 11:58:26 -04:00
Paul Holzinger
1b349d79ad podman generate systemd --new do not duplicate params
podman generate systemd --new inserts extra idfile arguments. The
generated unit can break when the user did provide their own idfile
arguments as they overwrite the arguments added by generate systemd.
This also happens when a user tries to generate the systemd unit on
a container already create with a --new unit. This should now
create a identical unit. The solution is to remove all user provided
idfile arguments.

This commit also ensures that we do not remove arguments that are part
off the containers entrypoint.

Fixes #9776

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-03-29 11:46:36 -04:00
Daniel J Walsh
1089f83a40 Fix podman build --pull-never
Currently pull policy is set incorrectly when users set --pull-never.

Also pull-policy is not being translated correctly when using
podman-remote.

Fixes: #9573

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

<MH: Fixed cherry-pick conflict>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 11:43:32 -04:00
Daniel J Walsh
62b49e176f [NO TESTS NEEDED] Use same function podman-remote rmi as podman
Make sure fixes that go into local podman commands also work in
podman-remote, by using the same function.

Since this is just a rewrite of existing code, existing tests should
handle it.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-29 11:41:32 -04:00
Jordan Christiansen
3d1aaffdbb Add problematic volume name to kube play error messages
When kube play fails to create a volume, it should say which volume had
the problem so the user doesn't have to guess. For the following pod
spec:

	apiVersion: v1
	kind: Pod
	metadata:
	  name: mypod
	spec:
	  containers:
	    - name: myfrontend
	      image: nginx
	      volumeMounts:
	      - mountPath: "/var/www/html"
		name: mypd
	  volumes:
	    - name: mypd
	      hostPath:
		path: /var/blah

podman will now report:

	Error: failed to create volume "mypd": error in parsing HostPath
	in YAML: error checking path "/var/blah": stat /var/blah: no such
	file or directory

Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
2021-03-29 11:32:46 -04:00
Jakub Guzik
d498022fdd Fix list pods filter handling in libpod api
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 11:31:49 -04:00
Daniel J Walsh
b557301807 Remove resize race condition
Since podman-remote resize requests can come in at random times, this
generates a real potential for race conditions. We should only be
attempting to resize TTY on running containers, but the containers can
go from running to stopped at any time, and returning an error to the
caller is just causing noice.

This change will basically ignore requests to resize terminals if the
container is not running and return the caller to success.  All other
callers will still return failure.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 11:16:51 -04:00
Robb Manes
505f43c084 Add RequiresMountsFor= to systemd generate
It is rare but possible that storage locations for the graphroot and the
runroot are not mounted at boot time, and therefore might race when
doing container operations.  An example we've seen in the wild is that a
slow tmpfs mount for the runroot would suddenly mount over /run, causing
the container to lose all currently-running data, requiring a system
refresh to get it back.

This patch adds RequiresMountsFor= to the systemd.unit header to ensure
the paths for both the graphroot and runroot are mounted prior to
starting any generated unit files.

Signed-off-by: Robb Manes <rmanes@redhat.com>
2021-03-29 10:55:12 -04:00
Anders F Björklund
15da607d13 Fix swapped dimensions from terminal.GetSize
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 10:53:10 -04:00
OpenShift Merge Robot
9ec936a856
Merge pull request #9757 from jwhonce/wip/load
Cleanup /libpod/images/load handler
2021-03-22 08:18:56 -07:00
Jhon Honce
417f362811 Cleanup /libpod/images/load handler
* Remove orphaned code
* Add meaningful error from LoadImageFromSingleImageArchive() when
  heuristic fails to determine payload format
* Correct swagger to output correct types and headers

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-03-19 09:25:12 -07:00
Giuseppe Scrivano
e85cf8f4a2
security: use the bounding caps with --privileged
when --privileged is used, make sure to not request more capabilities
than currently available in the current context.

[NO TESTS NEEDED] since it fixes existing tests.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-19 15:17:11 +01:00
Jakub Guzik
aa2d6e6e6c Fix volumes and networks list/prune filters in http api
This is the continuation work started in #9711. It turns out
that list/prune commands for volumes in libpod/compat api have
very dangerous error handling when broken filter input is supplied.
Problem also affects network list/prune in libpod. This commit
unifies filter handling across libpod/compat api and adds sanity
apiv2 testcases.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-19 00:09:29 +01:00
OpenShift Merge Robot
629183bd7f
Merge pull request #9710 from jmguzik/network-prune-filters-http-api
Network prune filters for http api (compat and libpod)
2021-03-18 06:32:29 -07:00