-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Initial varlink implementation #627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| package ioprojectatomicpodman | ||
|
|
||
| //go:generate $GOPATH/bin/varlink-go-interface-generator io.projectatomic.podman.varlink |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Podman Service Interface | ||
| interface io.projectatomic.podman | ||
|
|
||
| type Version ( | ||
| version: string, | ||
| go_version: string, | ||
| git_commit: string, | ||
| built: int, | ||
| os_arch: string | ||
| ) | ||
|
|
||
| type NotImplemented ( | ||
| comment: string | ||
| ) | ||
|
|
||
| type StringResponse ( | ||
| message: string | ||
| ) | ||
|
|
||
| # System | ||
| method Ping() -> (ping: StringResponse) | ||
| method GetVersion() -> (version: Version) | ||
|
|
||
| # Containers | ||
| method ListContainers() -> (notimplemented: NotImplemented) | ||
| method CreateContainer() -> (notimplemented: NotImplemented) | ||
| method InspectContainer() -> (notimplemented: NotImplemented) | ||
| method ListContainerProcesses() -> (notimplemented: NotImplemented) | ||
| method GetContainerLogs() -> (notimplemented: NotImplemented) | ||
| method ListContainerChanges() -> (notimplemented: NotImplemented) | ||
| method ExportContainer() -> (notimplemented: NotImplemented) | ||
| method GetContainerStats() -> (notimplemented: NotImplemented) | ||
| method ResizeContainerTty() -> (notimplemented: NotImplemented) | ||
|
||
| method StartContainer() -> (notimplemented: NotImplemented) | ||
| method StopContainer() -> (notimplemented: NotImplemented) | ||
| method RestartContainer() -> (notimplemented: NotImplemented) | ||
| method KillContainer() -> (notimplemented: NotImplemented) | ||
| method UpdateContainer() -> (notimplemented: NotImplemented) | ||
|
||
| method RenameContainer() -> (notimplemented: NotImplemented) | ||
|
||
| method PauseContainer() -> (notimplemented: NotImplemented) | ||
| method UnpauseContainer() -> (notimplemented: NotImplemented) | ||
| method AttachToContainer() -> (notimplemented: NotImplemented) | ||
| method WaitContainer() -> (notimplemented: NotImplemented) | ||
| method RemoveContainer() -> (notimplemented: NotImplemented) | ||
| method DeleteStoppedContainers() -> (notimplemented: NotImplemented) | ||
|
|
||
| # Images | ||
| method ListImages() -> (notimplemented: NotImplemented) | ||
| method BuildImage() -> (notimplemented: NotImplemented) | ||
| method CreateImage() -> (notimplemented: NotImplemented) | ||
|
||
| method InspectImage() -> (notimplemented: NotImplemented) | ||
| method HistoryImage() -> (notimplemented: NotImplemented) | ||
| method PushImage() -> (notimplemented: NotImplemented) | ||
| method TagImage() -> (notimplemented: NotImplemented) | ||
| method RemoveImage() -> (notimplemented: NotImplemented) | ||
| method SearchImage() -> (notimplemented: NotImplemented) | ||
| method DeleteUnusedImages() -> (notimplemented: NotImplemented) | ||
| method CreateFromContainer() -> (notimplemented: NotImplemented) | ||
|
||
| method ImportImage() -> (notimplemented: NotImplemented) | ||
| method ExportImage() -> (notimplemented: NotImplemented) | ||
| method PullImage() -> (notimplemented: NotImplemented) | ||
|
|
||
|
|
||
| # Something failed | ||
| error ActionFailed (reason: string) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "github.com/pkg/errors" | ||
| "github.com/projectatomic/libpod/cmd/podman/ioprojectatomicpodman" | ||
| "github.com/projectatomic/libpod/pkg/varlinkapi" | ||
| "github.com/projectatomic/libpod/version" | ||
| "github.com/urfave/cli" | ||
| "github.com/varlink/go/varlink" | ||
| ) | ||
|
|
||
| var ( | ||
| varlinkDescription = ` | ||
| podman varlink | ||
|
|
||
| run varlink interface | ||
| ` | ||
| varlinkFlags = []cli.Flag{} | ||
| varlinkCommand = cli.Command{ | ||
| Name: "varlink", | ||
| Usage: "Run varlink interface", | ||
| Description: varlinkDescription, | ||
| Flags: varlinkFlags, | ||
| Action: varlinkCmd, | ||
| ArgsUsage: "VARLINK_URI", | ||
| } | ||
| ) | ||
|
|
||
| func varlinkCmd(c *cli.Context) error { | ||
| args := c.Args() | ||
| if len(args) < 1 { | ||
| return errors.Errorf("you must provide a varlink URI") | ||
| } | ||
|
|
||
| var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.VarlinkLibpod} | ||
| // Register varlink service. The metadata can be retrieved with: | ||
| // $ varlink info [varlink address URI] | ||
| service, err := varlink.NewService( | ||
| "Atomic", | ||
| "podman", | ||
| version.Version, | ||
| "https://github.com/projectatomic/libpod", | ||
| ) | ||
| if err != nil { | ||
| return errors.Wrapf(err, "unable to create new varlink service") | ||
| } | ||
|
|
||
| for _, i := range varlinkInterfaces { | ||
| if err := service.RegisterInterface(i); err != nil { | ||
| return errors.Errorf("unable to register varlink interface %v", i) | ||
| } | ||
| } | ||
|
|
||
| // Run the varlink server at the given address | ||
| if err = service.Listen(args[0], 0); err != nil { | ||
| return errors.Errorf("unable to start varlink service") | ||
| } | ||
|
|
||
| return nil | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [Unit] | ||
| Description=Pod Manager | ||
| Requires=io.projectatomic.podman.socket | ||
| After=io.projectatomic.podman.socket | ||
|
|
||
| [Service] | ||
| Type=simple | ||
| ExecStart=/usr/bin/podman --varlink=unix:/run/io.projectatomic.podman | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
| Also=io.projectatomic.podman.socket |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [Unit] | ||
| Description=Pod Manager Socket | ||
|
|
||
| [Socket] | ||
| ListenStream=/run/io.projectatomic.podman | ||
|
|
||
| [Install] | ||
| WantedBy=sockets.target |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| % podman(1) podman-varlink - Waits on a container | ||
| % Brent Baude | ||
| # podman-varlink "1" "April 2018" "podman" | ||
|
|
||
| ## NAME | ||
| podman varlink - Runs the varlink backend interface | ||
|
|
||
| ## SYNOPSIS | ||
| **podman varlink** | ||
| [**--help**|**-h**] | ||
| VARLINK_URI | ||
|
|
||
| ## DESCRIPTION | ||
| Starts the varlink service that allows varlink clients to interact with podman. | ||
| <!-- | ||
| More will go here as the docs and api firm up. | ||
| --> | ||
|
|
||
| **podman [GLOBAL OPTIONS] varlink ** | ||
|
|
||
| ## GLOBAL OPTIONS | ||
|
|
||
| **--help, -h** | ||
| Print usage statement | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| podman varlink unix:/run/io.projectatomic.podman | ||
| <!-- | ||
| TODO: More examples with TCP can be added when that works | ||
| as well. | ||
| --> | ||
|
|
||
| ## SEE ALSO | ||
| podman(1) | ||
|
|
||
| ## HISTORY | ||
| April 2018, Originally compiled by Brent Baude<bbaude@redhat.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing CommitContainer()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is under the image side of things ...