2359 Commits

Author SHA1 Message Date
44da01f45c Refactor compat container create endpoint
* Make endpoint compatibile with docker-py network expectations
* Update specgen helper when called from compat endpoint
* Update godoc on types
* Add test for network/container create using docker-py method
* Add syslog logging when DEBUG=1 for tests

Fixes #8361

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-23 15:20:39 -06:00
5d55285188 Merge pull request #8409 from mlegenovic/master
Docker compat API fixes
2020-11-23 21:17:05 +01:00
6f7b7060e8 [WIP] Docker compat API fixes
These are the first fixes that are needed for development environments like
Eclipse or IntelliJ that have Docker plug-ins and use the Docker API to speak
with container engine (#7857)

Signed-off-by: Milivoje Legenovic <m.legenovic@gmail.com>
2020-11-23 17:45:24 +01:00
dd343418ce Merge pull request #8263 from rhatdan/restart
Allow containers to --restart on-failure with --rm
2020-11-23 13:44:37 +01:00
5292d5a7b8 Merge pull request #8429 from psakar/fix-json-capabilities
APIv2 - strip CAP_ prefix from capabilities in inspect container json
2020-11-21 10:32:28 +01:00
b30ca110ec Merge pull request #8410 from Luap99/fix-multiple-networks
Allow multiple --network flags for podman run/create
2020-11-21 02:11:22 +01:00
41c88a6608 Merge pull request #8423 from psakar/fix-8418
REST API v2 - list of images - mandatory Created attribute
2020-11-20 22:05:50 +01:00
435f61f497 APIv2 - strip CAP_ prefix from capabilities in json
strip prefix "CAP_" from capabilities in json generated by container inspect operation

Signed-off-by: Petr Sakař <petr.sakar@chare.eu>
2020-11-20 21:46:51 +01:00
dc8996ec84 Allow containers to --restart on-failure with --rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-20 13:55:19 -05:00
e24e6b6372 REST API v2 - list of images - mandatory Created attribute
fixes https://github.com/containers/podman/issues/8418

created attribute is missing for images with created datetime set to 0 Unix time (January 1, 1970 UTC) because 0 is considered as default value, and thus attribute was ommited because of 'omitempty' flag

Signed-off-by: Petr Sakař <petr.sakar@chare.eu>
2020-11-20 19:21:03 +01:00
864fe21ed0 Merge pull request #8406 from jwhonce/issues/8390
Make podman service log events
2020-11-20 18:10:56 +01:00
f441190d10 Allow multiple --network flags for podman run/create
We allow a container to be connected to several cni networks
but only if they are listed comma sperated. This is not intuitive
for users especially since the flag parsing allows multiple string
flags but only would take the last value. see: spf13/pflag#72

Also get rid of the extra parsing logic for pods. The invalid options
are already handled by `pkg/specgen`.

A test is added to prevent a future regression.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-20 17:02:48 +01:00
d8795a36b2 Make podman service log events
* Log endpoint calls at level Info
* Ensure API server started at level Info

Fixes #8390

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-19 14:42:56 -07:00
9770947818 Document containers.conf settings for remote connections
Currently we don't document which end of the podman-remote client server
operations uses the containers.conf.  This PR begins documenting this
and then testing to make sure the defaults follow the rules.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-19 14:48:10 -05:00
e239bfa15b Merge pull request #8391 from baude/networkconnectdisconnect
add network connect|disconnect compat endpoints
2020-11-19 16:54:29 +01:00
a3e0b7d117 add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a
given network. it is only for the compatibility layer. some code had to
be refactored to avoid circular imports.

additionally, tests are being deferred temporarily due to some
incompatibility/bug in either docker-py or our stack.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-19 08:16:19 -06:00
b1007caca5 Merge pull request #8379 from rhatdan/remote2
Remove build \!remote flags from test phase 2
2020-11-18 22:51:52 +01:00
e7fd9234cd Align the podman pod ps --filter behavior with podman ps
Filters with the same key work inclusive with the only exception being
`label` which is exclusive. Filters with different keys always work exclusive.

Also update the documentation with the new behavior.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-18 19:31:25 +01:00
3b6d7a3669 Remove build \!remote flags from test phase 2
Add some more tests, document cases where remote will not work
Add FIXMEs for tests that should work on podman-remote but currently
do not.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-18 13:02:44 -05:00
72b67715f8 podman-remote network rm --force is broken
The --force parameter was not being handled correctly.
This is leading to some race conditions in testing failures.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-18 12:57:39 -05:00
61a82159db Merge pull request #8376 from Luap99/podman-filters
Align the podman ps --filter behavior with docker
2020-11-18 18:55:05 +01:00
4f427a89cb Align the podman ps --filter behavior with docker
All of our filters worked exclusive resulting in `--filter status=created --filter status=exited` to return nothing.

In docker filters with the same key work inclusive with the only exception being `label` which is exclusive. Filters with different keys always work exclusive.

This PR aims to match the docker behavior with podman.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-18 11:36:06 +01:00
8a0c3d878b Merge pull request #8355 from baude/compatnetworkconnectdisconnect
add network connect|disconnect compat endpoints
2020-11-17 23:18:48 +01:00
770b03a50c Merge pull request #8363 from AlbanBedel/play-kube-create-only
Add an option to control if play kube should start the pod
2020-11-17 22:40:28 +01:00
d3e794bda3 add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a
given network. it is only for the compatibility layer. some code had to
be refactored to avoid circular imports.

additionally, tests are being deferred temporarily due to some
incompatibility/bug in either docker-py or our stack.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-17 14:22:39 -06:00
c6c6b23393 Client call to /play/kube incorrectly set tlsVerify
The API parameter `tlsVerify` should be the invert of the internal
option `SkipTLSVerify`, fix this conversion.

Signed-off-by: Alban Bedel <albeu@free.fr>
2020-11-17 20:33:33 +01:00
7ab936eafa Add an option to control if play kube should start the pod
Having play kube start the pod is not always appropriate, one might
for example like to have the pod running as a set of systemd services.
Add a `start` option to the command line and API to control if the pod
should be started or not; it defaults to true for backward
compatibility.

Signed-off-by: Alban Bedel <albeu@free.fr>
2020-11-17 20:00:58 +01:00
ff65d6095d Wrap missing container errors with container ID
While playing around with podman system df, I saw that my container
database was in bad state.  Basically podman new about containers
that were no longer in container/storage.

The podman system df was just erroring out early stating "container does not exist"
with no indicator of which container.

This Patch wraps the podman system df errors to indicate which container does not exist.
It also logs errors on containers that get into this state, but continues on to work on
all containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-15 06:45:21 -05:00
4eb9c28433 Merge pull request #8333 from rhatdan/buildah
Podman-remote build is getting ID twice
2020-11-14 15:10:09 +01:00
b5e15f18d0 Podman-remote build is getting ID twice
This PR eliminates the second sending of the image id to the
podman-remote client.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-14 06:25:29 -05:00
2993e97dec Merge pull request #6442 from Luap99/podman-autocomplete
Shell completion
2020-11-13 16:46:51 +01:00
a1187ee6f3 Refactor to use DockerClient vs APIClient
* Update tests and framework
* remove tests for APIClient methods

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-12 15:13:09 -07:00
b5d1d89a37 Add shell completion with cobra
Allow automatic generation for shell completion scripts
with the internal cobra functions (requires v1.0.0+).

This should replace the handwritten completion scripts
and even adds support for fish. With this approach it is
less likley that completions and code are out of sync.

We can now create the scripts with
- podman completion bash
- podman completion zsh
- podman completion fish

To test the completion run:
source <(podman completion bash)

The same works for podman-remote and podman --remote and
it will complete your remote containers/images with
the correct endpoints values from --url/--connection.

The completion logic is written in go and provided by the
cobra library. The completion functions lives in
`cmd/podman/completion/completion.go`.

The unit test at cmd/podman/shell_completion_test.go checks
if each command and flag has an autocompletion function set.
This prevents that commands and flags have no shell completion set.

This commit does not replace the current autocompletion scripts.

Closes #6440

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-12 11:38:31 +01:00
e443c01437 Merge pull request #8295 from baude/issue8294
Set default network driver for APIv2 networks
2020-11-11 15:31:03 +01:00
b917b9925c Set default network driver for APIv2 networks
Recent changes in networking require that the cni network driver be set.
If the user provides no driver, we set the driver to the
defaultnetworkdriver which currently is "bridge".

Fixes: #8294

Signed-off-by: baude <bbaude@redhat.com>
2020-11-10 14:00:54 -06:00
bb07b8c9f1 Merge pull request #8252 from baude/playkubetospecgen
migrate play kube to spec gen
2020-11-10 19:43:47 +01:00
ce2ac7d2d2 Merge pull request #8251 from baude/networkaliases
network aliases for container creation
2020-11-10 19:10:59 +01:00
72ec8b0aa2 migrate play kube to spec gen
we need to migrate play kube away from using the old container creation
method.  the new approach is specgen and this aligns play kube with
container creation in the rest of podman.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-10 07:55:24 -06:00
20b26b5210 Merge pull request #8143 from aojea/dual
enable ipv6 networks
2020-11-10 13:50:43 +00:00
da95fb4226 Merge pull request #8270 from andylibrian/log-driver-option-for-play-kube
Add --log-driver to play kube
2020-11-10 12:29:19 +00:00
e7a72d72fd enable ipv6 network configuration options
enable the ipv6 flag in podman network to be able to create
dual-stack networks for containers.

This is required to be compatible with docker, where --ipv6
really means dual stack.

podman, unlike docker, support IPv6 only containers since
07e3f1bba9674c0cb93a0fa260930bfebbf75728.

Signed-off-by: Antonio Ojea <aojea@redhat.com>
2020-11-10 08:34:52 +01:00
b7b5b6f8e3 network aliases for container creation
podman can now support adding network aliases when running containers
(--network-alias).  It requires an updated dnsname plugin as well as an
updated ocicni to work properly.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-09 15:08:58 -06:00
716f70b5c5 Merge pull request #8236 from jwhonce/jira/run-976
Update CI tests to run python docker library against API
2020-11-09 20:08:29 +00:00
1491b20f08 Merge pull request #8282 from jwhonce/issues/7942
Stop binding layer from changing line endings
2020-11-09 19:59:51 +00:00
2d50ec6996 Update CI tests to run python docker library against API
* Update reference to docker-py to docker to reflect change in library
  name
* Update tests to create storage sandbox
* Enable all tests that endpoints support
* Refactor containers/{id}/rename to return 404 not 500
* Refactor tests to use quay.io vs. docker.io

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-09 10:45:54 -07:00
a722ba6478 Stop binding layer from changing line endings
The binding layer attempted to help the CLI, which just made things
worse.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-09 10:37:18 -07:00
abc77b4221 Merge pull request #8245 from baude/rootlesscreatecompat
rootless container creation settings
2020-11-09 15:56:50 +00:00
f3355d9697 Add --log-driver to play kube
addresses #6604

Signed-off-by: Andy Librian <andylibrian@gmail.com>
2020-11-08 08:59:18 +07:00
dc58d4e285 Merge pull request #8241 from rhatdan/tmpfile
Use /tmp/podman-run-* for backup XDG_RUNTIME_DIR
2020-11-06 15:43:33 +00:00
71a4676404 rootless container creation settings
when running container creation as rootless on the compatibility layer,
we need to make sure settings are not being done for memory and memory
swappiness.

Signed-off-by: baude <bbaude@redhat.com>
2020-11-05 12:27:48 -06:00