| 1 |
// Licensed to the Apache Software Foundation (ASF) under one |
| 2 |
// or more contributor license agreements. See the NOTICE file |
| 3 |
// distributed with this work for additional information |
| 4 |
// regarding copyright ownership. The ASF licenses this file |
| 5 |
// to you under the Apache License, Version 2.0 (the |
| 6 |
// "License"); you may not use this file except in compliance |
| 7 |
// with the License. You may obtain a copy of the License at |
| 8 |
// |
| 9 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
// |
| 11 |
// Unless required by applicable law or agreed to in writing, software |
| 12 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
// See the License for the specific language governing permissions and |
| 15 |
// limitations under the License. |
| 16 |
|
| 17 |
syntax = "proto2"; |
| 18 |
|
| 19 |
package mesos.agent; |
| 20 |
|
| 21 |
import "github.com/mesos/mesos-go/api/v1/lib/mesos.proto"; |
| 22 |
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; |
| 23 |
|
| 24 |
option go_package = "agent"; |
| 25 |
option (gogoproto.benchgen_all) = true; |
| 26 |
option (gogoproto.enum_stringer_all) = true; |
| 27 |
option (gogoproto.equal_all) = true; |
| 28 |
option (gogoproto.goproto_enum_prefix_all) = false; |
| 29 |
option (gogoproto.goproto_enum_stringer_all) = false; |
| 30 |
option (gogoproto.goproto_stringer_all) = false; |
| 31 |
option (gogoproto.goproto_unrecognized_all) = false; |
| 32 |
option (gogoproto.gostring_all) = true; |
| 33 |
option (gogoproto.marshaler_all) = true; |
| 34 |
option (gogoproto.populate_all) = true; |
| 35 |
option (gogoproto.protosizer_all) = true; |
| 36 |
option (gogoproto.stringer_all) = true; |
| 37 |
option (gogoproto.testgen_all) = true; |
| 38 |
option (gogoproto.unmarshaler_all) = true; |
| 39 |
option (gogoproto.verbose_equal_all) = true; |
| 40 |
|
| 41 |
/** |
| 42 |
* Calls that can be sent to the v1 agent API. |
| 43 |
* |
| 44 |
* A call is described using the standard protocol buffer "union" |
| 45 |
* trick, see |
| 46 |
* https://developers.google.com/protocol-buffers/docs/techniques#union. |
| 47 |
*/ |
| 48 |
message Call { |
| 49 |
// If a call of type `Call::FOO` requires additional parameters they can be |
| 50 |
// included in the corresponding `Call::Foo` message. Similarly, if a call |
| 51 |
// receives a synchronous response it will be returned as a `Response` |
| 52 |
// message of type `Response::FOO`; see `Call::LaunchNestedContainerSession` |
| 53 |
// and `Call::AttachContainerOutput` for exceptions. |
| 54 |
enum Type { |
| 55 |
UNKNOWN = 0; |
| 56 |
|
| 57 |
GET_HEALTH = 1; // Retrieves the agent's health status. |
| 58 |
GET_FLAGS = 2; // Retrieves the agent's flag configuration. |
| 59 |
GET_VERSION = 3; // Retrieves the agent's version information. |
| 60 |
GET_METRICS = 4; // See 'GetMetrics' below. |
| 61 |
|
| 62 |
GET_LOGGING_LEVEL = 5; // Retrieves the agent's logging level. |
| 63 |
SET_LOGGING_LEVEL = 6; // See 'SetLoggingLevel' below. |
| 64 |
|
| 65 |
LIST_FILES = 7; |
| 66 |
READ_FILE = 8; // See 'ReadFile' below. |
| 67 |
|
| 68 |
GET_STATE = 9; |
| 69 |
|
| 70 |
GET_CONTAINERS = 10; |
| 71 |
GET_FRAMEWORKS = 11; // Retrieves the information about known frameworks. |
| 72 |
GET_EXECUTORS = 12; // Retrieves the information about known executors. |
| 73 |
GET_TASKS = 13; // Retrieves the information about known tasks. |
| 74 |
GET_AGENT = 20; // Retrieves the agent information. |
| 75 |
|
| 76 |
// Calls for managing nested containers underneath an executor's container. |
| 77 |
LAUNCH_NESTED_CONTAINER = 14; // See 'LaunchNestedContainer' below. |
| 78 |
WAIT_NESTED_CONTAINER = 15; // See 'WaitNestedContainer' below. |
| 79 |
KILL_NESTED_CONTAINER = 16; // See 'KillNestedContainer' below. |
| 80 |
REMOVE_NESTED_CONTAINER = 21; // See 'RemoveNestedContainer' below. |
| 81 |
|
| 82 |
// See 'LaunchNestedContainerSession' below. |
| 83 |
LAUNCH_NESTED_CONTAINER_SESSION = 17; |
| 84 |
|
| 85 |
ATTACH_CONTAINER_INPUT = 18; // See 'AttachContainerInput' below. |
| 86 |
ATTACH_CONTAINER_OUTPUT = 19; // see 'AttachContainerOutput' below. |
| 87 |
|
| 88 |
option (gogoproto.goproto_enum_prefix) = true; |
| 89 |
} |
| 90 |
|
| 91 |
// Provides a snapshot of the current metrics tracked by the agent. |
| 92 |
message GetMetrics { |
| 93 |
// If set, `timeout` would be used to determines the maximum amount of time |
| 94 |
// the API will take to respond. If the timeout is exceeded, some metrics |
| 95 |
// may not be included in the response. |
| 96 |
optional DurationInfo timeout = 1; |
| 97 |
} |
| 98 |
|
| 99 |
// Sets the logging verbosity level for a specified duration. Mesos uses |
| 100 |
// [glog](https://github.com/google/glog) for logging. The library only uses |
| 101 |
// verbose logging which means nothing will be output unless the verbosity |
| 102 |
// level is set (by default it's 0, libprocess uses levels 1, 2, and 3). |
| 103 |
message SetLoggingLevel { |
| 104 |
// The verbosity level. |
| 105 |
required uint32 level = 1 [(gogoproto.nullable) = false]; |
| 106 |
// The duration to keep verbosity level toggled. After this duration, the |
| 107 |
// verbosity level of log would revert to the original level. |
| 108 |
required DurationInfo duration = 2 [(gogoproto.nullable) = false]; |
| 109 |
} |
| 110 |
|
| 111 |
// Provides the file listing for a directory. |
| 112 |
message ListFiles { |
| 113 |
required string path = 1 [(gogoproto.nullable) = false]; |
| 114 |
} |
| 115 |
|
| 116 |
// Reads data from a file. |
| 117 |
message ReadFile { |
| 118 |
// The path of file. |
| 119 |
required string path = 1 [(gogoproto.nullable) = false]; |
| 120 |
|
| 121 |
// Initial offset in file to start reading from. |
| 122 |
required uint64 offset = 2 [(gogoproto.nullable) = false]; |
| 123 |
|
| 124 |
// The maximum number of bytes to read. The read length is capped at 16 |
| 125 |
// memory pages. |
| 126 |
optional uint64 length = 3; |
| 127 |
} |
| 128 |
|
| 129 |
// Launches a nested container within an executor's tree of containers. |
| 130 |
message LaunchNestedContainer { |
| 131 |
required ContainerID container_id = 1 [(gogoproto.customname) = "ContainerID", (gogoproto.nullable) = false]; |
| 132 |
optional CommandInfo command = 2; |
| 133 |
optional ContainerInfo container = 3; |
| 134 |
} |
| 135 |
|
| 136 |
// Waits for the nested container to terminate and receives the exit status. |
| 137 |
message WaitNestedContainer { |
| 138 |
required ContainerID container_id = 1 [(gogoproto.customname) = "ContainerID", (gogoproto.nullable) = false]; |
| 139 |
} |
| 140 |
|
| 141 |
// Kills the nested container. The signal (e.g., SIGTERM, SIGKILL, etc.) |
| 142 |
// to be sent to the container can be specified in the 'signal' field. |
| 143 |
// If 'signal' is not set, SIGKILL is used by default. |
| 144 |
message KillNestedContainer { |
| 145 |
required ContainerID container_id = 1 [(gogoproto.customname) = "ContainerID", (gogoproto.nullable) = false]; |
| 146 |
optional int32 signal = 2; |
| 147 |
} |
| 148 |
|
| 149 |
// Removes a nested container and its artifacts (runtime and sandbox |
| 150 |
// directories). |
| 151 |
message RemoveNestedContainer { |
| 152 |
required ContainerID container_id = 1 [(gogoproto.customname) = "ContainerID", (gogoproto.nullable) = false]; |
| 153 |
} |
| 154 |
|
| 155 |
// Launches a nested container within an executor's tree of containers. |
| 156 |
// The differences between this call and `LaunchNestedContainer` are: |
| 157 |
// 1) The container's life-cycle is tied to the lifetime of the |
| 158 |
// connection used to make this call, i.e., if the connection ever |
| 159 |
// breaks, the container will be destroyed. |
| 160 |
// 2) The nested container shares the same namespaces and cgroups as |
| 161 |
// its parent container. |
| 162 |
// 3) Results in a streaming response of type `ProcessIO`. So the call |
| 163 |
// needs to be made on a persistent connection. |
| 164 |
message LaunchNestedContainerSession { |
| 165 |
required ContainerID container_id = 1 [(gogoproto.customname) = "ContainerID", (gogoproto.nullable) = false]; |
| 166 |
optional CommandInfo command = 2; |
| 167 |
optional ContainerInfo container = 3; |
| 168 |
} |
| 169 |
|
| 170 |
// Attaches the caller to the STDIN of the entry point of the container. |
| 171 |
// Clients can use this to stream input data to a container. |
| 172 |
// Note that this call needs to be made on a persistent connection by |
| 173 |
// streaming a CONTAINER_ID message followed by one or more PROCESS_IO |
| 174 |
// messages. |
| 175 |
message AttachContainerInput { |
| 176 |
enum Type { |
| 177 |
UNKNOWN = 0; |
| 178 |
CONTAINER_ID = 1; |
| 179 |
PROCESS_IO = 2; |
| 180 |
option (gogoproto.goproto_enum_prefix) = true; |
| 181 |
} |
| 182 |
|
| 183 |
optional Type type = 1 [(gogoproto.nullable) = false]; |
| 184 |
optional ContainerID container_id = 2 [(gogoproto.customname) = "ContainerID"]; |
| 185 |
optional ProcessIO process_io = 3 [(gogoproto.customname) = "ProcessIO"]; |
| 186 |
} |
| 187 |
|
| 188 |
// Attaches the caller to the STDOUT and STDERR of the entrypoint of |
| 189 |
// the container. Clients can use this to stream output/error from the |
| 190 |
// container. This call will result in a streaming response of `ProcessIO`; |
| 191 |
// so this call needs to be made on a persistent connection. |
| 192 |
message AttachContainerOutput { |
| 193 |
required ContainerID container_id = 1 [(gogoproto.customname) = "ContainerID", (gogoproto.nullable) = false]; |
| 194 |
} |
| 195 |
|
| 196 |
optional Type type = 1 [(gogoproto.nullable) = false]; |
| 197 |
|
| 198 |
optional GetMetrics get_metrics = 2; |
| 199 |
optional SetLoggingLevel set_logging_level = 3; |
| 200 |
optional ListFiles list_files = 4; |
| 201 |
optional ReadFile read_file = 5; |
| 202 |
optional LaunchNestedContainer launch_nested_container = 6; |
| 203 |
optional WaitNestedContainer wait_nested_container = 7; |
| 204 |
optional KillNestedContainer kill_nested_container = 8; |
| 205 |
optional RemoveNestedContainer remove_nested_container = 12; |
| 206 |
optional LaunchNestedContainerSession launch_nested_container_session = 9; |
| 207 |
optional AttachContainerInput attach_container_input = 10; |
| 208 |
optional AttachContainerOutput attach_container_output = 11; |
| 209 |
} |
| 210 |
|
| 211 |
|
| 212 |
/** |
| 213 |
* Synchronous responses for all calls made to the v1 agent API. |
| 214 |
*/ |
| 215 |
message Response { |
| 216 |
// Each of the responses of type `FOO` corresponds to `Foo` message below. |
| 217 |
enum Type { |
| 218 |
UNKNOWN = 0; |
| 219 |
|
| 220 |
GET_HEALTH = 1; // See 'GetHealth' below. |
| 221 |
GET_FLAGS = 2; // See 'GetFlags' below. |
| 222 |
GET_VERSION = 3; // See 'GetVersion' below. |
| 223 |
GET_METRICS = 4; // See 'GetMetrics' below. |
| 224 |
|
| 225 |
GET_LOGGING_LEVEL = 5; // See 'GetLoggingLevel' below. |
| 226 |
|
| 227 |
LIST_FILES = 6; |
| 228 |
READ_FILE = 7; // See 'ReadFile' below. |
| 229 |
|
| 230 |
GET_STATE = 8; |
| 231 |
|
| 232 |
GET_CONTAINERS = 9; |
| 233 |
GET_FRAMEWORKS = 10; // See 'GetFrameworks' below. |
| 234 |
GET_EXECUTORS = 11; // See 'GetExecutors' below. |
| 235 |
GET_TASKS = 12; // See 'GetTasks' below. |
| 236 |
GET_AGENT = 14; // See 'GetAgent' below. |
| 237 |
|
| 238 |
WAIT_NESTED_CONTAINER = 13; // See 'WaitNestedContainer' below. |
| 239 |
option (gogoproto.goproto_enum_prefix) = true; |
| 240 |
} |
| 241 |
|
| 242 |
// `healthy` would be true if the agent is healthy. Delayed responses are also |
| 243 |
// indicative of the poor health of the agent. |
| 244 |
message GetHealth { |
| 245 |
required bool healthy = 1 [(gogoproto.nullable) = false]; |
| 246 |
} |
| 247 |
|
| 248 |
// Contains the flag configuration of the agent. |
| 249 |
message GetFlags { |
| 250 |
repeated Flag flags = 1 [(gogoproto.nullable) = false]; |
| 251 |
} |
| 252 |
|
| 253 |
// Contains the version information of the agent. |
| 254 |
message GetVersion { |
| 255 |
required VersionInfo version_info = 1 [(gogoproto.nullable) = false]; |
| 256 |
} |
| 257 |
|
| 258 |
// Contains a snapshot of the current metrics. |
| 259 |
message GetMetrics { |
| 260 |
repeated Metric metrics = 1 [(gogoproto.nullable) = false]; |
| 261 |
} |
| 262 |
|
| 263 |
// Contains the logging level of the agent. |
| 264 |
message GetLoggingLevel { |
| 265 |
required uint32 level = 1 [(gogoproto.nullable) = false]; |
| 266 |
} |
| 267 |
|
| 268 |
// Contains the file listing(similar to `ls -l`) for a directory. |
| 269 |
message ListFiles { |
| 270 |
repeated FileInfo file_infos = 1 [(gogoproto.nullable) = false]; |
| 271 |
} |
| 272 |
|
| 273 |
// Contains the file data. |
| 274 |
message ReadFile { |
| 275 |
// The size of file (in bytes). |
| 276 |
required uint64 size = 1 [(gogoproto.nullable) = false]; |
| 277 |
|
| 278 |
required bytes data = 2; |
| 279 |
} |
| 280 |
|
| 281 |
// Contains full state of the agent i.e. information about the tasks, |
| 282 |
// frameworks and executors running in the cluster. |
| 283 |
message GetState { |
| 284 |
optional GetTasks get_tasks = 1; |
| 285 |
optional GetExecutors get_executors = 2; |
| 286 |
optional GetFrameworks get_frameworks = 3; |
| 287 |
} |
| 288 |
|
| 289 |
// Information about containers running on this agent. It contains |
| 290 |
// ContainerStatus and ResourceStatistics along with some metadata |
| 291 |
// of the containers. |
| 292 |
message GetContainers { |
| 293 |
message Container { |
| 294 |
required FrameworkID framework_id = 1 [(gogoproto.customname) = "FrameworkID", (gogoproto.nullable) = false]; |
| 295 |
required ExecutorID executor_id = 2 [(gogoproto.customname) = "ExecutorID", (gogoproto.nullable) = false]; |
| 296 |
required string executor_name = 3 [(gogoproto.nullable) = false]; |
| 297 |
required ContainerID container_id = 4 [(gogoproto.customname) = "ContainerID", (gogoproto.nullable) = false]; |
| 298 |
optional ContainerStatus container_status = 5; |
| 299 |
optional ResourceStatistics resource_statistics = 6; |
| 300 |
} |
| 301 |
|
| 302 |
repeated Container containers = 1 [(gogoproto.nullable) = false]; |
| 303 |
} |
| 304 |
|
| 305 |
// Information about all the frameworks known to the agent at the current |
| 306 |
// time. |
| 307 |
message GetFrameworks { |
| 308 |
message Framework { |
| 309 |
required FrameworkInfo framework_info = 1 [(gogoproto.nullable) = false]; |
| 310 |
} |
| 311 |
|
| 312 |
repeated Framework frameworks = 1 [(gogoproto.nullable) = false]; |
| 313 |
repeated Framework completed_frameworks = 2 [(gogoproto.nullable) = false]; |
| 314 |
} |
| 315 |
|
| 316 |
// Lists information about all the executors known to the agent at the |
| 317 |
// current time. |
| 318 |
message GetExecutors { |
| 319 |
message Executor { |
| 320 |
required ExecutorInfo executor_info = 1 [(gogoproto.nullable) = false]; |
| 321 |
} |
| 322 |
|
| 323 |
repeated Executor executors = 1 [(gogoproto.nullable) = false]; |
| 324 |
repeated Executor completed_executors = 2 [(gogoproto.nullable) = false]; |
| 325 |
} |
| 326 |
|
| 327 |
// Lists information about all the tasks known to the agent at the current |
| 328 |
// time. |
| 329 |
message GetTasks { |
| 330 |
// Tasks that are pending in the agent's queue before an executor is |
| 331 |
// launched. |
| 332 |
repeated Task pending_tasks = 1 [(gogoproto.nullable) = false]; |
| 333 |
|
| 334 |
// Tasks that are enqueued for a launched executor that has not yet |
| 335 |
// registered. |
| 336 |
repeated Task queued_tasks = 2 [(gogoproto.nullable) = false]; |
| 337 |
|
| 338 |
// Tasks that are running. |
| 339 |
repeated Task launched_tasks = 3 [(gogoproto.nullable) = false]; |
| 340 |
|
| 341 |
// Tasks that are terminated but pending updates. |
| 342 |
repeated Task terminated_tasks = 4 [(gogoproto.nullable) = false]; |
| 343 |
|
| 344 |
// Tasks that are terminated and updates acked. |
| 345 |
repeated Task completed_tasks = 5 [(gogoproto.nullable) = false]; |
| 346 |
} |
| 347 |
|
| 348 |
// Contains the agent's information. |
| 349 |
message GetAgent { |
| 350 |
optional AgentInfo agent_info = 1; |
| 351 |
} |
| 352 |
|
| 353 |
// Returns termination information about the nested container. |
| 354 |
message WaitNestedContainer { |
| 355 |
optional int32 exit_status = 1; |
| 356 |
} |
| 357 |
|
| 358 |
optional Type type = 1 [(gogoproto.nullable) = false]; |
| 359 |
|
| 360 |
optional GetHealth get_health = 2; |
| 361 |
optional GetFlags get_flags = 3; |
| 362 |
optional GetVersion get_version = 4; |
| 363 |
optional GetMetrics get_metrics = 5; |
| 364 |
optional GetLoggingLevel get_logging_level = 6; |
| 365 |
optional ListFiles list_files = 7; |
| 366 |
optional ReadFile read_file = 8; |
| 367 |
optional GetState get_state = 9; |
| 368 |
optional GetContainers get_containers = 10; |
| 369 |
optional GetFrameworks get_frameworks = 11; |
| 370 |
optional GetExecutors get_executors = 12; |
| 371 |
optional GetTasks get_tasks = 13; |
| 372 |
optional GetAgent get_agent = 15; |
| 373 |
optional WaitNestedContainer wait_nested_container = 14; |
| 374 |
} |
| 375 |
|
| 376 |
|
| 377 |
/** |
| 378 |
* Streaming response to `Call::LAUNCH_NESTED_CONTAINER_SESSION` and |
| 379 |
* `Call::ATTACH_CONTAINER_OUTPUT`. |
| 380 |
* |
| 381 |
* This message is also used to stream request data for |
| 382 |
* `Call::ATTACH_CONTAINER_INPUT`. |
| 383 |
*/ |
| 384 |
message ProcessIO { |
| 385 |
enum Type { |
| 386 |
UNKNOWN = 0; |
| 387 |
DATA = 1; |
| 388 |
CONTROL = 2; |
| 389 |
option (gogoproto.goproto_enum_prefix) = true; |
| 390 |
} |
| 391 |
|
| 392 |
message Data { |
| 393 |
enum Type { |
| 394 |
UNKNOWN = 0; |
| 395 |
STDIN = 1; |
| 396 |
STDOUT = 2; |
| 397 |
STDERR = 3; |
| 398 |
option (gogoproto.goproto_enum_prefix) = true; |
| 399 |
} |
| 400 |
|
| 401 |
optional Type type = 1 [(gogoproto.nullable) = false]; |
| 402 |
optional bytes data = 2; |
| 403 |
} |
| 404 |
|
| 405 |
|
| 406 |
message Control { |
| 407 |
enum Type { |
| 408 |
UNKNOWN = 0; |
| 409 |
TTY_INFO = 1; |
| 410 |
HEARTBEAT = 2; |
| 411 |
option (gogoproto.goproto_enum_prefix) = true; |
| 412 |
} |
| 413 |
|
| 414 |
message Heartbeat { |
| 415 |
optional DurationInfo interval = 1; |
| 416 |
} |
| 417 |
|
| 418 |
optional Type type = 1 [(gogoproto.nullable) = false]; |
| 419 |
optional TTYInfo tty_info = 2 [(gogoproto.customname) = "TTYInfo"]; |
| 420 |
optional Heartbeat heartbeat = 3; |
| 421 |
} |
| 422 |
|
| 423 |
optional Type type = 1 [(gogoproto.nullable) = false]; |
| 424 |
optional Data data = 2; |
| 425 |
optional Control control = 3; |
| 426 |
} |