[sandbox] Add protobuf definitions

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2021-04-19 15:08:31 -07:00
parent b5ef9b49ae
commit 4445d0a8da
7 changed files with 9447 additions and 4 deletions

View File

@ -22,7 +22,7 @@ file {
java_package: "com.google.protobuf"
java_outer_classname: "AnyProto"
java_multiple_files: true
go_package: "github.com/golang/protobuf/ptypes/any"
go_package: "google.golang.org/protobuf/types/known/anypb"
objc_class_prefix: "GPB"
csharp_namespace: "Google.Protobuf.WellKnownTypes"
}
@ -458,7 +458,7 @@ file {
java_package: "com.google.protobuf"
java_outer_classname: "TimestampProto"
java_multiple_files: true
go_package: "github.com/golang/protobuf/ptypes/timestamp"
go_package: "google.golang.org/protobuf/types/known/timestamppb"
cc_enable_arenas: true
objc_class_prefix: "GPB"
csharp_namespace: "Google.Protobuf.WellKnownTypes"
@ -800,7 +800,7 @@ file {
java_package: "com.google.protobuf"
java_outer_classname: "EmptyProto"
java_multiple_files: true
go_package: "github.com/golang/protobuf/ptypes/empty"
go_package: "google.golang.org/protobuf/types/known/emptypb"
cc_enable_arenas: true
objc_class_prefix: "GPB"
csharp_namespace: "Google.Protobuf.WellKnownTypes"
@ -824,7 +824,7 @@ file {
java_package: "com.google.protobuf"
java_outer_classname: "FieldMaskProto"
java_multiple_files: true
go_package: "google.golang.org/genproto/protobuf/field_mask;field_mask"
go_package: "google.golang.org/protobuf/types/known/fieldmaskpb"
cc_enable_arenas: true
objc_class_prefix: "GPB"
csharp_namespace: "Google.Protobuf.WellKnownTypes"
@ -2929,6 +2929,440 @@ file {
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/types/sandbox.proto"
package: "containerd.types"
dependency: "gogoproto/gogo.proto"
dependency: "google/protobuf/any.proto"
dependency: "google/protobuf/timestamp.proto"
message_type {
name: "Sandbox"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
field {
name: "runtime"
number: 2
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox.Runtime"
options {
65001: 0
}
json_name: "runtime"
}
field {
name: "spec"
number: 3
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "spec"
}
field {
name: "labels"
number: 4
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox.LabelsEntry"
options {
65001: 0
}
json_name: "labels"
}
field {
name: "created_at"
number: 5
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Timestamp"
options {
65001: 0
65010: 1
}
json_name: "createdAt"
}
field {
name: "updated_at"
number: 6
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Timestamp"
options {
65001: 0
65010: 1
}
json_name: "updatedAt"
}
field {
name: "extensions"
number: 7
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox.ExtensionsEntry"
options {
65001: 0
}
json_name: "extensions"
}
nested_type {
name: "Runtime"
field {
name: "name"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "name"
}
field {
name: "options"
number: 2
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "options"
}
}
nested_type {
name: "LabelsEntry"
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
}
}
nested_type {
name: "ExtensionsEntry"
field {
name: "key"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "key"
}
field {
name: "value"
number: 2
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "value"
}
options {
map_entry: true
}
}
}
options {
go_package: "github.com/containerd/containerd/api/types;types"
}
weak_dependency: 0
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto"
package: "containerd.services.sandbox.v1"
dependency: "gogoproto/gogo.proto"
dependency: "google/protobuf/any.proto"
dependency: "github.com/containerd/containerd/api/types/sandbox.proto"
message_type {
name: "StoreCreateRequest"
field {
name: "sandbox"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox"
options {
65001: 0
}
json_name: "sandbox"
}
}
message_type {
name: "StoreCreateResponse"
field {
name: "sandbox"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox"
options {
65001: 0
}
json_name: "sandbox"
}
}
message_type {
name: "StoreUpdateRequest"
field {
name: "sandbox"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox"
options {
65001: 0
}
json_name: "sandbox"
}
field {
name: "fields"
number: 2
label: LABEL_REPEATED
type: TYPE_STRING
json_name: "fields"
}
}
message_type {
name: "StoreUpdateResponse"
field {
name: "sandbox"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox"
options {
65001: 0
}
json_name: "sandbox"
}
}
message_type {
name: "StoreDeleteRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "StoreDeleteResponse"
}
message_type {
name: "StoreListRequest"
field {
name: "filters"
number: 1
label: LABEL_REPEATED
type: TYPE_STRING
json_name: "filters"
}
}
message_type {
name: "StoreListResponse"
field {
name: "list"
number: 1
label: LABEL_REPEATED
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox"
options {
65001: 0
}
json_name: "list"
}
}
message_type {
name: "StoreGetRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "StoreGetResponse"
field {
name: "sandbox"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.Sandbox"
json_name: "sandbox"
}
}
message_type {
name: "ControllerStartRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
field {
name: "spec"
number: 4
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "spec"
}
}
message_type {
name: "ControllerStartResponse"
}
message_type {
name: "ControllerShutdownRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "ControllerShutdownResponse"
}
message_type {
name: "ControllerPauseRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "ControllerPauseResponse"
}
message_type {
name: "ControllerResumeRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "ControllerResumeResponse"
}
message_type {
name: "ControllerPingRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "ControllerPingResponse"
}
message_type {
name: "ControllerStatusRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "ControllerStatusResponse"
field {
name: "status"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "status"
}
}
service {
name: "Store"
method {
name: "Create"
input_type: ".containerd.services.sandbox.v1.StoreCreateRequest"
output_type: ".containerd.services.sandbox.v1.StoreCreateResponse"
}
method {
name: "Update"
input_type: ".containerd.services.sandbox.v1.StoreUpdateRequest"
output_type: ".containerd.services.sandbox.v1.StoreUpdateResponse"
}
method {
name: "Delete"
input_type: ".containerd.services.sandbox.v1.StoreDeleteRequest"
output_type: ".containerd.services.sandbox.v1.StoreDeleteResponse"
}
method {
name: "List"
input_type: ".containerd.services.sandbox.v1.StoreListRequest"
output_type: ".containerd.services.sandbox.v1.StoreListResponse"
}
method {
name: "Get"
input_type: ".containerd.services.sandbox.v1.StoreGetRequest"
output_type: ".containerd.services.sandbox.v1.StoreGetResponse"
}
}
service {
name: "Controller"
method {
name: "Start"
input_type: ".containerd.services.sandbox.v1.ControllerStartRequest"
output_type: ".containerd.services.sandbox.v1.ControllerStartResponse"
}
method {
name: "Shutdown"
input_type: ".containerd.services.sandbox.v1.ControllerShutdownRequest"
output_type: ".containerd.services.sandbox.v1.ControllerShutdownResponse"
}
method {
name: "Pause"
input_type: ".containerd.services.sandbox.v1.ControllerPauseRequest"
output_type: ".containerd.services.sandbox.v1.ControllerPauseResponse"
}
method {
name: "Resume"
input_type: ".containerd.services.sandbox.v1.ControllerResumeRequest"
output_type: ".containerd.services.sandbox.v1.ControllerResumeResponse"
}
method {
name: "Ping"
input_type: ".containerd.services.sandbox.v1.ControllerPingRequest"
output_type: ".containerd.services.sandbox.v1.ControllerPingResponse"
}
method {
name: "Status"
input_type: ".containerd.services.sandbox.v1.ControllerStatusRequest"
output_type: ".containerd.services.sandbox.v1.ControllerStatusResponse"
}
}
options {
go_package: "github.com/containerd/containerd/api/services/sandbox/v1;sandbox"
}
weak_dependency: 0
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/services/snapshots/v1/snapshots.proto"
package: "containerd.services.snapshots.v1"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,132 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
// Sandbox is a v2 runtime extension that allows more complex execution environments for containers.
// This adds a notion of groups of containers that share same lifecycle and/or resources.
// A few good fits for sandbox can be:
// - A "pause" container in k8s, that acts as a parent process for child containers to hold network namespace.
// - (micro)VMs that launch a VM process and executes containers inside guest OS.
// containerd in this case remains implementation agnostic and delegates sandbox handling to runtimes.
// See proposal and discussion here: https://github.com/containerd/containerd/issues/4131
package containerd.services.sandbox.v1;
import weak "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "github.com/containerd/containerd/api/types/sandbox.proto";
option go_package = "github.com/containerd/containerd/api/services/sandbox/v1;sandbox";
// Store provides a metadata storage interface for sandboxes. Similarly to `Containers`,
// sandbox object includes info required to start a new instance, but no runtime state.
// When running a new sandbox instance, store objects are used as base type to create from.
service Store {
rpc Create(StoreCreateRequest) returns (StoreCreateResponse);
rpc Update(StoreUpdateRequest) returns (StoreUpdateResponse);
rpc Delete(StoreDeleteRequest) returns (StoreDeleteResponse);
rpc List(StoreListRequest) returns (StoreListResponse);
rpc Get(StoreGetRequest) returns (StoreGetResponse);
}
message StoreCreateRequest {
containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false];
}
message StoreCreateResponse {
containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false];
}
message StoreUpdateRequest {
containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false];
repeated string fields = 2;
}
message StoreUpdateResponse {
containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false];
}
message StoreDeleteRequest {
string sandbox_id = 1;
}
message StoreDeleteResponse {}
message StoreListRequest {
repeated string filters = 1;
}
message StoreListResponse {
repeated containerd.types.Sandbox list = 1 [(gogoproto.nullable) = false];
}
message StoreGetRequest {
string sandbox_id = 1;
}
message StoreGetResponse {
containerd.types.Sandbox sandbox = 1;
}
// Controller is an interface to manage runtime sandbox instances.
service Controller {
rpc Start(ControllerStartRequest) returns (ControllerStartResponse);
rpc Shutdown(ControllerShutdownRequest) returns (ControllerShutdownResponse);
rpc Pause(ControllerPauseRequest) returns (ControllerPauseResponse);
rpc Resume(ControllerResumeRequest) returns (ControllerResumeResponse);
rpc Ping(ControllerPingRequest) returns (ControllerPingResponse);
rpc Status(ControllerStatusRequest) returns (ControllerStatusResponse);
}
message ControllerStartRequest {
string sandbox_id = 1;
google.protobuf.Any spec = 4;
}
message ControllerStartResponse {
}
message ControllerShutdownRequest {
string sandbox_id = 1;
}
message ControllerShutdownResponse {}
message ControllerPauseRequest {
string sandbox_id = 1;
}
message ControllerPauseResponse {}
message ControllerResumeRequest {
string sandbox_id = 1;
}
message ControllerResumeResponse {}
message ControllerPingRequest {
string sandbox_id = 1;
}
message ControllerPingResponse {}
message ControllerStatusRequest {
string sandbox_id = 1;
}
message ControllerStatusResponse {
google.protobuf.Any status = 1;
}

1147
api/types/sandbox.pb.go Normal file

File diff suppressed because it is too large Load Diff

51
api/types/sandbox.proto Normal file
View File

@ -0,0 +1,51 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package containerd.types;
import weak "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/containerd/containerd/api/types;types";
// Sandbox represents a sandbox metadata object that keeps all info required by controller to
// work with a particular instance. containerd keeps this in metadata store and sends it to a controller with
// each request, so they can reflect sandbox state changes (by updating the corresponding fields).
message Sandbox {
// SandboxID is a unique instance identifier within namespace
string sandbox_id = 1;
message Runtime {
// Name is the name of the runtime.
string name = 1;
// Options specify additional runtime initialization options.
google.protobuf.Any options = 2;
}
// Runtime specifies which runtime to use for executing this container.
Runtime runtime = 2 [(gogoproto.nullable) = false];
// Spec is sandbox configuration (kin of OCI runtime spec, but for VM)
google.protobuf.Any spec = 3;
// Labels provides an area to include arbitrary data on containers.
map<string, string> labels = 4 [(gogoproto.nullable) = false];
// CreatedAt is the time the container was first created.
google.protobuf.Timestamp created_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// UpdatedAt is the last time the container was mutated.
google.protobuf.Timestamp updated_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// Extensions allow clients to provide optional blobs that can be handled by runtime.
map<string, google.protobuf.Any> extensions = 7 [(gogoproto.nullable) = false];
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package containerd.task.v2;
import "google/protobuf/any.proto";
// Sandbox is an optional interface that shim may implement to support sandboxes environments.
// A typical example of sandbox is microVM or pause container - an entity that groups containers and/or
// holds resources relevant for this group.
service Sandbox {
// StartSandbox will create/start a new sandbox instance
rpc StartSandbox(StartSandboxRequest) returns (StartSandboxResponse);
// StopSandbox will stop existing sandbox instance
rpc StopSandbox(StopSandboxRequest) returns (StopSandboxResponse);
// Update can be used to amend the state of currently running sandbox instance (depending on
// implementation this can be used to resize/reacquire needed resources like RAM/CPU).
rpc UpdateSandbox(UpdateSandboxRequest) returns (UpdateSandboxResponse);
// PauseSandbox will suspend currently running sandbox instance.
rpc PauseSandbox(PauseSandboxRequest) returns (PauseSandboxResponse);
// ResumeSandbox will resuyme previously suspended sandbox instance.
rpc ResumeSandbox(ResumeSandboxRequest) returns (ResumeSandboxResponse);
// SandboxStatus will return current status of the running sandbox instance
rpc SandboxStatus(SandboxStatusRequest) returns (SandboxStatusResponse);
// PingSandbox is a lightweight API call to check whether sandbox alive.
rpc PingSandbox(PingRequest) returns (PingResponse);
}
message StartSandboxRequest {
string sandbox_id = 1;
string bundle_path = 2;
}
message StartSandboxResponse {
string pid = 1;
}
message StopSandboxRequest {
string sandbox_id = 1;
uint32 timeout_secs = 2;
}
message StopSandboxResponse {}
message UpdateSandboxRequest {
string sandbox_id = 1;
google.protobuf.Any resources = 2;
map<string, string> annotations = 3;
}
message UpdateSandboxResponse {}
message SandboxStatusRequest {
string sandbox_id = 1;
}
message PauseSandboxRequest {
string sandbox_id = 1;
}
message PauseSandboxResponse {}
message ResumeSandboxRequest {
string sandbox_id = 1;
}
message ResumeSandboxResponse {}
message SandboxStatusResponse {
google.protobuf.Any status = 1;
}
message PingRequest {
string sandbox_id = 1;
}
message PingResponse {}