6041 Commits

Author SHA1 Message Date
e1ffac6cc7 Merge pull request #4832 from baude/apiv2tomaster
Apiv2tomaster
2020-01-10 21:28:05 +01:00
986feef2e8 fix e2e test failure
it is possible for layers.names to be nil and we must account for that.

Signed-off-by: baude <bbaude@redhat.com>
2020-01-10 13:06:26 -06:00
c3956b1974 address review comments before merge
Signed-off-by: baude <bbaude@redhat.com>
2020-01-10 09:47:19 -06:00
25b34972f4 [CI:DOCS]update apiv2 documentation with swagger goods
Signed-off-by: baude <bbaude@redhat.com>
2020-01-10 09:41:54 -06:00
d924494f56 Initial commit on compatible API
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Create service command

Use cd cmd/service && go build .

$ systemd-socket-activate -l 8081 cmd/service/service &
$ curl http://localhost:8081/v1.24/images/json

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Correct Makefile

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Two more stragglers

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Report errors back as http headers

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Split out handlers, updated output

Output aligned to docker structures

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Refactored routing, added more endpoints and types

* Encapsulated all the routing information in the handler_* files.
* Added more serviceapi/types, including podman additions. See Info

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Cleaned up code, implemented info content

* Move Content-Type check into serviceHandler
* Custom 404 handler showing the url, mostly for debugging
* Refactored images: better method names and explicit http codes
* Added content to /info
* Added podman fields to Info struct
* Added Container struct

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Add a bunch of endpoints

containers: stop, pause, unpause, wait, rm
images: tag, rmi, create (pull only)

Signed-off-by: baude <bbaude@redhat.com>

Add even more handlers

* Add serviceapi/Error() to improve error handling
* Better support for API return payloads
* Renamed unimplemented to unsupported these are generic endpoints
  we don't intend to ever support.  Swarm broken out since it uses
  different HTTP codes to signal that the node is not in a swarm.
* Added more types
* API Version broken out so it can be validated in the future

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Refactor to introduce ServiceWriter

Signed-off-by: Jhon Honce <jhonce@redhat.com>

populate pods endpoints

/libpod/pods/..

exists, kill, pause, prune, restart, remove, start, stop, unpause

Signed-off-by: baude <bbaude@redhat.com>

Add components to Version, fix Error body

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Add images pull output, fix swarm routes

* docker-py tests/integration/api_client_test.py pass 100%
* docker-py tests/integration/api_image_test.py pass 4/16
+ Test failures include services podman does not support

Signed-off-by: Jhon Honce <jhonce@redhat.com>

pods endpoint submission 2

add create and others; only top and stats is left.

Signed-off-by: baude <bbaude@redhat.com>

Update pull image to work from empty registry

Signed-off-by: Jhon Honce <jhonce@redhat.com>

pod create and container create

first pass at pod and container create.  the container create does not
quite work yet but it is very close.  pod create needs a partial
rewrite.  also broken off the DELETE (rm/rmi) to specific handler funcs.

Signed-off-by: baude <bbaude@redhat.com>

Add docker-py demos, GET .../containers/json

* Update serviceapi/types to reflect libpod not podman
* Refactored removeImage() to provide non-streaming return

Signed-off-by: Jhon Honce <jhonce@redhat.com>

create container part2

finished minimal config needed for create container.  started demo.py
for upcoming talk

Signed-off-by: baude <bbaude@redhat.com>

Stop server after honoring request

* Remove casting for method calls
* Improve WriteResponse()
* Update Container API type to match docker API

Signed-off-by: Jhon Honce <jhonce@redhat.com>

fix namespace assumptions

cleaned up namespace issues with libpod.

Signed-off-by: baude <bbaude@redhat.com>

wip

Signed-off-by: baude <bbaude@redhat.com>

Add sliding window when shutting down server

* Added a Timeout rather than closing down service on each call
* Added gorilla/schema dependency for Decode'ing query parameters
* Improved error handling
* Container logs returned and multiplexed for stdout and stderr
  * .../containers/{name}/logs?stdout=True&stderr=True
* Container stats
  * .../containers/{name}/stats

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Improve error handling

* Add check for at least one std stream required for /containers/{id}/logs
* Add check for state in /containers/{id}/top
* Fill in more fields for /info
* Fixed error checking in service start code

Signed-off-by: Jhon Honce <jhonce@redhat.com>

get rest  of image tests for pass

Signed-off-by: baude <bbaude@redhat.com>

linting our content

Signed-off-by: baude <bbaude@redhat.com>

more linting

Signed-off-by: baude <bbaude@redhat.com>

more linting

Signed-off-by: baude <bbaude@redhat.com>

pruning

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]apiv2 pods

migrate from using args in the url to using a json struct in body for
pod create.

Signed-off-by: baude <bbaude@redhat.com>

fix handler_images prune

prune's api changed slightly to deal with filters.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]enabled base container create tests

enabling the base container create tests which allow us to get more into
the stop, kill, etc tests. many new tests now pass.

Signed-off-by: baude <bbaude@redhat.com>

serviceapi errors: append error message to API message

I dearly hope this is not breaking any other tests but debugging
"Internal Server Error" is not helpful to any user.  In case, it
breaks tests, we can rever the commit - that's why it's a small one.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

serviceAPI: add containers/prune endpoint

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

add `service` make target

Also remove the non-functional sub-Makefile.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

add make targets for testing the service

 * `sudo make run-service` for running the service.

 * `DOCKERPY_TEST="tests/integration/api_container_test.py::ListContainersTest" \
 	make run-docker-py-tests`
   for running a specific tests.  Run all tests by leaving the env
   variable empty.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Split handlers and server packages

The files were split to help contain bloat. The api/server package will
contain all code related to the functioning of the server while
api/handlers will have all the code related to implementing the end
points.

api/server/register_* will contain the methods for registering
endpoints.  Additionally, they will have the comments for generating the
swagger spec file.

See api/handlers/version.go for a small example handler,
api/handlers/containers.go contains much more complex handlers.

Signed-off-by: Jhon Honce <jhonce@redhat.com>

[CI:DOCS]enabled more tests

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]libpod endpoints

small refactor for libpod inclusion and began adding endpoints.

Signed-off-by: baude <bbaude@redhat.com>

Implement /build and /events

* Include crypto libraries for future ssh work

Signed-off-by: Jhon Honce <jhonce@redhat.com>

[CI:DOCS]more image implementations

convert from using for to query structs among other changes including
new endpoints.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add bindings for golang

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add volume endpoints for libpod

create, inspect, ls, prune, and rm

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]apiv2 healthcheck enablement

wire up container healthchecks for the api.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]Add mount endpoints

via the api, allow ability to mount a container and list container
mounts.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]Add search endpoint

add search endpoint with golang bindings

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]more apiv2 development

misc population of methods, etc

Signed-off-by: baude <bbaude@redhat.com>

rebase cleanup and epoch reset

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add more network endpoints

also, add some initial error handling and convenience functions for
standard endpoints.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]use helper funcs for bindings

use the methods developed to make writing bindings less duplicative and
easier to use.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add return info for prereview

begin to add return info and status codes for errors so that we can
review the apiv2

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]first pass at adding swagger docs for api

Signed-off-by: baude <bbaude@redhat.com>
2020-01-10 09:41:39 -06:00
6ed88e0475 Merge pull request #4825 from cevich/fix_libseccomp_commit
Fix Makefile ref libseccomp branch as a commit
2020-01-10 13:02:57 +01:00
8acc1dc6c9 Merge pull request #4828 from giuseppe/drop-pause-check
cp: drop check for rootless
2020-01-10 12:46:33 +01:00
751c403d8b cp: drop check for rootless
rootless containers can use pause on cgroups v2.

Whether it is possible or not to use pause depends from multiple
conditions, such as:

- be on a cgroup v2 unified hierarchy,
- using systemd cgroup manager,
- the kernel has the freezer controller,

The last one may fail for root as well.

Instead of trying to catch all the possible conditions in Podman, let
the OCI runtime complain if pause cannot be performed.

Closes: https://github.com/containers/libpod/issues/4813

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-10 11:23:45 +01:00
eb0f79c337 Fix Makefile ref libseccomp branch as a commit
Commit a824186ac9 mistakenly updated LIBSECCOMP_COMMIT with a branch
name instead of a commit reference.  This breaks on Ubuntu's git with
the `--detach` option, causing it to throw this error:

```
fatal: '--detach' cannot be used with '-b/-B/--orphan'
```

Fix this by using the tag `v2.3.3` which at the time of this commit, is
the current HEAD of the release-2.3 branch.

Thanks to Ed Santiago <santiago@redhat.com> for helping figure
out the error and the fix.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-01-09 14:31:26 -05:00
f57fdd038d Merge pull request #4819 from TomSweeneyRedHat/dev/tsweeney/fixpodmanimage
Update podmanimage build process
2020-01-09 14:23:41 +01:00
154b5ca85d Merge pull request #4818 from haircommander/piped-exec-fix
exec: fix pipes
2020-01-09 14:01:42 +01:00
fe49aa0f50 Merge pull request #4821 from AkihiroSuda/fix-rootlessport
rootlessport: remove state dir on exit + honor ctr.runtime.config.TmpDir
2020-01-09 13:50:49 +01:00
aaf94c84e7 Merge pull request #4820 from edsantiago/consistent_option_enumerations
Usage messages: show possible option values
2020-01-09 13:50:43 +01:00
f3fc10feb4 Merge pull request #4802 from rhatdan/varlink
Fix podman-remote info to show registry data
2020-01-09 10:40:20 +01:00
556cc1fadf rootlessport: honor ctr.runtime.config.TmpDir
Previously, rootlessport was using /var/tmp as the tmp dir.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-01-09 14:06:33 +09:00
5990f0f142 rootlessport: remove state dir on exit
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-01-09 13:57:01 +09:00
3b2aa033c8 Usage messages: show possible option values
...in a consistent manner: ("a"|"b"|"c")

This makes it possible (and easy) for zsh completion to
pick those out of the --help messages and offer them
as values when user hits TAB.

I chose this format because it's an already-existing
convention in cmd/podman/common.go.

Also: removed two duplicate "default: x" messages (Cobra
displays those automatically where a non-null default
is specified).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-01-08 14:24:43 -07:00
77994c4957 Update podmanimage build process
(Stealing from: @rhatdan 's https://github.com/containers/buildah/pull/2038 )

1 We need to update all packages in the podman image to make sure they are
up2date.
2 reinstall shadow-utils. For some reason the fedora base image does not
include the file capabilities assigned to /usr/bin/newuidmap and
/usr/bin/newgidmap. Reinstalling shadow-utils, brings them back.
3 Add a default user build to the system. This will create the
/etc/subuid and /etc/subgid maps get created correctly.

Once we have this we should be able to build a container starting with a non
privileged user

podman run -ti --user build --device=/dev/fuse -v ./Dockerfile:/Dockerfile:z quay.io/podman/stable podman buildd /

Addresses: #4741

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-01-08 14:21:21 -05:00
c99b413abb Merge pull request #4758 from rhatdan/validate
Don't show PASS on success for gitvalidate
2020-01-08 18:46:05 +01:00
776eb64ab2 exec: fix pipes
In a largely anticlimatic solution to the saga of piped input from conmon, we come to this solution.

When we pass the Stdin stream to the exec.Command structure, it's immediately consumed and lost, instead of being consumed through CopyDetachable().

When we don't pass -i in, conmon is not told to create a masterfd_stdin, and won't pass anything to the container.

With both, we can do

echo hi | podman exec -til cat

and get the expected hi

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2020-01-08 11:09:08 -05:00
c6ad42a176 Merge pull request #4816 from vrothberg/lint
Fix golint errors
2020-01-08 16:58:50 +01:00
bcf5753276 fix lint - pkg/varlinkapi/virtwriter
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:30 +01:00
2311e5ff8a fix lint - pkg/util: func comment
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:30 +01:00
1d1519b08b fix lint - pkg/spec
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:30 +01:00
83764b84ec fix lint in pkg/rootless
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:30 +01:00
88369acfca fix lint - pkg/network: comment exported types
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:30 +01:00
18c702d053 fix lint - pkg/adapter: comment exported API
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:30 +01:00
583ff5320f fix lint - ignore image.ImageDeleteResponse definition
Golint claims that image.Image stutters but renaming the type would be a
breaking change which isn't worth the consequences.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:30 +01:00
0b53ff2902 fix lint - drop else block
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 15:44:21 +01:00
27caffbb24 Merge pull request #4712 from openSUSE/untag-command
Add `untag` sub-command
2020-01-08 15:05:06 +01:00
baba52c6b5 fix lint: add comment for NameRegex and error
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 13:55:14 +01:00
8ae672632b fix lint: correct func identifier in comment
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 13:52:52 +01:00
aaec8b2408 fix lint: "guarantess" is a misspelling of "guarantees"
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-08 13:51:13 +01:00
0b9dd1a1a0 Merge pull request #4810 from TomSweeneyRedHat/dev/tsweeney/updateinspectcommands
Update demo for the inspect command
2020-01-08 07:47:17 -05:00
a8a766853e Merge pull request #4795 from ssbarnea/master
packaging: validate installed rpms
2020-01-08 13:44:24 +01:00
b33c774c15 Merge pull request #4592 from AkihiroSuda/rootlesskit-port-forwarder
rootless: use RootlessKit port forwarder
2020-01-08 13:16:22 +01:00
da7595a69f rootless: use RootlessKit port forwarder
RootlessKit port forwarder has a lot of advantages over the slirp4netns port forwarder:

* Very high throughput.
  Benchmark result on Travis: socat: 5.2 Gbps, slirp4netns: 8.3 Gbps, RootlessKit: 27.3 Gbps
  (https://travis-ci.org/rootless-containers/rootlesskit/builds/597056377)

* Connections from the host are treated as 127.0.0.1 rather than 10.0.2.2 in the namespace.
  No UDP issue (#4586)

* No tcp_rmem issue (#4537)

* Probably works with IPv6. Even if not, it is trivial to support IPv6.  (#4311)

* Easily extensible for future support of SCTP

* Easily extensible for future support of `lxc-user-nic` SUID network

RootlessKit port forwarder has been already adopted as the default port forwarder by Rootless Docker/Moby,
and no issue has been reported AFAIK.

As the port forwarder is imported as a Go package, no `rootlesskit` binary is required for Podman.

Fix #4586
May-fix #4559
Fix #4537
May-fix #4311

See https://github.com/rootless-containers/rootlesskit/blob/v0.7.0/pkg/port/builtin/builtin.go

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-01-08 19:35:17 +09:00
40b74e02b7 Add untag sub-command
Podman now supports untagging images via the `untag` sub-command for the
root and `image` commands. Testing and documentation has been added as
well.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-08 10:06:10 +01:00
9ea34f8ffa Update demo for the inspect command
Updates the inspect command demo with an up to date
variant and adds a link to script that ran it.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-01-07 19:42:54 -05:00
d52a4dc2d4 Fix podman-remote info to show registry data
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-07 19:38:46 -05:00
c41fd09a8d Merge pull request #4781 from haircommander/seccomp-profile-root
play kube: make seccomp handling better conform to k8s
2020-01-07 22:13:03 +01:00
da0319fecd packaging: validate installed rpms
Previously we builded RPMs that contained an outdated conmon which was
not compatible. From now on `make-install` will also call
`podman version` and `podman info` in order to perform a minimal
sanity check of the installation.

Fixes: #4665
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2020-01-07 20:06:27 +00:00
bd3d8f4e28 Merge pull request #4788 from vrothberg/stale
github stale workflow: rephrase and bump close time
2020-01-07 18:57:54 +01:00
f85b3a01f0 Merge pull request #4774 from QiWang19/cp_src_path
fix bug copy from container directory
2020-01-07 16:10:05 +01:00
8094ee89ba github stale workflow: rephrase and bump close time
Rephrase the stale message to be friendlier and bump the closing time to
365 days.  The docs of the stale workflow do not indicate whether we can
not close, so a limit of 365 days seems fair.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-07 11:04:37 +01:00
b061bb276d Don't show PASS on success for gitvalidate
Make test logs less verbose so that failures are easier to spot.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-06 17:18:18 -05:00
e362220971 Merge pull request #4800 from mheon/bump-1.7.0
Bump to v1.7.0
2020-01-06 22:54:11 +01:00
8e4a489e1b Bump gitvalidation epoch
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-01-06 15:16:38 -05:00
08849db4b0 Bump to v1.7.1-dev
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-01-06 15:16:38 -05:00
b7ce1157b0 Bump to v1.7.0
Signed-off-by: Matthew Heon <mheon@redhat.com>
v1.7.0
2020-01-06 15:16:35 -05:00