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