Commit graph

3350 commits

Author SHA1 Message Date
Aditya Rajan
b3af5a92cc stop: Do nothing if container was never created in runtime
Following commit ensures we silently return container id on `stop` if
container was never created in OCI runtime.

Following behaviour ensures that we are in parity with docker.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-09-29 16:39:29 -04:00
Nalin Dahyabhai
7bfc5250d8 remote build: EvalSymlinks() the context directory
Use EvalSymlinks() to find the context directory, in case there's
shenanigans.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-09-29 16:39:29 -04:00
Paul Holzinger
7395459c76 podman machine: do not join userns
The go logic already prevents podman from joining the userns for machine
commands but the c shortcut code did not.

[NO TESTS NEEDED]

Fixes #11731

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-29 16:39:29 -04:00
Sankalp Rangare
5e9aa13dc0 added healthcheck to ps command
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
2021-09-29 16:39:29 -04:00
Daniel J Walsh
0f87cfd288 podman generate kube should not include images command
If the command came from the underlying image, then we should
not include it in the generate yaml file.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-29 16:39:29 -04:00
Anders F Björklund
da67c71998 Also show the (initial) disk size
[NO TESTS NEEDED]

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2021-09-29 16:39:29 -04:00
Anders F Björklund
2c5382ba98 Show cpus and memory in machine list
[NO TESTS NEEDED]

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2021-09-29 16:39:29 -04:00
Brent Baude
d6f6767a59 Set context dir for play kube build
When performing an image build with play kube, we need to set the
context directory so things like file copies have the correct input
path.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-09-23 13:06:53 -05:00
Valentin Rothberg
f2c676e99a [3.4] podman save: enforce signature removal
Enforce the removal of signatures in `podman save` to restore behavior
prior to the migration to libimage.  We may consider improving on that
in the future.  For details, please refer to the excellent summary by
@mtrmac [1].

[NO TESTS NEEDED] - manually verified but exisiting tests need some
further investigation (see [1]).

[1] https://github.com/containers/podman/pull/11669#issuecomment-925250264

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-23 16:07:54 +02:00
OpenShift Merge Robot
c58a677f8e
Merge pull request #11705 from mheon/340
Release 3.4.0-rc2 (inc. backports)
2021-09-22 18:35:48 -04:00
Daniel J Walsh
72e19cf51e Generate kube should'd add podman default environment vars
Currently we add the default PATH, TERM and container from Podman
to every kubernetes.yaml file. These values should not be recorded
in the yaml files.

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

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-09-22 16:49:15 -04:00
Matthew Heon
d45cbbda34 Add a backoff and retries to retrieving exited event
There's a potential race around extremely short-running
containers and events with journald. Events may not be written
for some time (small, but appreciable) after they are received,
and as such we can fail to retrieve it if there is a sufficiently
short time between us writing the event and trying to read it.

Work around this by just retrying, with a 0.25 second delay
between retries, up to 4 times.

[NO TESTS NEEDED] because I have no idea how to reproduce this
race in CI.

Fixes #11633

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2021-09-22 16:33:22 -04:00
Brent Baude
a98e0371ee Remove references to kube being development
At this point and even though we are always improving the play and
generate kube functions, I would say it no longers needs to be denoted
as under development.

[NO TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-09-22 16:32:33 -04:00
Paul Holzinger
863ea75c4f compat API: /images/json prefix image id with sha256
Docker adds the `sha256:` prefix to the image ID, so our compat endpoint
has to do this as well.

Fixes #11623

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-22 16:23:53 -04:00
Valentin Rothberg
7bfe9ca3da remote untag: support digests
Fix a bug when remotely untagging an image via tag@digest.
The digest has been lost in the remote client and hence led
to a wrong behaviour on the server.

Fixes: #11557
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-22 16:21:56 -04:00
Paul Holzinger
d27fcbdc21 container runlabel remove image tag from name
When no name is given for podman container runlabel it will default to
the image base name. However this can contain a tag. Since podman does
not accept container names with a colon the run command will fail if it
contains something like `podman run --name NAME ...`.

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

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-22 15:45:41 -04:00
Matej Vasek
1a25a90a4e Fix /auth compat endpoint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-09-22 15:39:01 -04:00
Matej Vasek
c8fd65ea6a fix inverted condition
[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-09-22 15:38:25 -04:00
Ashley Cui
3bd3c62134 Fix machine image
Make sure setting machine image to `testing` pulls down the testing
stream, and not the next stream

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-09-22 14:42:44 -04:00
Daniel J Walsh
f935008108
Merge pull request #11624 from giuseppe/3.4-fix-pause-process
[3.4] runtime: move pause process to scope
2021-09-20 14:17:56 -04:00
Valentin Rothberg
4406ebb461 [3.4] vendor c/common@v0.44.1
Finalizes the linked BZ to fix passing down custom authfiles during auto
updates.  Also fixes the if-newer pull policy.

[NO TESTS NEEDED] for now validated manually.  A new system test will be
added to the main branch shortly.

BZ: bugzilla.redhat.com/show_bug.cgi?id=2000943
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-20 13:29:14 +02:00
Giuseppe Scrivano
e6fe5d6312
system: move MovePauseProcessToScope to utils
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 72534a74b3)
2021-09-17 10:38:00 +02:00
Giuseppe Scrivano
ae5a5b51b0
system: always move pause process when running on systemd
when running on a systemd with systemd, always try to move the pause
process to its own scope.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 9c1e27fdd5)
2021-09-17 10:37:59 +02:00
Giuseppe Scrivano
34c9ce2ec9
system: avoid reading pause pid file
we already know the path to the pause PID file, no need to calculate
it again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit fa9728c550)
2021-09-17 10:37:55 +02:00
Nalin Dahyabhai
e07dccc3ad build: take advantage of --platform lists
The builder can take a list of platforms in the Platforms field of its
BuildOptions argument, and we should definitely take advantage of that.

The `bud-multiple-platform-values` test from buildah exercises support
for this, so
[NO TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-09-16 11:00:05 -04:00
Jelle van der Waa
507000a304 api: handle nil pointer dereference in rest endpoints
When `?all=garbage` is passed to an API endpoint schema validation fails
and err is nil. Wrapf uses err to create an error message causing a nil
pointer dereference.

Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-16 11:00:05 -04:00
Jelle van der Waa
c8cbd87fdc Document all query parameter for /libpod/images/prune
Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-16 09:42:14 -04:00
Jhon Honce
74bc365eb6 Enhance bindings for IDE hints
* Follow https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source
  for leading comment
* Add godoc strings for all exposed methods for IDE support
* Copy field godoc strings into generated code as function godoc string
* Remove unused/unnecessary fields from generator.go structures
* Cleanup code regarding template usage

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-09-16 09:42:14 -04:00
Paul Holzinger
ffc8e57d3b remove rootlessport socket to prevent EADDRINUSE
When we restart a container via podman restart or restart policy the
rootlessport process fails with `address already in use` because the
socketfile still exists.
This is a regression and was introduced in commit abdedc31a2.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-16 09:42:14 -04:00
Hyeon Kim
33591c3ef4 Search gvproxy with config.FindHelperBinary()
Closes #11531

[NO TESTS NEEDED]

Signed-off-by: Hyeon Kim <simnalamburt@gmail.com>
2021-09-16 09:42:14 -04:00
Jason T. Greene
1af0f8934c Add deprecated fields for 1.22+ clients that still expect them
Signed-off-by: Jason Greene <jason.greene@redhat.com>
2021-09-16 09:42:14 -04:00
Ashley Cui
5829d62ea0 Use default username for podman machine ssh
When using the defaut conection for podman machine ssh, use the default
username too.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-09-16 09:42:14 -04:00
baude
fceec6972f Use new aarch64 fcos repos
Now that aarch64 fcos is an official thing, we no longer need to use the side repo (for lack of a better word).  We can now use the same image lookup technique as x86_64.  I removed the special lookup, moved the x86_64 lookup to generic arch, and removed the arch specific files that we no longer needed.

[NO TESTS NEEDED]

Signed-off-by: baude <baude@redhat.com>
2021-09-15 07:43:12 -05:00
Paul Holzinger
31604b43d1
Revert "logs: adjust handling around partial log messages"
This reverts commit 21f396de6f.

Changing the log endpoint is a breaking change we should not do in 3.4.

[NO TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-14 11:40:13 +02:00
Anton Tykhyy
c23f81fab6
Fix #11444: remote breaks with stdout redirection
`setConsoleMode` should do nothing if the handle is not a terminal. The proposed change is [exactly what `golang.org/x/term/IsTerminal()` does on Windows](https://cs.opensource.google/go/x/term/+/6886f2df:term_windows.go).

[NO TESTS NEEDED]

Signed-off-by: Anton Tykhyy <atykhyy@gmail.com>
2021-09-13 17:42:48 +03:00
OpenShift Merge Robot
f785d8d194
Merge pull request #11517 from jwhonce/issues/10053
Refactor API server emphasis on logging
2021-09-12 02:07:36 -04:00
OpenShift Merge Robot
72662f790b
Merge pull request #11525 from rhatdan/healthcheck
Stop outputting 'healthy' on healthcheck
2021-09-11 18:09:36 -04:00
Jhon Honce
deaf969243 Refacter API server emphasis on logging
* To aid in debugging log API request and response bodies at trace
  level. Events can be correlated using the X-Reference-Id.
* Server now echos X-Reference-Id from client if set, otherwise
  generates an unique id.
* Move logic for X-Reference-Id into middleware
* Change uses of Header.Add() to Set() when setting Content-Type
* Log API operations in Apache format using gorilla middleware
* Port server code to use BaseContext and ConnContext

Fixes #10053

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-09-10 15:07:25 -07:00
OpenShift Merge Robot
5e9758fd5f
Merge pull request #11323 from umohnani8/init
Add init containers to generate and play kube
2021-09-10 13:44:47 -04:00
Daniel J Walsh
4fbc5b8fe7
Stop outputting 'healthy' on healthcheck
We should only print unhealthy if the check fails.  Currently this is
filling logs when users are running lots of healthchecks.

Improves: https://github.com/containers/podman/issues/11157

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-10 11:20:01 -04:00
OpenShift Merge Robot
e6046224ea
Merge pull request #11498 from vrothberg/fix-11489
[CI:DOCS] podman machine: enforce a single search registry
2021-09-10 11:02:51 -04:00
OpenShift Merge Robot
0b6c56b80d
Merge pull request #11506 from giuseppe/fix-stats-restart-container
stats: detect container restart and allow paused containers
2021-09-10 10:53:47 -04:00
Urvashi Mohnani
f5e4ffb5e4 Add init containers to generate and play kube
Kubernetes has a concept of init containers that run and exit before
the regular containers in a pod are started. We added init containers
to podman pods as well. This patch adds support for generating init
containers in the kube yaml when a pod we are converting had init
containers. When playing a kube yaml, it detects an init container
and creates such a container in podman accordingly.
Note, only init containers created with the init type set to "always"
will be generated as the "once" option deletes the init container after
it has run and exited. Play kube will always creates init containers
with the "always" init container type.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2021-09-10 09:37:46 -04:00
Jelle van der Waa
f87f27ddc8 Add /containers/stats response to API docs
Include the response schema for a succesful request in the
/containers/stats API documentation

Additionally remove http 409 from /libpod/containers/stats docs, the
documentation was copied from the deprecated stats endpoint, when a
container is unavailabe the endpoint returns an empty list and no 409.

Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-10 15:15:35 +02:00
Valentin Rothberg
5bf2201447 machine: set filemodes in octal
By popular request, turn decimals to octal.  Most eyes are trained to
parse file permissions in octal.

[NO TESTS NEEDED] since machine isn't tested yet.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-10 12:50:28 +02:00
Valentin Rothberg
6f36a47ac2 podman machine: enforce a single search registry
Enforce "docker.io" to be the only search registry.  Short-name
resolution for remote clients is not fully supported since there is no
means to prompt.  Enforcing a single registry  works around the problem
since prompting only fires with more than one search registry.

Fixes: #11489
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-10 12:43:07 +02:00
Giuseppe Scrivano
2b85382ca1
api: correctly set the container stats
override the outer scope variable instead of creating a local one.
Otherwise the wrong variable would be used for the next iterations.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-09-10 09:03:09 +02:00
OpenShift Merge Robot
d477fe5cae
Merge pull request #11447 from chenzhiwei/respect-config
fix play kube can't use infra_image in config file
2021-09-09 10:12:22 -04:00
OpenShift Merge Robot
e73574aa7c
Merge pull request #11430 from saschagrunert/normalize-key
Normalize auth key before calling `SetAuthentication`
2021-09-09 06:42:15 -04:00
Sascha Grunert
bbdaf837b1
Normalize auth key before calling SetAuthentication
Recent changes in c/image caused the `SetAuthentication` API to be more
restrictive in terms of validating the `key` (`server`) input. To ensure
that manually modified or entries in `~/.docker/config.json` still work,
we now strip the leading `http[s]://` prefix.

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

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-09-09 09:17:22 +02:00