You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/11/04 23:17:43 UTC

[1/2] mesos git commit: Added agent API protos for executing and attaching nested containers.

Repository: mesos
Updated Branches:
  refs/heads/master 19a352aac -> 937674935


Added agent API protos for executing and attaching nested containers.

This patch only contains the proto definitions. The implementation is
not yet present.

Review: https://reviews.apache.org/r/53451


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/93767493
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/93767493
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/93767493

Branch: refs/heads/master
Commit: 93767493595947100ae87d3aa219922844194825
Parents: 4a91d60
Author: Vinod Kone <vi...@gmail.com>
Authored: Wed Nov 2 13:48:39 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Nov 4 16:17:34 2016 -0700

----------------------------------------------------------------------
 include/mesos/agent/agent.proto    | 98 ++++++++++++++++++++++++++++++++-
 include/mesos/v1/agent/agent.proto | 97 +++++++++++++++++++++++++++++++-
 src/slave/http.cpp                 |  5 ++
 src/slave/validation.cpp           |  5 ++
 4 files changed, 201 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/93767493/include/mesos/agent/agent.proto
----------------------------------------------------------------------
diff --git a/include/mesos/agent/agent.proto b/include/mesos/agent/agent.proto
index 0e9e071..9d5c3e7 100644
--- a/include/mesos/agent/agent.proto
+++ b/include/mesos/agent/agent.proto
@@ -32,7 +32,8 @@ 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`.
+   // message of type `Response::FOO`; see `Call::LaunchNestedContainerSession`
+   // and `Call::AttachContainerOutput` for exceptions.
   enum Type {
     UNKNOWN = 0;
 
@@ -58,6 +59,13 @@ message Call {
     LAUNCH_NESTED_CONTAINER = 14;  // See 'LaunchNestedContainer' below.
     WAIT_NESTED_CONTAINER = 15;    // See 'WaitNestedContainer' below.
     KILL_NESTED_CONTAINER = 16;    // See 'KillNestedContainer' below.
+
+    // See 'LaunchNestedContainerSession' below.
+    LAUNCH_NESTED_CONTAINER_SESSION = 17;
+
+    ATTACH_CONTAINER_INPUT = 18; // See 'AttachContainerInput' below.
+    ATTACH_CONTAINER_OUTPUT = 19; // see 'AttachContainerOutput' below.
+
   }
 
   // Provides a snapshot of the current metrics tracked by the agent.
@@ -115,6 +123,46 @@ message Call {
     required ContainerID container_id = 1;
   }
 
+  // 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;
+    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;
+    }
+
+    optional Type type = 1;
+    optional ContainerID container_id = 2;
+    optional ProcessIO process_io = 3;
+  }
+
+  // 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;
+  }
+
   optional Type type = 1;
 
   optional GetMetrics get_metrics = 2;
@@ -124,6 +172,9 @@ message Call {
   optional LaunchNestedContainer launch_nested_container = 6;
   optional WaitNestedContainer wait_nested_container = 7;
   optional KillNestedContainer kill_nested_container = 8;
+  optional LaunchNestedContainerSession launch_nested_container_session = 9;
+  optional AttachContainerInput attach_container_input = 10;
+  optional AttachContainerOutput attach_container_output = 11;
 }
 
 
@@ -281,4 +332,47 @@ message Response {
   optional GetExecutors get_executors = 12;
   optional GetTasks get_tasks = 13;
   optional WaitNestedContainer wait_nested_container = 14;
-}
\ No newline at end of file
+}
+
+
+/**
+ * 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;
+  }
+
+  message Data {
+    enum Type {
+      UNKNOWN = 0;
+      STDIN = 1;
+      STDOUT = 2;
+      STDERR = 3;
+    }
+
+    optional Type type = 1;
+    optional bytes data = 2;
+  }
+
+
+  message Control {
+    enum Type {
+      UNKNOWN = 0;
+      TTY_INFO = 1;
+    }
+
+    optional Type type = 1;
+    optional TTYInfo tty_info = 2;
+  }
+
+  optional Type type = 1;
+  optional Data data = 2;
+  optional Control control = 3;
+}

http://git-wip-us.apache.org/repos/asf/mesos/blob/93767493/include/mesos/v1/agent/agent.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/agent/agent.proto b/include/mesos/v1/agent/agent.proto
index c2f282c..d0fdf29 100644
--- a/include/mesos/v1/agent/agent.proto
+++ b/include/mesos/v1/agent/agent.proto
@@ -32,7 +32,8 @@ 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`.
+   // message of type `Response::FOO`; see `Call::LaunchNestedContainerSession`
+   // and `Call::AttachContainerOutput` for exceptions.
   enum Type {
     UNKNOWN = 0;
 
@@ -58,6 +59,12 @@ message Call {
     LAUNCH_NESTED_CONTAINER = 14;  // See 'LaunchNestedContainer' below.
     WAIT_NESTED_CONTAINER = 15;    // See 'WaitNestedContainer' below.
     KILL_NESTED_CONTAINER = 16;    // See 'KillNestedContainer' below.
+
+    // See 'LaunchNestedContainerSession' below.
+    LAUNCH_NESTED_CONTAINER_SESSION = 17;
+
+    ATTACH_CONTAINER_INPUT = 18; // See 'AttachContainerInput' below.
+    ATTACH_CONTAINER_OUTPUT = 19; // see 'AttachContainerOutput' below.
   }
 
   // Provides a snapshot of the current metrics tracked by the agent.
@@ -115,6 +122,46 @@ message Call {
     required ContainerID container_id = 1;
   }
 
+  // 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;
+    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;
+    }
+
+    optional Type type = 1;
+    optional ContainerID container_id = 2;
+    optional ProcessIO process_io = 3;
+  }
+
+  // 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;
+  }
+
   optional Type type = 1;
 
   optional GetMetrics get_metrics = 2;
@@ -124,6 +171,9 @@ message Call {
   optional LaunchNestedContainer launch_nested_container = 6;
   optional WaitNestedContainer wait_nested_container = 7;
   optional KillNestedContainer kill_nested_container = 8;
+  optional LaunchNestedContainerSession launch_nested_container_session = 9;
+  optional AttachContainerInput attach_container_input = 10;
+  optional AttachContainerOutput attach_container_output = 11;
 }
 
 
@@ -281,4 +331,47 @@ message Response {
   optional GetExecutors get_executors = 12;
   optional GetTasks get_tasks = 13;
   optional WaitNestedContainer wait_nested_container = 14;
-}
\ No newline at end of file
+}
+
+
+/**
+ * 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;
+  }
+
+  message Data {
+    enum Type {
+      UNKNOWN = 0;
+      STDIN = 1;
+      STDOUT = 2;
+      STDERR = 3;
+    }
+
+    optional Type type = 1;
+    optional bytes data = 2;
+  }
+
+
+  message Control {
+    enum Type {
+      UNKNOWN = 0;
+      TTY_INFO = 1;
+    }
+
+    optional Type type = 1;
+    optional TTYInfo tty_info = 2;
+  }
+
+  optional Type type = 1;
+  optional Data data = 2;
+  optional Control control = 3;
+}

http://git-wip-us.apache.org/repos/asf/mesos/blob/93767493/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index a32aca4..381d9c3 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -414,6 +414,11 @@ Future<Response> Slave::Http::api(
 
     case agent::Call::KILL_NESTED_CONTAINER:
       return killNestedContainer(call, principal, acceptType);
+
+    case mesos::agent::Call::LAUNCH_NESTED_CONTAINER_SESSION:
+    case mesos::agent::Call::ATTACH_CONTAINER_INPUT:
+    case mesos::agent::Call::ATTACH_CONTAINER_OUTPUT:
+      return NotImplemented();
   }
 
   UNREACHABLE();

http://git-wip-us.apache.org/repos/asf/mesos/blob/93767493/src/slave/validation.cpp
----------------------------------------------------------------------
diff --git a/src/slave/validation.cpp b/src/slave/validation.cpp
index 974bf24..b3d8bcd 100644
--- a/src/slave/validation.cpp
+++ b/src/slave/validation.cpp
@@ -221,6 +221,11 @@ Option<Error> validate(
 
       return None();
     }
+
+    case mesos::agent::Call::LAUNCH_NESTED_CONTAINER_SESSION:
+    case mesos::agent::Call::ATTACH_CONTAINER_INPUT:
+    case mesos::agent::Call::ATTACH_CONTAINER_OUTPUT:
+      return Error("Unsupported");
   }
 
   UNREACHABLE();


[2/2] mesos git commit: Added TTYInfo to ContainerInfo.

Posted by vi...@apache.org.
Added TTYInfo to ContainerInfo.

Added to ContainerInfo because we want to be able to attach to
containers that are launched without a CommandInfo.

Review: https://reviews.apache.org/r/53450


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4a91d60d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4a91d60d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4a91d60d

Branch: refs/heads/master
Commit: 4a91d60db937e8ce8351310a9c84aa88925d1094
Parents: 19a352a
Author: Vinod Kone <vi...@gmail.com>
Authored: Thu Nov 3 14:16:15 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Nov 4 16:17:34 2016 -0700

----------------------------------------------------------------------
 include/mesos/mesos.proto    | 17 +++++++++++++++++
 include/mesos/v1/mesos.proto | 17 +++++++++++++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4a91d60d/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 905a34b..2e781ff 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -2109,6 +2109,20 @@ message RLimitInfo {
 
 
 /**
+ * Describes the information about (pseudo) TTY that can
+ * be attached to a process running in a container.
+ */
+message TTYInfo {
+  message WindowSize {
+    required uint32 rows = 1;
+    required uint32 columns = 2;
+  }
+
+  optional WindowSize window_size = 1;
+}
+
+
+/**
  * Describes a container configuration and allows extensible
  * configurations for different container implementations.
  */
@@ -2181,6 +2195,9 @@ message ContainerInfo {
 
   // (POSIX only) rlimits of the container.
   optional RLimitInfo rlimit_info = 9;
+
+  // If specified a tty will be attached to the container entrypoint.
+  optional TTYInfo tty_info = 10;
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/4a91d60d/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index b72069a..6eea669 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -2108,6 +2108,20 @@ message RLimitInfo {
 
 
 /**
+ * Describes the information about (pseudo) TTY that can
+ * be attached to a process running in a container.
+ */
+message TTYInfo {
+  message WindowSize {
+    required uint32 rows = 1;
+    required uint32 columns = 2;
+  }
+
+  optional WindowSize window_size = 1;
+}
+
+
+/**
  * Describes a container configuration and allows extensible
  * configurations for different container implementations.
  */
@@ -2180,6 +2194,9 @@ message ContainerInfo {
 
   // (POSIX only) rlimits of the container.
   optional RLimitInfo rlimit_info = 9;
+
+  // If specified a tty will be attached to the container entrypoint.
+  optional TTYInfo tty_info = 10;
 }