Skip to content

Commit

Permalink
api/services/instrospection: support introspecting runtime features
Browse files Browse the repository at this point in the history
```console
$ ctr 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()`)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Jan 17, 2024
1 parent aad3769 commit 627d180
Show file tree
Hide file tree
Showing 27 changed files with 1,158 additions and 152 deletions.
113 changes: 113 additions & 0 deletions api/next.pb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4307,6 +4307,94 @@ file {
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/types/introspection.proto"
package: "containerd.types"
dependency: "google/protobuf/any.proto"
message_type {
name: "RuntimeVersion"
field {
name: "version"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "version"
}
field {
name: "revision"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "revision"
}
}
message_type {
name: "RuntimeInfo"
field {
name: "name"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "name"
}
field {
name: "version"
number: 2
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.RuntimeVersion"
json_name: "version"
}
field {
name: "options"
number: 3
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "options"
}
field {
name: "features"
number: 4
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "features"
}
field {
name: "annotations"
number: 5
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".containerd.types.RuntimeInfo.AnnotationsEntry"
json_name: "annotations"
}
nested_type {
name: "AnnotationsEntry"
field {
name: "key"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "key"
}
field {
name: "value"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "value"
}
options {
map_entry: true
}
}
}
options {
go_package: "github.com/containerd/containerd/v2/api/types;types"
}
syntax: "proto3"
}
file {
name: "google/rpc/status.proto"
package: "google.rpc"
Expand Down Expand Up @@ -4348,6 +4436,8 @@ file {
file {
name: "github.com/containerd/containerd/api/services/introspection/v1/introspection.proto"
package: "containerd.services.introspection.v1"
dependency: "google/protobuf/any.proto"
dependency: "github.com/containerd/containerd/api/types/introspection.proto"
dependency: "github.com/containerd/containerd/api/types/platform.proto"
dependency: "google/rpc/status.proto"
dependency: "google/protobuf/empty.proto"
Expand Down Expand Up @@ -4505,6 +4595,24 @@ file {
json_name: "lastOccurrence"
}
}
message_type {
name: "RuntimeRequest"
field {
name: "runtime_path"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "runtimePath"
}
field {
name: "options"
number: 2
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "options"
}
}
service {
name: "Introspection"
method {
Expand All @@ -4517,6 +4625,11 @@ file {
input_type: ".google.protobuf.Empty"
output_type: ".containerd.services.introspection.v1.ServerResponse"
}
method {
name: "Runtime"
input_type: ".containerd.services.introspection.v1.RuntimeRequest"
output_type: ".containerd.types.RuntimeInfo"
}
}
options {
go_package: "github.com/containerd/containerd/v2/api/services/introspection/v1;introspection"
Expand Down
262 changes: 178 additions & 84 deletions api/services/introspection/v1/introspection.pb.go

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion api/services/introspection/v1/introspection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ syntax = "proto3";

package containerd.services.introspection.v1;

import "google/protobuf/any.proto";
import "github.com/containerd/containerd/api/types/introspection.proto";
import "github.com/containerd/containerd/api/types/platform.proto";
import "google/rpc/status.proto";
import "google/protobuf/empty.proto";
Expand All @@ -33,6 +35,8 @@ service Introspection {
rpc Plugins(PluginsRequest) returns (PluginsResponse);
// Server returns information about the containerd server
rpc Server(google.protobuf.Empty) returns (ServerResponse);
// Runtime returns the runtime info
rpc Runtime(RuntimeRequest) returns (types.RuntimeInfo);
}

message Plugin {
Expand Down Expand Up @@ -110,4 +114,11 @@ message DeprecationWarning {
string id = 1;
string message = 2;
google.protobuf.Timestamp last_occurrence = 3;
}
}

message RuntimeRequest {
string runtime_path = 1;
// Options correspond to CreateTaskRequest.options.
// This is needed to pass the runc binary path, etc.
google.protobuf.Any options = 2;
}
39 changes: 39 additions & 0 deletions api/services/introspection/v1/introspection_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 627d180

Please sign in to comment.