1/* 2 Copyright The containerd Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15*/ 16 17syntax = "proto3"; 18 19package containerd.task.v2; 20 21import "google/protobuf/any.proto"; 22import "google/protobuf/empty.proto"; 23import weak "gogoproto/gogo.proto"; 24import "google/protobuf/timestamp.proto"; 25import "github.com/containerd/containerd/api/types/mount.proto"; 26import "github.com/containerd/containerd/api/types/task/task.proto"; 27 28option go_package = "github.com/containerd/containerd/runtime/v2/task;task"; 29 30// Shim service is launched for each container and is responsible for owning the IO 31// for the container and its additional processes. The shim is also the parent of 32// each container and allows reattaching to the IO and receiving the exit status 33// for the container processes. 34service Task { 35 rpc State(StateRequest) returns (StateResponse); 36 rpc Create(CreateTaskRequest) returns (CreateTaskResponse); 37 rpc Start(StartRequest) returns (StartResponse); 38 rpc Delete(DeleteRequest) returns (DeleteResponse); 39 rpc Pids(PidsRequest) returns (PidsResponse); 40 rpc Pause(PauseRequest) returns (google.protobuf.Empty); 41 rpc Resume(ResumeRequest) returns (google.protobuf.Empty); 42 rpc Checkpoint(CheckpointTaskRequest) returns (google.protobuf.Empty); 43 rpc Kill(KillRequest) returns (google.protobuf.Empty); 44 rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty); 45 rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty); 46 rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty); 47 rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty); 48 rpc Wait(WaitRequest) returns (WaitResponse); 49 rpc Stats(StatsRequest) returns (StatsResponse); 50 rpc Connect(ConnectRequest) returns (ConnectResponse); 51 rpc Shutdown(ShutdownRequest) returns (google.protobuf.Empty); 52} 53 54message CreateTaskRequest { 55 string id = 1; 56 string bundle = 2; 57 repeated containerd.types.Mount rootfs = 3; 58 bool terminal = 4; 59 string stdin = 5; 60 string stdout = 6; 61 string stderr = 7; 62 string checkpoint = 8; 63 string parent_checkpoint = 9; 64 google.protobuf.Any options = 10; 65} 66 67message CreateTaskResponse { 68 uint32 pid = 1; 69} 70 71message DeleteRequest { 72 string id = 1; 73 string exec_id = 2; 74} 75 76message DeleteResponse { 77 uint32 pid = 1; 78 uint32 exit_status = 2; 79 google.protobuf.Timestamp exited_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; 80} 81 82message ExecProcessRequest { 83 string id = 1; 84 string exec_id = 2; 85 bool terminal = 3; 86 string stdin = 4; 87 string stdout = 5; 88 string stderr = 6; 89 google.protobuf.Any spec = 7; 90} 91 92message ExecProcessResponse { 93} 94 95message ResizePtyRequest { 96 string id = 1; 97 string exec_id = 2; 98 uint32 width = 3; 99 uint32 height = 4; 100} 101 102message StateRequest { 103 string id = 1; 104 string exec_id = 2; 105} 106 107message StateResponse { 108 string id = 1; 109 string bundle = 2; 110 uint32 pid = 3; 111 containerd.v1.types.Status status = 4; 112 string stdin = 5; 113 string stdout = 6; 114 string stderr = 7; 115 bool terminal = 8; 116 uint32 exit_status = 9; 117 google.protobuf.Timestamp exited_at = 10 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; 118 string exec_id = 11; 119} 120 121message KillRequest { 122 string id = 1; 123 string exec_id = 2; 124 uint32 signal = 3; 125 bool all = 4; 126} 127 128message CloseIORequest { 129 string id = 1; 130 string exec_id = 2; 131 bool stdin = 3; 132} 133 134message PidsRequest { 135 string id = 1; 136} 137 138message PidsResponse { 139 repeated containerd.v1.types.ProcessInfo processes = 1; 140} 141 142message CheckpointTaskRequest { 143 string id = 1; 144 string path = 2; 145 google.protobuf.Any options = 3; 146} 147 148message UpdateTaskRequest { 149 string id = 1; 150 google.protobuf.Any resources = 2; 151 map<string, string> annotations = 3; 152} 153 154message StartRequest { 155 string id = 1; 156 string exec_id = 2; 157} 158 159message StartResponse { 160 uint32 pid = 1; 161} 162 163message WaitRequest { 164 string id = 1; 165 string exec_id = 2; 166} 167 168message WaitResponse { 169 uint32 exit_status = 1; 170 google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; 171} 172 173message StatsRequest { 174 string id = 1; 175} 176 177message StatsResponse { 178 google.protobuf.Any stats = 1; 179} 180 181message ConnectRequest { 182 string id = 1; 183} 184 185message ConnectResponse { 186 uint32 shim_pid = 1; 187 uint32 task_pid = 2; 188 string version = 3; 189} 190 191message ShutdownRequest { 192 string id = 1; 193 bool now = 2; 194} 195 196message PauseRequest { 197 string id = 1; 198} 199 200message ResumeRequest { 201 string id = 1; 202} 203