Commit graph

3091 commits

Author SHA1 Message Date
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
cdoern 94df701512 Implement Podman Container Clone
podman container clone takes the id of an existing continer and creates a specgen from the given container's config
recreating all proper namespaces and overriding spec options like resource limits and the container name if given in the cli options

this command utilizes the common function DefineCreateFlags meaning that we can funnel as many create options as we want
into clone over time allowing the user to clone with as much or as little of the original config as they want.

container clone takes a second argument which is a new name and a third argument which is an image name to use instead of the original container's

the current supported flags are:

--destroy (remove the original container)
--name (new ctr name)
--cpus (sets cpu period and quota)
--cpuset-cpus
--cpu-period
--cpu-rt-period
--cpu-rt-runtime
--cpu-shares
--cpuset-mems
--memory
--run

resolves #10875

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-20 21:11:14 -05:00
Romain Geissler 23a7f4e0de Option --url and --connection should imply --remote.
Closes #13242

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2022-02-19 14:53:37 +00:00
Jason T. Greene c74f8f04fd Introduce podman machine init --root=t|f and podman machine set --root=t|f
Switch default to rootless for mac and windows

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-02-16 03:49:17 -06:00
Jason T. Greene 8f5ba05ec4 Initial implementation of mac forwarding using a privileged docker sock claim helper
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-02-16 03:49:17 -06:00
Morten Linderud a0991c6f36
create: Fix key=value annotation in the flag output
[NO NEW TESTS NEEDED]

Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-02-14 15:42:18 +01:00
Paul Holzinger 3762946e63
Do not set the network config dir to cni plugin dir
I do not know why this code was added but it is wrong. We should never
use a plugin dir as config dir. Also this will fail for netavark. The
correct default will be set in c/common so podman should not touch it.

[NO NEW TESTS NEEDED]

Ref #13183

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-09 16:18:21 +01:00
OpenShift Merge Robot 956664f65b
Merge pull request #12930 from cdoern/podCgroup
Podman pod create --share-parent vs --share=cgroup
2022-02-04 09:41:12 -05:00
OpenShift Merge Robot 722ccaee38
Merge pull request #13047 from cdoern/scpSyntax
podman image scp syntax correction
2022-02-03 10:05:22 -05:00
cdoern 9eb88ea474 Podman pod create --share-parent vs --share=cgroup
separated cgroupNS sharing from setting the pod as the cgroup parent,
made a new flag --share-parent which sets the pod as the cgroup parent for all
containers entering the pod

remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent.

resolves #12765

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-03 09:30:17 -05:00
Paul Holzinger 55c4a1468b
system prune: remove all networks
podman system prune should also remove all networks. When we want to
users to migrate to the new network stack we recommend to run podman
system reset. However this did not remove networks and if there were
still networks around we would continue to use cni since this was
considered an old system.

There is one exception for the default network. It should not be removed
since this could cause other issues when it no longer exists. The
network backend detection logic ignores the default network so this is
fine.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-03 13:14:07 +01:00
OpenShift Merge Robot 89f71177aa
Merge pull request #12859 from baude/netavarke2e
Enable e2e tests with netavark
2022-02-02 16:41:26 -05:00
Brent Baude 7d3ad6081f netavark e2e tests
enabled e2e tests for netavark

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-02 13:03:45 -06:00
Daniel J Walsh a1bc8cb52c
Move each search dns to its own line
Alpine does not seem to use search correctly when there are multiple
search domains on the same line. It only uses the first with the advent.
When podman runs within a separate network we are appending on
dns.podman as a search, if you add a search domain, then this causes the
local search on network to fail.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-02 11:01:09 -05:00
Daniel J Walsh 4ddc4e79d7
Only change network fields if they were actually changed by the user
Fixes: https://github.com/containers/podman/issues/13065

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-02 10:28:34 -05:00