3718 Commits

Author SHA1 Message Date
7b54fd84ec Add --no-trunc flag to maintain original annotation length
Adds a `--no-trunc` flag to `podman kube generate` preventing the
annotations from being trimmed at 63 characters. However, due to
the fact the annotations will not be trimmed, any annotation that is
longer than 63 characters means this YAML will no longer be Kubernetes
compatible. However, these YAML files can still be used with `podman
kube play` due to the addition of the new flag below.

Adds a `--no-trunc` flag to `podman kube play` supporting YAML files with
annotations that were not truncated to the Kubernetes maximum length of
63 characters.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-07-10 18:02:53 -04:00
eb9d44241e Merge pull request #19004 from rhatdan/secret
Add --replace flag to podman secret create
2023-07-10 14:59:29 -04:00
7b08e024c1 Merge pull request #19180 from vrothberg/fix-19147
manifest inspect: support authentication
2023-07-10 14:40:29 -04:00
a69194b02f manifest inspect: support authentication
Previous tests have worked by pure chance since the client and server
ran on the same host; the server picked up the credentials created by
the client login.

Extend the gating tests and add a new integration test which is further
capable of exercising the remote code.

Note that fixing authentication support requires adding a new
`--authfile` CLi flag to `manifest inspect`.  This will at least allow
for passing an authfile to be bindings.  Username and password are not
yet supported.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-10 16:26:19 +02:00
3f8ee70d0c make --syslog errors non fatal
Podman will always pass down --syslog to conmon since 13c2aca21.
However there systems without syslog running, likely in container
setups. As reported in this was already a problem before when debug
level is used. Then conmon will pass down --syslog back to the podman
container cleanup command causing it to fail without doing anything.
Given that I think it is better to just ignore the error and log it on
debug level, we need to make sure cleanup works consistently.

[NO NEW TESTS NEEDED]

Fixes #19075

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-07-10 11:45:59 +02:00
efefd8cf5b Add --replace flag to podman secret create
Users may want to replace the secret used within containers, without
destroying the secret and recreating it.

Partial fix for https://github.com/containers/podman/issues/18667

Make sure podman --remote secret inspect and podman secret inspect
return the same error message.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-07-09 07:26:09 -04:00
fa654e9857 Use bytes size consistently instead of human size
Previously podman was using "MB" and "GB" (binary) for input but
"MB" and "GB" (decimal) for output, which was causing confusion.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2023-07-06 14:51:06 +02:00
d874790bc6 auto update: fix usage of --authfile
The --authfile flag has been ignored.  Fix that and add a test to make
sure we won't regress another time.  Requires a new --tls-verify flag
to actually test the code.

Also bump c/common since common/pull/1538 is required to correctly check
for updates.  Note that I had to use the go-mod-edit-replace trick on
c/common as c/buildah would otherwise be moved back to 1.30.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2218315
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-07-05 08:30:39 +02:00
a16488f89d fix(command): ignore --format in podman search --list-tags
Fix: https://github.com/containers/podman/issues/19033

Signed-off-by: Black-Hole1 <bh@bugs.cc>
2023-06-30 18:19:48 +08:00
43b9426fc6 cmd/podman, pkg/domain/infra: sockets should live in /var/run on FreeBSD
The /var/run directory is the preferred location for unix domain
sockets.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2023-06-29 14:52:51 +01:00
e3f2a97d1f cmd/podman/system: add API server support on FreeBSD
This adds the 'system service' command to the build on FreeBSD and
suppresses the call to servicereaper.Start which is only needed to
support slirp4netns on Linux. A stub for compat.StatsContainer is also
added - stats are still supported via the libpod.StatsContainer API
call.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2023-06-29 13:10:44 +01:00
bf60bb0731 Display secret to user in inpspect
It is pretty complicated to display the secret on the host, but is
not really secured. This patch makes it easier to examine the secret.

Partial fix for https://github.com/containers/podman/issues/18667

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-28 13:14:49 -04:00
b6e636cbe2 Remove 'inspecting object' from inspect errors
This is just useless noise and gets us closer to what
Docker returns.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-28 08:19:37 -04:00
4dc2e08618 Merge pull request #18977 from jakecorrenti/move-qemu-functions-to-proper-files
Re-organize hypervisor implementations
2023-06-27 22:09:21 +02:00
05eb3e6f13 Make Podman/Buildah use same DecryptConfig/EncryptConfig funcs
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-27 18:04:42 +02:00
516034215f Re-organize hypervisor implementations
Ensures that for each hypervisor implementation, their `config.go` file
deals with implementing the `VirtProvider` interface while the
`machine.go` file is for implementing the `VM` interface.

Moves the `Virtualization` type into a common file and
created wrappers for the individual hypervisors. Allows for shared
functions that are exactly the same while providing the flexibility to
create hypervisor-specific implementations of the functions.

[NO NEW TESTS NEEDED]

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2023-06-23 11:33:19 -04:00
1398cbce8a container wait: support health states
Support two new wait conditions, "healthy" and "unhealthy".  This
further paves the way for integrating sdnotify with health checks which
is currently being tracked in #6160.

Fixes: #13627
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-23 14:16:32 +02:00
811867249b container wait API: use string slice instead of state slice
Massage the internal APIs to use a string slice instead of a state slice
for passing wait conditions.  This paves the way for waiting on
non-state conditions such as "healthy".

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-23 09:26:30 +02:00
614c962c23 use libnetwork/slirp4netns from c/common
Most of the code moved there so if from there and remove it here.

Some extra changes are required here. This is a bit of a mess. The pipe
handling makes this a bit more difficult.

[NO NEW TESTS NEEDED] This is just a rework, existing tests must pass.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-22 11:16:13 +02:00
bb932cc840 cmd, push: expose --compression-level
This patch adds the --compression-level option to the push command.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-06-21 14:28:16 +02:00
cc023c09e9 Merge pull request #18931 from vrothberg/lint
bump golangci-lint to v1.53.3
2023-06-20 06:01:50 -04:00
b2d9bd9e3e Merge pull request #18927 from chuanchang/fix_docs_issue_in_image_store
cmd/podman/root.go: fix help document issue of the image store
2023-06-20 02:33:32 -04:00
772f82ee67 Merge pull request #18917 from Luap99/ip-range
network create --ip-range allow for custom range
2023-06-19 15:02:48 -04:00
60a5a59475 make lint: enable mirror
Helpful reports to avoid unnecessary allocations.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-06-19 14:11:12 +02:00
acb5f97f9d cmd/podman/root.go: fix help document issue of the image store
[NO NEW TESTS NEEDED]

Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2023-06-19 14:47:08 +08:00
feea6663ee Merge pull request #18828 from rhatdan/quadlet
quadlet should exit non zero on failures
2023-06-18 02:39:20 -04:00
3829fbd35a podman: add support for splitting imagestore
Add support for `--imagestore` in podman which allows users to split the filesystem of containers vs image store, imagestore if configured will pull images in image storage instead of the graphRoot while keeping the other parts still in the originally configured graphRoot.

This is an implementation of
https://github.com/containers/storage/pull/1549 in podman.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-06-17 08:51:08 +05:30
e292748534 network create --ip-range allow for custom range
The backend allows for any start/end ip in the subnet. There is no
reason to limit the cli to only CIDR subnets. This allows for much more
flexibility.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-16 17:57:17 +02:00
bfe61af6d7 quadlet should exit non zero on failures
Fixes: #18778

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-06-15 19:12:17 -04:00
3efaffae43 New command: podmansh
This commit creates a new command `podmansh` command which can be used by
administrators to provide a confined shell to their users.

The user will only have access to the volumes and capabilities for that
user.

Co-authored-by: Paul Holzinger <pholzing@redhat.com>
Co-authored-by: Daniel Walsh <dwalsh@redhat.com>
Co-authored-by: Petr Lautrbach <lautrbach@redhat.com>
Co-authored-by: Ed Santiago <santiago@redhat.com>

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2023-06-15 08:14:12 -04:00
3cae574ab2 Merge pull request #18507 from mheon/fix_rm_depends
Fix `podman rm -fa` with dependencies
2023-06-12 13:27:34 -04:00
8bf168cc13 Add ability to set static routes
add routes using the --route flag.
the no_default_route option in --opt prevents a default route from
getting added automatically.

Signed-off-by: Jan Hendrik Farr <github@jfarr.cc>
2023-06-12 10:31:59 +02:00
398e48a24a Change Inherit to use a pointer to a container
This fixes a lint issue, but I'm keeping it in its own commit so
it can be reverted independently if necessary; I don't know what
side effects this may have. I don't *think* there are any
issues, but I'm not sure why it wasn't a pointer in the first
place, so there may have been a reason.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2023-06-07 14:09:07 -04:00
c99d42b8e4 Merge pull request #18798 from edsantiago/fix_filters
filters: better handling of id=
2023-06-07 12:31:11 -04:00
76f4571b71 Merge pull request #18796 from mheon/lock_debugging
Add support for lock debugging
2023-06-07 08:21:17 -04:00
992093ae91 filters: better handling of id=
For filter=id=XXX (containers, pods) and =ctr-ids=XXX (pods):

  if XXX is only hex characters, treat it as a PREFIX
  otherwise, treat it as a REGEX

Add tests. Update documentation. And fix an incorrect help message.

Fixes: #18471

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-06-07 05:29:06 -06:00
944673c883 Address review feedback and add manpage notes
The inspect format for `.LockNumber` needed to be documented.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-06-06 11:04:59 -04:00
4fda7936c5 system locks now reports held locks
To debug a deadlock, we really want to know what lock is actually
locked, so we can figure out what is using that lock. This PR
adds support for this, using trylock to check if every lock on
the system is free or in use. Will really need to be run a few
times in quick succession to verify that it's not a transient
lock and it's actually stuck, but that's not really a big deal.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-06-05 19:34:36 -04:00
0948c078c2 Add a new hidden command, podman system locks
This is a general debug command that identifies any lock
conflicts that could lead to a deadlock. It's only intended for
Libpod developers (while it does tell you if you need to run
`podman system renumber`, you should never have to do that
anyways, and the next commit will include a lot more technical
info in the output that no one except a Libpod dev will want).
Hence, hidden command, and only implemented for the local driver
(recommend just running it by SSHing into a `podman machine` VM
in the unlikely case it's needed by remote Podman).

These conflicts should normally never happen, but having a
command like this is useful for debugging deadlock conditions
when they do occur.

Signed-off-by: Matt Heon <mheon@redhat.com>
2023-06-05 14:47:12 -04:00
eec15a108a Merge pull request #18657 from arizvisa/GH-18120
Added the "--out" parameter and fixed an issue with "--noout" which prevented stdout from being written to.
2023-06-05 14:34:21 -04:00
8cb5d39d43 Pods now return what containers were removed with them
This probably should have been in the API since the beginning,
but it's not too late to start now.

The extra information is returned (both via the REST API, and to
the CLI handler for `podman rm`) but is not yet printed - it
feels like adding it to the output could be a breaking change?

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2023-06-01 16:24:59 -04:00
af5b1d6e80 Merge pull request #18643 from eriksjolund/use-imperative-form
man pages and command help: unify verb forms
2023-05-31 11:16:23 -04:00
370e1132ce completion: fix panic in simplePathJoinUnix()
When we do path completion in images a user could try to complete a
simple relative path, e.g. podman run $IMAGE e... should complete to etc
if this path exists in the image. Right now we panic in this case as the
current check didn't account for an empty string in simplePathJoinUnix().
In such a case return the path directly because we can not alter what
the user typed on the cli and must return a path without slash as well
in order for the shell to suggest the completion.

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

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-05-30 16:09:19 +02:00
de92db0c81 man pages and command help: clean up descriptions
Short description in man pages:
* Use imperative form

Command help (cobra.Command.Short):
* Capitalize first letter
* Use imperative form
* Remove ending full stop when the short description
  only contains one sentence without any commas

Command help (cobra.Command.Long):
* Capitalize first letter unless the sentence starts
  with a command "podman command ..."
* Use imperative form when the long description is
  identical or almost identical to the short description.
  This modification was only done in a few places.

Command tables:
* Use imperative form in the "Description" column

[NO NEW TESTS NEEDED]

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-05-28 18:57:43 +02:00
1210efc44d Merge pull request #18689 from 89luca89/fix/filter_flags
fix: move filter flags from StringSliceVar to StringArrayVar
2023-05-26 07:57:51 -04:00
047a4bc830 fix: volume create filters
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2023-05-25 21:34:53 +02:00
0be9887afc fix: move filter flags from StringSliceVar to StringArrayVar
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2023-05-25 16:53:14 +02:00
08b0d93ea3 kube play: exit-code propagation
Implement means for reflecting failed containers (i.e., those having
exited non-zero) to better integrate `kube play` with systemd.  The
idea is to have the main PID of `kube play` exit non-zero in a
configurable way such that systemd's restart policies can kick in.

When using the default sdnotify-notify policy, the service container
acts as the main PID to further reduce the resource footprint.  In that
case, before stopping the service container, Podman will lookup the exit
codes of all non-infra containers.  The service will then behave
according to the following three exit-code policies:

 - `none`: exit 0 and ignore containers (default)
 - `any`: exit non-zero if _any_ container did
 - `all`: exit non-zero if _all_ containers did

The upper values can be passed via a hidden `kube play
--service-exit-code-propagation` flag which can be used by tests and
later on by Quadlet.

In case Podman acts as the main PID (i.e., when at least one container
runs with an sdnotify-policy other than "ignore"), Podman will continue
to wait for the service container to exit and reflect its exit code.

Note that this commit also fixes a long-standing annoyance of the
service container exiting non-zero.  The underlying issue was that the
service container had been stopped with SIGKILL instead of SIGTERM and
hence exited non-zero.  Fixing that was a prerequisite for the exit-code
propagation to work but also improves the integration of `kube play`
with systemd and hence Quadlet with systemd.

Jira: issues.redhat.com/browse/RUN-1776
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-05-25 14:46:34 +02:00
b15510694b Merge pull request #18649 from Luap99/network-create-dns
network create/update: allow dns servers comma separated
2023-05-22 12:02:08 -04:00
7d831d555c network create/update: allow dns servers comma separated
The examples show that --dns-add 8.8.8.8,1.1.1.1 is valid but it fails,
fix this by using StringSliceVar which splits at commas.
Added tests to ensure it is working.

Fixes #18632

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-05-22 13:30:39 +02:00