api/services/instrospection: add PluginInfo

The new `PlunginInfo()` call can be used for instrospecting the details
of the runtime plugin.

```console
$ ctr plugins inspect-runtime --runtime=io.containerd.runc.v2 --runc-binary=runc
{
    "Name": "io.containerd.runc.v2",
    "Version": {
        "Version": "v2.0.0-beta.0-XX-gXXXXXXXXX.m",
        "Revision": "v2.0.0-beta.0-XX-gXXXXXXXXX.m"
    },
    "Options": {
        "binary_name": "runc"
    },
    "Features": {
        "ociVersionMin": "1.0.0",
        "ociVersionMax": "1.1.0-rc.2",
        ...,
    },
    "Annotations": null
}
```

The shim binary has to support `-info` flag, see `runtime/v2/README.md`

Replaces PR 8509 (`api/services/task: add RuntimeInfo()`)

Co-authored-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2023-05-11 18:17:13 +09:00
parent 9dbb7615b6
commit 22d586e515
24 changed files with 1423 additions and 204 deletions

View File

@@ -96,6 +96,19 @@ var (
},
}
// RuntimeFlags are cli flags specifying runtime
RuntimeFlags = []cli.Flag{
cli.StringFlag{
Name: "runtime",
Usage: "Runtime name or absolute path to runtime binary",
Value: defaults.DefaultRuntime,
},
cli.StringFlag{
Name: "runtime-config-path",
Usage: "Optional runtime config path",
},
}
// ContainerFlags are cli flags specifying container options
ContainerFlags = []cli.Flag{
cli.StringFlag{
@@ -138,19 +151,10 @@ var (
Name: "read-only",
Usage: "Set the containers filesystem as readonly",
},
cli.StringFlag{
Name: "runtime",
Usage: "Runtime name or absolute path to runtime binary",
Value: defaults.DefaultRuntime,
},
cli.StringFlag{
Name: "sandbox",
Usage: "Create the container in the given sandbox",
},
cli.StringFlag{
Name: "runtime-config-path",
Usage: "Optional runtime config path",
},
cli.BoolFlag{
Name: "tty,t",
Usage: "Allocate a TTY for the container",