2018-08-14 03:08:39 +00:00
|
|
|
syntax = "proto3";
|
2018-09-26 17:33:37 +00:00
|
|
|
package hashicorp.nomad.plugins.drivers.proto;
|
2018-08-14 03:08:39 +00:00
|
|
|
option go_package = "proto";
|
|
|
|
|
|
|
|
import "google/protobuf/duration.proto";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
|
2018-08-15 04:06:08 +00:00
|
|
|
import "github.com/hashicorp/nomad/plugins/shared/hclspec/hcl_spec.proto";
|
2018-11-21 00:30:39 +00:00
|
|
|
import "github.com/hashicorp/nomad/plugins/shared/structs/proto/attribute.proto";
|
2018-08-15 04:06:08 +00:00
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
// Driver service defines RPCs used to communicate with a nomad runtime driver.
|
|
|
|
// Some rpcs may not be implemented by the driver based on it's capabilities.
|
|
|
|
service Driver {
|
|
|
|
|
2018-08-23 02:20:26 +00:00
|
|
|
// TaskConfigSchema returns the schema for parsing the driver
|
2018-08-15 22:23:46 +00:00
|
|
|
// configuration of a task.
|
2018-08-23 02:20:26 +00:00
|
|
|
rpc TaskConfigSchema(TaskConfigSchemaRequest) returns (TaskConfigSchemaResponse) {}
|
2018-08-15 22:23:46 +00:00
|
|
|
|
|
|
|
// Capabilities returns a set of features which the driver implements. Some
|
|
|
|
// RPCs are not possible to implement on some runtimes, this allows the
|
|
|
|
// driver to indicate if it doesn't support these RPCs and features.
|
|
|
|
rpc Capabilities(CapabilitiesRequest) returns (CapabilitiesResponse) {}
|
|
|
|
|
|
|
|
// Fingerprint starts a stream which emits information about the driver
|
|
|
|
// including whether the driver healthy and able to function in the
|
|
|
|
// existing environment.
|
|
|
|
//
|
|
|
|
// The driver should immediately stream a FingerprintResponse when the RPC
|
|
|
|
// is initially called, then send any additional responses if there is a
|
|
|
|
// change in the driver's state.
|
|
|
|
rpc Fingerprint(FingerprintRequest) returns (stream FingerprintResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// RecoverTask is used when a task has been started but the driver may not
|
|
|
|
// know about it. Such is the case if the driver restarts or is upgraded.
|
2018-08-15 22:23:46 +00:00
|
|
|
rpc RecoverTask(RecoverTaskRequest) returns (RecoverTaskResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// StartTask starts and tracks the task on the implemented runtime
|
|
|
|
rpc StartTask(StartTaskRequest) returns (StartTaskResponse) {}
|
|
|
|
|
|
|
|
// WaitTask blocks until the given task exits, returning the result of the
|
|
|
|
// task. It may be called after the task has exited, but before the task is
|
|
|
|
// destroyed.
|
2018-08-23 02:20:26 +00:00
|
|
|
rpc WaitTask(WaitTaskRequest) returns (WaitTaskResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// StopTask stops a given task by sending the desired signal to the process.
|
|
|
|
// If the task does not exit on its own within the given timeout, it will be
|
|
|
|
// forcefully killed.
|
2018-08-15 22:23:46 +00:00
|
|
|
rpc StopTask(StopTaskRequest) returns (StopTaskResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-15 04:06:08 +00:00
|
|
|
// DestroyTask removes the task from the driver's internal state and cleans
|
|
|
|
// up any additional resources created by the driver. It cannot be called
|
2018-09-26 17:33:37 +00:00
|
|
|
// on a running task, unless force is set to true.
|
2018-08-15 22:23:46 +00:00
|
|
|
rpc DestroyTask(DestroyTaskRequest) returns (DestroyTaskResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// InspectTask returns detailed information for the given task
|
|
|
|
rpc InspectTask(InspectTaskRequest) returns (InspectTaskResponse) {}
|
|
|
|
|
|
|
|
// TaskStats collects and returns runtime metrics for the given task
|
2018-12-11 20:27:50 +00:00
|
|
|
rpc TaskStats(TaskStatsRequest) returns (stream TaskStatsResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-15 04:06:08 +00:00
|
|
|
// TaskEvents starts a streaming RPC where all task events emitted by the
|
|
|
|
// driver are streamed to the caller.
|
2018-08-15 22:23:46 +00:00
|
|
|
rpc TaskEvents(TaskEventsRequest) returns (stream DriverTaskEvent) {}
|
2018-08-15 04:06:08 +00:00
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
// The following RPCs are only implemented if the driver sets the
|
|
|
|
// corresponding capability.
|
|
|
|
|
|
|
|
// SignalTask sends a signal to the task
|
2018-08-15 22:23:46 +00:00
|
|
|
rpc SignalTask(SignalTaskRequest) returns (SignalTaskResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// ExecTask executes a command inside the tasks execution context
|
|
|
|
rpc ExecTask(ExecTaskRequest) returns (ExecTaskResponse) {}
|
2019-04-28 21:09:12 +00:00
|
|
|
|
|
|
|
// ExecTaskStreaming executes a command inside the tasks execution context
|
|
|
|
// and streams back results
|
|
|
|
rpc ExecTaskStreaming(stream ExecTaskStreamingRequest) returns (stream ExecTaskStreamingResponse) {}
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
2018-08-23 02:20:26 +00:00
|
|
|
message TaskConfigSchemaRequest {}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-23 02:20:26 +00:00
|
|
|
message TaskConfigSchemaResponse {
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-15 04:06:08 +00:00
|
|
|
// Spec is the configuration schema for the job driver config stanza
|
|
|
|
hashicorp.nomad.plugins.shared.hclspec.Spec spec = 1;
|
2018-08-15 22:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message CapabilitiesRequest {}
|
|
|
|
|
|
|
|
message CapabilitiesResponse {
|
2018-08-15 04:06:08 +00:00
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
// Capabilities provides a way for the driver to denote if it implements
|
|
|
|
// non-core RPCs. Some Driver service RPCs expose additional information
|
|
|
|
// or functionality outside of the core task management functions. These
|
|
|
|
// RPCs are only implemented if the driver sets the corresponding capability.
|
2018-08-15 22:23:46 +00:00
|
|
|
DriverCapabilities capabilities = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message FingerprintRequest {}
|
|
|
|
|
|
|
|
message FingerprintResponse {
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// Attributes are key/value pairs that annotate the nomad client and can be
|
|
|
|
// used in scheduling contraints and affinities.
|
2018-11-21 00:30:39 +00:00
|
|
|
map<string, hashicorp.nomad.plugins.shared.structs.Attribute> attributes = 1;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-23 02:20:26 +00:00
|
|
|
enum HealthState {
|
|
|
|
UNDETECTED = 0;
|
|
|
|
UNHEALTHY = 1;
|
|
|
|
HEALTHY = 2;
|
2018-08-15 22:23:46 +00:00
|
|
|
|
2018-08-23 02:20:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Health is used to determine the state of the health the driver is in.
|
|
|
|
// Health can be one of the following states:
|
|
|
|
// * UNDETECTED: driver dependencies are not met and the driver can not start
|
|
|
|
// * UNHEALTHY: driver dependencies are met but the driver is unable to
|
|
|
|
// perform operations due to some other problem
|
|
|
|
// * HEALTHY: driver is able to perform all operations
|
|
|
|
HealthState health = 2;
|
|
|
|
|
|
|
|
// HealthDescription is a human readable message describing the current
|
|
|
|
// state of driver health
|
|
|
|
string health_description = 3;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message RecoverTaskRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
|
|
|
|
|
|
|
// Handle is the TaskHandle returned from StartTask
|
|
|
|
TaskHandle handle = 2;
|
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message RecoverTaskResponse {}
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
message StartTaskRequest {
|
|
|
|
|
|
|
|
// Task configuration to launch
|
|
|
|
TaskConfig task = 1;
|
2018-08-15 22:23:46 +00:00
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message StartTaskResponse {
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
enum Result {
|
|
|
|
SUCCESS = 0;
|
|
|
|
RETRY = 1;
|
|
|
|
FATAL = 2;
|
|
|
|
}
|
|
|
|
|
2018-08-23 02:47:38 +00:00
|
|
|
// Result is set depending on the type of error that occurred while starting
|
2018-08-15 22:23:46 +00:00
|
|
|
// a task:
|
|
|
|
//
|
2018-08-23 02:47:38 +00:00
|
|
|
// * SUCCESS: No error occurred, handle is set
|
|
|
|
// * RETRY: An error occurred, but is recoverable and the RPC should be retried
|
|
|
|
// * FATAL: A fatal error occurred and is not likely to succeed if retried
|
2018-08-15 22:23:46 +00:00
|
|
|
//
|
|
|
|
// If Result is not successful, the DriverErrorMsg will be set.
|
|
|
|
Result result = 1;
|
|
|
|
|
2018-08-23 02:47:38 +00:00
|
|
|
// DriverErrorMsg is set if an error occurred
|
2018-08-23 02:20:26 +00:00
|
|
|
string driver_error_msg = 2;
|
|
|
|
|
|
|
|
// Handle is opaque to the client, but must be stored in order to recover
|
|
|
|
// the task.
|
|
|
|
TaskHandle handle = 3;
|
|
|
|
|
|
|
|
// NetworkOverride is set if the driver sets network settings and the service ip/port
|
|
|
|
// needs to be set differently.
|
|
|
|
NetworkOverride network_override = 4;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message WaitTaskRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message WaitTaskResponse {
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// Result is the exit status of the task
|
|
|
|
ExitResult result = 1;
|
2018-08-23 02:47:38 +00:00
|
|
|
// Err is set if any driver error occurred while waiting for the task
|
2018-08-15 22:23:46 +00:00
|
|
|
string err = 2;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message StopTaskRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
|
|
|
|
|
|
|
// Timeout defines the amount of time to wait before forcefully killing
|
|
|
|
// the task. For example, on Unix clients, this means sending a SIGKILL to
|
|
|
|
// the process.
|
|
|
|
google.protobuf.Duration timeout = 2;
|
|
|
|
|
|
|
|
// Signal can be set to override the Task's configured shutdown signal
|
|
|
|
string signal = 3;
|
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message StopTaskResponse {}
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
message DestroyTaskRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
2018-09-26 17:33:37 +00:00
|
|
|
|
|
|
|
// Force destroys the task even if it is still in a running state
|
|
|
|
bool force = 2;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message DestroyTaskResponse {}
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
message InspectTaskRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message InspectTaskResponse {
|
|
|
|
|
|
|
|
// Task details
|
|
|
|
TaskStatus task = 1;
|
2018-08-15 22:23:46 +00:00
|
|
|
|
|
|
|
// Driver details for task
|
|
|
|
TaskDriverStatus driver = 2;
|
|
|
|
|
|
|
|
// NetworkOverride info if set
|
|
|
|
NetworkOverride network_override = 3;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message TaskStatsRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
2018-12-11 20:27:50 +00:00
|
|
|
|
2019-01-25 03:19:18 +00:00
|
|
|
// CollectionInterval is the interval at which to stream stats to the caller
|
|
|
|
google.protobuf.Duration collection_interval = 2;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message TaskStatsResponse {
|
|
|
|
|
|
|
|
// Stats for the task
|
|
|
|
TaskStats stats = 1;
|
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message TaskEventsRequest {}
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
message SignalTaskRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
|
|
|
|
|
|
|
// Signal is the operating system signal to send to the task. Ex: SIGHUP
|
|
|
|
string signal = 2;
|
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message SignalTaskResponse {}
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
message ExecTaskRequest {
|
|
|
|
|
|
|
|
// TaskId is the ID of the target task
|
|
|
|
string task_id = 1;
|
|
|
|
|
|
|
|
// Command is the command to execute in the task environment
|
|
|
|
repeated string command = 2;
|
|
|
|
|
|
|
|
// Timeout is the amount of time to wait for the command to stop.
|
|
|
|
// Defaults to 0 (run forever)
|
|
|
|
google.protobuf.Duration timeout = 3;
|
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message ExecTaskResponse {
|
|
|
|
|
|
|
|
// Stdout from the exec
|
|
|
|
bytes stdout = 1;
|
|
|
|
|
|
|
|
// Stderr from the exec
|
|
|
|
bytes stderr = 2;
|
|
|
|
|
|
|
|
// Result from the exec
|
|
|
|
ExitResult result = 3;
|
|
|
|
}
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2019-04-28 20:58:56 +00:00
|
|
|
message ExecTaskStreamingIOOperation {
|
|
|
|
bytes data = 1;
|
|
|
|
bool close = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ExecTaskStreamingRequest {
|
|
|
|
message Setup {
|
|
|
|
string task_id = 1;
|
|
|
|
repeated string command = 2;
|
|
|
|
bool tty = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TerminalSize {
|
|
|
|
int32 height = 1;
|
|
|
|
int32 width = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
Setup setup = 1;
|
|
|
|
TerminalSize tty_size = 2;
|
|
|
|
ExecTaskStreamingIOOperation stdin = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ExecTaskStreamingResponse {
|
|
|
|
ExecTaskStreamingIOOperation stdout = 1;
|
|
|
|
ExecTaskStreamingIOOperation stderr = 2;
|
|
|
|
|
|
|
|
bool exited = 3;
|
|
|
|
ExitResult result = 4;
|
|
|
|
}
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
message DriverCapabilities {
|
|
|
|
|
|
|
|
// SendSignals indicates that the driver can send process signals (ex. SIGUSR1)
|
|
|
|
// to the task.
|
|
|
|
bool send_signals = 1;
|
|
|
|
|
|
|
|
// Exec indicates that the driver supports executing arbitrary commands
|
|
|
|
// in the task's execution environment.
|
|
|
|
bool exec = 2;
|
2018-08-15 22:23:46 +00:00
|
|
|
|
|
|
|
enum FSIsolation {
|
|
|
|
NONE = 0;
|
|
|
|
CHROOT = 1;
|
|
|
|
IMAGE = 2;
|
|
|
|
}
|
|
|
|
// FsIsolation indicates what kind of filesystem isolation a driver supports.
|
|
|
|
FSIsolation fs_isolation = 3;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message TaskConfig {
|
|
|
|
|
|
|
|
// Id of the task, recommended to the globally unique, must be unique to the driver.
|
|
|
|
string id = 1;
|
|
|
|
|
|
|
|
// Name of the task
|
|
|
|
string name = 2;
|
|
|
|
|
|
|
|
// MsgpackDriverConfig is the encoded driver configuation of the task
|
|
|
|
bytes msgpack_driver_config = 3;
|
|
|
|
|
|
|
|
// Env is the a set of key/value pairs to be set as environment variables
|
|
|
|
map<string, string> env = 4;
|
|
|
|
|
2018-12-19 21:05:33 +00:00
|
|
|
// DeviceEnv is the set of environment variables that are defined by device
|
2019-01-03 12:31:26 +00:00
|
|
|
// plugins. This allows the driver to differentiate environment variables
|
2018-12-19 21:05:33 +00:00
|
|
|
// set by the device plugins and those by the user. When populating the
|
|
|
|
// task's environment env should be used.
|
|
|
|
map<string, string> device_env = 5;
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
// Resources defines the resources to isolate
|
2018-12-19 21:05:33 +00:00
|
|
|
Resources resources = 6;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// Mounts is a list of targets to bind mount into the task directory
|
2018-12-19 21:05:33 +00:00
|
|
|
repeated Mount mounts = 7;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// Devices is a list of system devices to mount into the task's execution
|
|
|
|
// environment.
|
2018-12-19 21:05:33 +00:00
|
|
|
repeated Device devices = 8;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// User defines the operating system user the tasks should run as
|
2018-12-19 21:05:33 +00:00
|
|
|
string user = 9;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// AllocDir is the directory on the host where the allocation directory
|
|
|
|
// exists.
|
2018-12-19 21:05:33 +00:00
|
|
|
string alloc_dir = 10;
|
2018-09-26 19:32:26 +00:00
|
|
|
|
|
|
|
// StdoutPath is the path to the file to open and write task stdout to
|
2018-12-19 21:05:33 +00:00
|
|
|
string stdout_path = 11;
|
2018-09-26 19:32:26 +00:00
|
|
|
|
|
|
|
// StderrPath is the path to the file to open and write task stderr to
|
2018-12-19 21:05:33 +00:00
|
|
|
string stderr_path = 12;
|
2018-11-06 05:39:48 +00:00
|
|
|
|
|
|
|
// TaskGroupName is the name of the task group which this task is a member of
|
2018-12-19 21:05:33 +00:00
|
|
|
string task_group_name = 13;
|
2018-11-06 05:39:48 +00:00
|
|
|
|
|
|
|
// JobName is the name of the job of which this task is part of
|
2018-12-19 21:05:33 +00:00
|
|
|
string job_name = 14;
|
2018-11-16 20:36:28 +00:00
|
|
|
|
2018-11-27 23:52:24 +00:00
|
|
|
// AllocId is the ID of the associated allocation
|
2018-12-19 21:05:33 +00:00
|
|
|
string alloc_id = 15;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Resources {
|
2018-08-15 22:23:46 +00:00
|
|
|
|
2018-12-13 22:41:31 +00:00
|
|
|
// AllocatedResources are the resources set for the task
|
|
|
|
AllocatedTaskResources allocated_resources = 1;
|
2018-08-15 22:23:46 +00:00
|
|
|
|
|
|
|
// LinuxResources are the computed values to set for specific Linux features
|
|
|
|
LinuxResources linux_resources = 2;
|
|
|
|
}
|
|
|
|
|
2018-12-13 22:41:31 +00:00
|
|
|
message AllocatedTaskResources {
|
|
|
|
AllocatedCpuResources cpu = 1;
|
|
|
|
AllocatedMemoryResources memory = 2;
|
2018-08-15 22:23:46 +00:00
|
|
|
repeated NetworkResource networks = 5;
|
|
|
|
}
|
|
|
|
|
2018-12-13 22:41:31 +00:00
|
|
|
message AllocatedCpuResources {
|
|
|
|
int64 cpu_shares = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message AllocatedMemoryResources {
|
|
|
|
int64 memory_mb = 2;
|
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message NetworkResource {
|
|
|
|
string device = 1;
|
|
|
|
string cidr = 2;
|
|
|
|
string ip = 3;
|
|
|
|
int32 mbits = 4;
|
|
|
|
repeated NetworkPort reserved_ports = 5;
|
|
|
|
repeated NetworkPort dynamic_ports = 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
message NetworkPort {
|
|
|
|
string label = 1;
|
|
|
|
int32 value = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message LinuxResources {
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
// CPU CFS (Completely Fair Scheduler) period. Default: 0 (not specified)
|
|
|
|
int64 cpu_period = 1;
|
|
|
|
// CPU CFS (Completely Fair Scheduler) quota. Default: 0 (not specified)
|
|
|
|
int64 cpu_quota = 2;
|
|
|
|
// CPU shares (relative weight vs. other containers). Default: 0 (not specified)
|
|
|
|
int64 cpu_shares = 3;
|
|
|
|
// Memory limit in bytes. Default: 0 (not specified)
|
2018-10-04 19:08:20 +00:00
|
|
|
int64 memory_limit_bytes = 4;
|
2018-08-14 03:08:39 +00:00
|
|
|
// OOMScoreAdj adjusts the oom-killer score. Default: 0 (not specified)
|
|
|
|
int64 oom_score_adj = 5;
|
|
|
|
// CpusetCpus constrains the allowed set of logical CPUs. Default: "" (not specified)
|
|
|
|
string cpuset_cpus = 6;
|
|
|
|
// CpusetMems constrains the allowed set of memory nodes. Default: "" (not specified)
|
|
|
|
string cpuset_mems = 7;
|
2018-11-25 16:53:21 +00:00
|
|
|
// PercentTicks is a compatibility option for docker and should not be used
|
2018-11-16 16:08:53 +00:00
|
|
|
double PercentTicks = 8;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Mount {
|
|
|
|
|
|
|
|
// TaskPath is the file path within the task directory to mount to
|
|
|
|
string task_path = 1;
|
|
|
|
|
|
|
|
// HostPath is the file path on the host to mount from
|
|
|
|
string host_path = 2;
|
|
|
|
|
|
|
|
// Readonly if set true, mounts the path in readonly mode
|
|
|
|
bool readonly = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Device {
|
|
|
|
|
|
|
|
// TaskPath is the file path within the task to mount the device to
|
|
|
|
string task_path = 1;
|
|
|
|
|
|
|
|
// HostPath is the path on the host to the source device
|
|
|
|
string host_path = 2;
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// CgroupPermissions defines the Cgroup permissions of the device.
|
2018-08-14 03:08:39 +00:00
|
|
|
// One or more of the following options can be set:
|
|
|
|
// * r - allows the task to read from the specified device.
|
|
|
|
// * w - allows the task to write to the specified device.
|
|
|
|
// * m - allows the task to create device files that do not yet exist.
|
|
|
|
//
|
|
|
|
// Example: "rw"
|
2018-08-15 22:23:46 +00:00
|
|
|
string cgroup_permissions = 3;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
enum TaskState {
|
2018-08-15 04:06:08 +00:00
|
|
|
UNKNOWN = 0;
|
|
|
|
RUNNING = 1;
|
|
|
|
EXITED = 2;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TaskHandle is created when starting a task and is used to recover task
|
|
|
|
message TaskHandle {
|
|
|
|
|
2019-01-17 02:52:31 +00:00
|
|
|
// Version is used by the driver to version the DriverState schema.
|
|
|
|
// Version 0 is reserved by Nomad and should not be used.
|
2019-01-13 21:05:07 +00:00
|
|
|
int32 version = 1;
|
|
|
|
|
2018-08-14 03:08:39 +00:00
|
|
|
// Config is the TaskConfig for the task
|
2019-01-13 21:05:07 +00:00
|
|
|
TaskConfig config = 2;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// State is the state of the task's execution
|
2019-01-13 21:05:07 +00:00
|
|
|
TaskState state = 3;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// DriverState is the encoded state for the specific driver
|
2019-01-13 21:05:07 +00:00
|
|
|
bytes driver_state = 4;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// NetworkOverride contains network settings which the driver may override
|
|
|
|
// for the task, such as when the driver is setting up the task's network.
|
|
|
|
message NetworkOverride {
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// PortMap can be set to replace ports with driver-specific mappings
|
|
|
|
map<string,int32> port_map = 1;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// Addr is the IP address for the task created by the driver
|
|
|
|
string addr = 2;
|
|
|
|
|
|
|
|
// AutoAdvertise indicates whether the driver thinks services that choose
|
|
|
|
// to auto_advertise_addresses should use this IP instead of the host's.
|
|
|
|
bool auto_advertise = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExitResult contains information about the exit status of a task
|
|
|
|
message ExitResult {
|
|
|
|
|
|
|
|
// ExitCode returned from the task on exit
|
|
|
|
int32 exit_code = 1;
|
|
|
|
|
|
|
|
// Signal is set if a signal was sent to the task
|
|
|
|
int32 signal = 2;
|
|
|
|
|
|
|
|
// OomKilled is true if the task exited as a result of the OOM Killer
|
|
|
|
bool oom_killed = 3;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// TaskStatus includes information of a specific task
|
2018-08-14 03:08:39 +00:00
|
|
|
message TaskStatus {
|
|
|
|
string id = 1;
|
|
|
|
string name = 2;
|
|
|
|
|
|
|
|
// State is the state of the task's execution
|
|
|
|
TaskState state = 3;
|
|
|
|
|
|
|
|
// StartedAt is the timestamp when the task was started
|
2018-09-26 17:33:37 +00:00
|
|
|
google.protobuf.Timestamp started_at = 4;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
// CompletedAt is the timestamp when the task exited.
|
|
|
|
// If the task is still running, CompletedAt will not be set
|
2018-09-26 17:33:37 +00:00
|
|
|
google.protobuf.Timestamp completed_at = 5;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// Result is set when CompletedAt is set.
|
2018-09-26 17:33:37 +00:00
|
|
|
ExitResult result = 6;
|
2018-08-15 22:23:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message TaskDriverStatus {
|
2018-08-14 03:08:39 +00:00
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
// Attributes is a set of string/string key value pairs specific to the
|
|
|
|
// implementing driver
|
|
|
|
map<string, string> attributes = 1;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message TaskStats {
|
|
|
|
|
|
|
|
// Id of the task
|
|
|
|
string id = 1;
|
|
|
|
|
|
|
|
// Timestamp for which the stats were collected
|
|
|
|
google.protobuf.Timestamp timestamp = 2;
|
|
|
|
|
|
|
|
// AggResourceUsage is the aggreate usage of all processes
|
|
|
|
TaskResourceUsage agg_resource_usage = 3;
|
|
|
|
|
|
|
|
// ResourceUsageByPid breaks the usage stats by process
|
|
|
|
map<string, TaskResourceUsage> resource_usage_by_pid = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TaskResourceUsage {
|
|
|
|
|
|
|
|
// CPU usage stats
|
|
|
|
CPUUsage cpu = 1;
|
|
|
|
|
|
|
|
// Memory usage stats
|
|
|
|
MemoryUsage memory = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message CPUUsage {
|
|
|
|
|
|
|
|
double system_mode = 1;
|
|
|
|
double user_mode = 2;
|
|
|
|
double total_ticks = 3;
|
|
|
|
uint64 throttled_periods = 4;
|
|
|
|
uint64 throttled_time = 5;
|
|
|
|
double percent = 6;
|
|
|
|
|
|
|
|
enum Fields {
|
|
|
|
SYSTEM_MODE = 0;
|
|
|
|
USER_MODE = 1;
|
|
|
|
TOTAL_TICKS = 2;
|
|
|
|
THROTTLED_PERIODS = 3;
|
|
|
|
THROTTLED_TIME = 4;
|
|
|
|
PERCENT = 5;
|
|
|
|
}
|
|
|
|
// MeasuredFields indicates which fields were actually sampled
|
|
|
|
repeated Fields measured_fields = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
message MemoryUsage {
|
|
|
|
uint64 rss = 1;
|
|
|
|
uint64 cache = 2;
|
|
|
|
uint64 max_usage = 3;
|
|
|
|
uint64 kernel_usage = 4;
|
|
|
|
uint64 kernel_max_usage = 5;
|
2019-01-14 23:47:52 +00:00
|
|
|
uint64 usage = 7;
|
2019-03-30 19:18:28 +00:00
|
|
|
uint64 swap = 8;
|
2018-08-14 03:08:39 +00:00
|
|
|
|
|
|
|
enum Fields {
|
|
|
|
RSS = 0;
|
|
|
|
CACHE = 1;
|
2018-09-26 17:33:37 +00:00
|
|
|
MAX_USAGE = 2;
|
2018-08-14 03:08:39 +00:00
|
|
|
KERNEL_USAGE = 3;
|
|
|
|
KERNEL_MAX_USAGE = 4;
|
2019-01-14 23:47:52 +00:00
|
|
|
USAGE = 5;
|
2019-03-30 19:18:28 +00:00
|
|
|
SWAP = 6;
|
2018-08-14 03:08:39 +00:00
|
|
|
}
|
|
|
|
// MeasuredFields indicates which fields were actually sampled
|
|
|
|
repeated Fields measured_fields = 6;
|
|
|
|
}
|
2018-08-15 04:06:08 +00:00
|
|
|
|
2018-08-15 22:23:46 +00:00
|
|
|
message DriverTaskEvent {
|
2018-08-15 04:06:08 +00:00
|
|
|
|
|
|
|
// TaskId is the id of the task for the event
|
|
|
|
string task_id = 1;
|
|
|
|
|
2018-12-18 03:36:06 +00:00
|
|
|
// AllocId of the task for the event
|
|
|
|
string alloc_id = 2;
|
|
|
|
|
|
|
|
// TaskName is the name of the task for the event
|
|
|
|
string task_name = 3;
|
|
|
|
|
2018-08-23 02:47:38 +00:00
|
|
|
// Timestamp when the event occurred
|
2018-12-18 03:36:06 +00:00
|
|
|
google.protobuf.Timestamp timestamp = 4;
|
2018-08-15 22:23:46 +00:00
|
|
|
|
2018-08-15 04:06:08 +00:00
|
|
|
// Message is the body of the event
|
2018-12-18 03:36:06 +00:00
|
|
|
string message = 5;
|
2018-08-15 04:06:08 +00:00
|
|
|
|
|
|
|
// Annotations allows for additional key/value data to be sent along with the event
|
2018-12-18 03:36:06 +00:00
|
|
|
map<string,string> annotations = 6;
|
2018-08-15 04:06:08 +00:00
|
|
|
}
|