Commit graph

3105 commits

Author SHA1 Message Date
Valentin Rothberg e133a06d2f images --size
Add a --size option to podman images to allow for disabling computing
the size of listed images.  If listing images is critical to
performance, user may chose to turn off size computation to speed things
up.

Context: #13755
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-08 10:09:38 +02:00
OpenShift Merge Robot 330205ebed
Merge pull request #13490 from gcalin/13266
pod logs enhancements: option to color logs
2022-04-04 13:43:27 -04:00
Giuseppe Scrivano 164b64ea3b
specgen: do not set OOMScoreAdj by default
do not force a value of OOMScoreAdj=0 if it is wasn't specified by the
user.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-04-04 15:40:12 +02:00
Paul Holzinger e5745139a7
cli commands: better error for unsupported commands
When you run podman-remote unsahre for example you currently get:
Error: unrecognized command `podman-remote unshare`

This is because we do not add the command to the cobra tree when we run
in remote mode. However this is a bad user experience since it is not
clear that the command is only supported for local podman. Users are
left wondering why this does not work and could think the documentation
is wrong.

To fix it we add a clear error message:
Error: cannot use command "podman-remote unshare" with the remote podman client

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-31 16:20:18 +02:00
gcalin c185d8c0d6
Add option for pod logs to display different colors per container.
Signed-off-by: Krzysztof Baran <krysbaran@gmail.com>
Signed-off-by: gcalin <caling@protonmail.com>
2022-03-29 17:29:13 +02:00
Brent Baude 2ac897aa0d Machine refactor - part 1
the way machine was written was very adjunct and as such is in dire need
of refactoring to better structures and structure methods where
appropriate.  the weekest part is specifically around all the files that
machine requires and how some are just dynamically built on the fly.

this pr defines a new machinefile type which allows us to work with the
file and also takes into account the use of symlinks which are going to
be needed on macos due to its relatively short file length restriction.

also, added unit tests for new methods as well as anywhere else I saw a
need.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-03-28 09:12:08 -05:00
OpenShift Merge Robot ddfa087d00
Merge pull request #13660 from rhatdan/error
Remove error stutter
2022-03-27 13:11:31 +02:00
Daniel J Walsh 7680211ede
Remove error stutter
When podman gets an error it prints out "Error: " before
printing the error string.  If the error message starts with
error, we end up with

Error: error ...

This PR Removes all of these stutters.

logrus.Error() also prints out that this is an error, so no need for the
error stutter.

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-25 21:47:04 -04:00
Daniel J Walsh ffbab30d7b
Run codespell to cleanup typos
[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-25 15:34:41 -04:00
OpenShift Merge Robot caaaf07c1e
Merge pull request #13587 from giuseppe/clone-to-pod
container: allow clone to an existing pod
2022-03-24 18:09:43 +01:00
Giuseppe Scrivano b469bf5c05
container: allow clone to an existing pod
Closes: https://github.com/containers/podman/issues/3979

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-03-24 14:24:50 +01:00
OpenShift Merge Robot 2d46165799
Merge pull request #13606 from paralin/play-kube-inmem
play: kube: support io.reader body arg and remove tempfiles
2022-03-24 12:41:28 +01:00
Aditya R e90b35438c
machine-set: fix example for setting rootful flag
Flag is actually named `rootful` however documented as `root`, fix the
documented example as actual flag.

Both `podman machine init` and `podman machine set` uses flag `rootfull`

[NO TESTS NEEDED]
[NO NEW TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-24 14:35:58 +05:30
Christian Stewart 752680366c play: kube: use in-memory kubefile and remove tempfile
The PlayKube and PlayKubeDown commands accepted a "path" argument to a YAML file
to play. This requires the caller to write the YAML to a file path. The downside
of this is apparent in the HTTP handlers which have to use a temporary file on
disk to store the YAML file.

The file is opened & used as the body of the HTTP request. It's possible to
instead pass a io.Reader and use a fully in-memory request body.

Add backwards-compatible changes to bindings to allow passing either a filepath
or a io.Reader body.

Refactor the podman bindings to use a io.Reader instead of a filepath.

Simplify the HTTP handlers for PlayKube by removing the now unneeded tempfile.

[NO NEW TESTS NEEDED]

Signed-off-by: Christian Stewart <christian@paral.in>
2022-03-24 00:57:01 -07:00
OpenShift Merge Robot a8743d3327
Merge pull request #13588 from flouthoc/import-os-arch
import: allow users to set `--os`, `--arch` and `--variant` of image imports
2022-03-23 13:15:47 +01:00
Aditya R eedce31eb4
import: allow users to set os, arch and variant of imports
Allows users to set `--os` , `--arch` and `--variant` of the image
created from the custom import.

Following is useful when user is already aware of the values which are
correct for their generated rootfs

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-23 11:22:55 +05:30
Valentin Rothberg 06dd9136a2 fix a number of errcheck issues
Numerous issues remain, especially in tests/e2e.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:15:28 +01:00
Valentin Rothberg 6c030cd573 fix a number of godot issues
Still an unknown number remains but I am running out of patience.
Adding dots is not the best use of my time.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Valentin Rothberg 0f12b6fe55 linter: enable nilerr
A number of cases looked suspicious, so I marked them with `FIXME`s to
leave some breadcrumbs.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:35 +01:00
Valentin Rothberg bb6b69b4ab linter: enable wastedassign
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-22 13:04:34 +01:00
OpenShift Merge Robot e034db16bf
Merge pull request #13575 from Luap99/percent
podman system df: fix percent calculation
2022-03-21 15:04:46 +01:00
OpenShift Merge Robot 18d333f53d
Merge pull request #13573 from vrothberg/golangci-lint
bump golangci-lint to v1.45.0
2022-03-21 13:20:46 +01:00
Paul Holzinger e3cc0717b2
podman system df: fix percent calculation
The calculate the percentage we need floating point numbers. The current
code however casted the result of reclaimable/size to an int first.
Casting to an int in go will just discard the decimal points, thus the
result was either 0 or 1 so if multiplied by 100 it would show up as 0%
or 100%.

To fix this we have to multiply by 100 first before casting the result
to an int. Also add a check for div by zero which results in NaN and use
math.Round() to correctly round a number.

Ref #13516

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-21 13:19:31 +01:00
Valentin Rothberg 026bd9b205 bump golangci-lint to v1.45.0
* supports Go 1.18
* disable a number of new linters
* fix minor stylecheck issues

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-21 10:42:53 +01:00
OpenShift Merge Robot 248dbf6089
Merge pull request #13541 from vrothberg/rmi-ignore
podman rmi --ignore
2022-03-21 10:34:40 +01:00
Valentin Rothberg 95dad4d8a4 podman rmi --ignore
Add an `--ignore` flag to `podman image rm` to instruct ignoring image
if a specified image does not exist and to not throw an error.  Other
commands (e.g., `podman container rm`) already support this flag.

Such an `--ignore` flag can come in handy in clean-up scripcts such as
the teardown phases in the Podman tests.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-19 10:05:43 +01:00
Jason T. Greene cc7b5974be Fix type-o and cleanup doc punctuation
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-03-18 17:33:30 -05:00
OpenShift Merge Robot 3853ef9b59
Merge pull request #13540 from mheon/fix_11822
Deduplicate between Volumes and Mounts in compat API
2022-03-18 12:48:41 +01:00
OpenShift Merge Robot b0fefb3e8f
Merge pull request #13523 from n1hility/tolerate-old-machine
Tolerate old machine images, but warn they should be recreated
2022-03-18 12:38:40 +01:00
Valentin Rothberg ea08765f40 go fmt: use go 1.18 conditional-build syntax
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-18 09:11:53 +01:00
Jason T. Greene 3c968c3d22 Handle incompatible machines
Start in a reduced mode for recovery, warn, and provide instructions to recreate them

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-03-18 01:16:34 -05:00
Matthew Heon 0793a58343 Deduplicate between Volumes and Mounts in compat API
Docker Compose v2.0 passes mount specifications in two different
places: Volumes (just the destination) and Mounts (full info
provided - source, destination, etc). This was causing Podman to
refuse to create containers, as the destination was used twice.
Deduplicate between Mounts and Volumes, preferring volumes, to
resolve this.

Fixes #11822

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-03-17 10:45:08 -04:00
Paul Holzinger 45df70ec1e
fix empty newline in version output
When podman is build without git commit information it will print a
empty newline instead. This is undesirable and a regression introduced
in commit 7d22cc88ef.

To test build podman with `go build -mod=vendor -o bin/podman ./cmd/podman`
and check the output of bin/podman version with and without this commit.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-15 20:44:19 +01:00
LStandman e8968c867f Add support for --chrootdirs
Signed-off-by: LStandman <65296484+LStandman@users.noreply.github.com>
2022-03-14 10:31:58 +02:00
Daniel J Walsh feaa1a134a
Add podman play kube --annotation
Allow users to add annotions in the podman play kube command.
This PR Also fixes the fact that annotations in the pod spec were
not being passed down to containers.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-09 17:30:01 -05:00
OpenShift Merge Robot acfcecf2ae
Merge pull request #12913 from rhatdan/kube
Add --context-dir option to podman play kube
2022-03-09 16:19:59 -05:00
Daniel J Walsh 166edf00a1
Fix handling of tmpfs-mode for tmpfs creation in compat mode
The permissions on disk were wrong since we were not converting to
octal.

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

[NO NEW TESTS NEEDED] Since we don't currently test using the docker
client

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-09 08:03:42 -05:00
Brent Baude 5b51b42cc8 machine rm -f stops and removes machine
If you want to remove a running machine, you can now pass the --force/-f
to podman machine rm and the machine will be stopped and removed without
confirmations.

Fixes: #13448

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-03-08 15:47:32 -06:00
Daniel J Walsh 675d775eb5
Add --context-dir option to podman play kube
This option was requested so that users could specify alternate
locations to find context directories for each image build. It
requites the --build option to be set.

Partion Fix: https://github.com/containers/podman/issues/12485

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-01 08:47:09 -05:00
OpenShift Merge Robot 8bdda91ab7
Merge pull request #13362 from keonchennl/pod-logs-add-flag
Add the names flag for pod logs
2022-03-01 08:43:50 -05:00
Xueyuan Chen 40c6192e9e Add the names flag for pod logs
Fixes containers#13261

Signed-off-by: Xueyuan Chen <X.Chen-47@student.tudelft.nl>
2022-03-01 00:18:39 +01:00
Daniel J Walsh 3dc1b8e83f
Add podman volume mount support
Fixes: https://github.com/containers/podman/issues/12768

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-28 14:26:22 -05:00
OpenShift Merge Robot 991c90de1f
Merge pull request #13314 from flouthoc/container-commit-squash
container-commit: support `--squash` to squash layers into one if users want.
2022-02-23 13:07:00 -05:00
Aditya R fbbcb957c7
container-commit: support --squash to squash layers into one
Allow users to commit containers into a single layer.

Usage
```bash
podman container commit --squash <name>
```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-23 17:38:28 +05:30
Daniel J Walsh 6f7a803d06
Cleanup display of trust with transports
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-22 15:08:58 -05:00
OpenShift Merge Robot fab82a7c9c
Merge pull request #13059 from cdoern/clone
Implement Podman Container Clone
2022-02-22 10:10:49 -05:00
OpenShift Merge Robot a746a61a17
Merge pull request #13286 from flouthoc/kube-build-false-default
kube: honor `--build=false` if specified.
2022-02-21 15:33:39 -05:00
OpenShift Merge Robot b3963e7081
Merge pull request #13296 from Romain-Geissler-1A/url-and-connection-implies-remote
Option --url and --connection should imply --remote.
2022-02-21 15:21:37 -05:00
Aditya R 9ce61e3a49
kube: honor --build=false and make --build=true by default
`podman play kube` tries to build images even if `--build` is set to
false so lets honor that and make `--build` , `true` by default so it
matches the original behviour.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-21 23:52:48 +05:30
Paul Holzinger 44d037898e
provide better error on invalid flag
Add a extra `See 'podman command --help'` to the error output.
With this patch you now get:
```
$ podman run -h
Error: flag needs an argument: 'h' in -h
See 'podman run --help'
```

Fixes #13082
Fixes #13002

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-21 19:12:12 +01:00