You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by me...@apache.org on 2016/01/03 11:29:01 UTC

[1/3] mesos git commit: Added repeated vip to DiscoveryInfo and instance_port to Port.

Repository: mesos
Updated Branches:
  refs/heads/master f05eb74b9 -> 5b145adea


Added repeated vip to DiscoveryInfo and instance_port to Port.

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


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

Branch: refs/heads/master
Commit: b87e42a2b141722f4048b999bea18d5b7b2b8a47
Parents: f05eb74
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Sun Jan 3 01:10:28 2016 -0800
Committer: Adam B <ad...@mesosphere.io>
Committed: Sun Jan 3 01:10:28 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/b87e42a2/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 2431fdd..72166ef 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -1554,6 +1554,11 @@ message Port {
   // This can be used to decorate the message with metadata to be
   // interpreted by external applications such as firewalls.
   optional Labels labels = 5;
+  // This field represents the backend port on which the task is
+  // running. It could potentially be different than the `number` field (1), for
+  // instance, when an agent achieves network isolation between containers using
+  // port (layer 4) segregation.
+  optional uint32 instance_port = 6;
 }
 
 
@@ -1566,6 +1571,25 @@ message Ports {
 
 
 /**
+ * An IP address.
+ */
+message IPAddress {
+  // TODO (asridharan): We are setting the positional identifier of this
+  // field to 2, in order to maintain backward compatibility with the `IPAddress`
+  // message definition within `NetworkInfo`. See MESOS-4243 for more details.
+  optional string ip_address = 2;
+}
+
+
+/**
+ * Holds information about a virtual IP.
+ */
+message VIPInfo {
+  required IPAddress vip = 1;
+}
+
+
+/**
 * Service discovery information.
 * The visibility field restricts discovery within a framework (FRAMEWORK),
 * within a Mesos cluster (CLUSTER), or places no restrictions (EXTERNAL).
@@ -1593,6 +1617,11 @@ message DiscoveryInfo {
   optional string version = 5;
   optional Ports ports = 6;
   optional Labels labels = 7;
+  // The virtual IP is used as a single endpoint to represent multiple instances
+  // of a given service. An application might need multiple virtual IPs if it
+  // exposes multiple services, or if the same service is exposed on different
+  // virtual IPs.
+  repeated VIPInfo vips = 8;
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/b87e42a2/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 4aed098..a287683 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -1553,6 +1553,11 @@ message Port {
   // This can be used to decorate the message with metadata to be
   // interpreted by external applications such as firewalls.
   optional Labels labels = 5;
+  // This field represents the backend port on which the task is
+  // running. It could potentially be different than the `number` field (1), for
+  // instance, when an agent achieves network isolation between containers using
+  // port (layer 4) segregation.
+  optional uint32 instance_port = 6;
 }
 
 
@@ -1565,6 +1570,25 @@ message Ports {
 
 
 /**
+ * An IP address.
+ */
+message IPAddress {
+  // TODO (asridharan): We are setting the positional identifier of this
+  // field to 2, in order to maintain backward compatibility with the `IPAddress`
+  // message definition within `NetworkInfo`. See MESOS-4243 for more details.
+  optional string ip_address = 2;
+}
+
+
+/**
+ * Holds information about a virtual IP.
+ */
+message VIPInfo {
+  required IPAddress vip = 1;
+}
+
+
+/**
 * Service discovery information.
 * The visibility field restricts discovery within a framework (FRAMEWORK),
 * within a Mesos cluster (CLUSTER), or places no restrictions (EXTERNAL).
@@ -1592,4 +1616,9 @@ message DiscoveryInfo {
   optional string version = 5;
   optional Ports ports = 6;
   optional Labels labels = 7;
+  // The virtual IP is used as a single endpoint to represent multiple instances
+  // of a given service. An application might need multiple virtual IPs if it
+  // exposes multiple services, or if the same service is exposed on different
+  // virtual IPs.
+  repeated VIPInfo vips = 8;
 }


[2/3] mesos git commit: Cleaned up VIP comments.

Posted by me...@apache.org.
Cleaned up VIP comments.


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

Branch: refs/heads/master
Commit: 8f4688c660f851375bae8e2cd92e1c4b62751655
Parents: b87e42a
Author: Adam B <ad...@mesosphere.io>
Authored: Sun Jan 3 01:38:02 2016 -0800
Committer: Adam B <ad...@mesosphere.io>
Committed: Sun Jan 3 01:50:15 2016 -0800

----------------------------------------------------------------------
 include/mesos/mesos.proto    | 13 ++++++-------
 include/mesos/v1/mesos.proto | 13 ++++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8f4688c6/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 72166ef..158e087 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -1554,10 +1554,9 @@ message Port {
   // This can be used to decorate the message with metadata to be
   // interpreted by external applications such as firewalls.
   optional Labels labels = 5;
-  // This field represents the backend port on which the task is
-  // running. It could potentially be different than the `number` field (1), for
-  // instance, when an agent achieves network isolation between containers using
-  // port (layer 4) segregation.
+  // The backend port on which the task is running. This could be different than
+  // the `number` field (1), e.g. when an agent achieves network isolation
+  // between containers using port (layer 4) segregation.
   optional uint32 instance_port = 6;
 }
 
@@ -1574,9 +1573,9 @@ message Ports {
  * An IP address.
  */
 message IPAddress {
-  // TODO (asridharan): We are setting the positional identifier of this
-  // field to 2, in order to maintain backward compatibility with the `IPAddress`
-  // message definition within `NetworkInfo`. See MESOS-4243 for more details.
+  // TODO(asridharan): We skip tag number 1 in case we later want to be binary
+  // compatible with `NetworkInfo.IPAddress`. See MESOS-4243 for more details.
+  // optional Protocol protocol = 1;
   optional string ip_address = 2;
 }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f4688c6/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index a287683..c6c5a81 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -1553,10 +1553,9 @@ message Port {
   // This can be used to decorate the message with metadata to be
   // interpreted by external applications such as firewalls.
   optional Labels labels = 5;
-  // This field represents the backend port on which the task is
-  // running. It could potentially be different than the `number` field (1), for
-  // instance, when an agent achieves network isolation between containers using
-  // port (layer 4) segregation.
+  // The backend port on which the task is running. This could be different than
+  // the `number` field (1), e.g. when an agent achieves network isolation
+  // between containers using port (layer 4) segregation.
   optional uint32 instance_port = 6;
 }
 
@@ -1573,9 +1572,9 @@ message Ports {
  * An IP address.
  */
 message IPAddress {
-  // TODO (asridharan): We are setting the positional identifier of this
-  // field to 2, in order to maintain backward compatibility with the `IPAddress`
-  // message definition within `NetworkInfo`. See MESOS-4243 for more details.
+  // TODO(asridharan): We skip tag number 1 in case we later want to be binary
+  // compatible with `NetworkInfo.IPAddress`. See MESOS-4243 for more details.
+  // optional Protocol protocol = 1;
   optional string ip_address = 2;
 }
 


[3/3] mesos git commit: Added unit tests for new vip and instance_port fields.

Posted by me...@apache.org.
Added unit tests for new vip and instance_port fields.

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


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

Branch: refs/heads/master
Commit: 5b145adea3b3ecabf5cb99217f2564ce228be0a0
Parents: 8f4688c
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Sun Jan 3 01:46:17 2016 -0800
Committer: Adam B <ad...@mesosphere.io>
Committed: Sun Jan 3 01:50:23 2016 -0800

----------------------------------------------------------------------
 src/tests/common/http_tests.cpp | 25 ++++++++++++++++++++++++-
 src/tests/slave_tests.cpp       | 28 +++++++++++++++++++++-------
 2 files changed, 45 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5b145ade/src/tests/common/http_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/common/http_tests.cpp b/src/tests/common/http_tests.cpp
index 0ea0634..69dac17 100644
--- a/src/tests/common/http_tests.cpp
+++ b/src/tests/common/http_tests.cpp
@@ -76,6 +76,7 @@ TEST(HTTPTest, ModelTask)
   Ports ports;
   Port* port = ports.add_ports();
   port->set_number(80);
+  port->set_instance_port(8081);
   port->mutable_labels()->CopyFrom(labels);
 
   DiscoveryInfo discovery;
@@ -83,6 +84,12 @@ TEST(HTTPTest, ModelTask)
   discovery.set_name("discover");
   discovery.mutable_ports()->CopyFrom(ports);
 
+  IPAddress* vip1 = discovery.add_vips()->mutable_vip();
+  vip1->set_ip_address("10.0.0.1");
+
+  IPAddress* vip2 = discovery.add_vips()->mutable_vip();
+  vip2->set_ip_address("10.0.0.2");
+
   TaskInfo task;
   task.set_name("task");
   task.mutable_task_id()->CopyFrom(taskId);
@@ -135,10 +142,26 @@ TEST(HTTPTest, ModelTask)
       "              \"value\":\"port:7987 DENY\""
       "             }"
       "           ]"
-      "         }"
+      "         },"
+      "         \"instance_port\":8081"
       "       }"
       "     ]"
       "   },"
+      "   \"vips\":"
+      "    ["
+      "      {"
+      "        \"vip\" :"
+      "         {"
+      "           \"ip_address\":\"10.0.0.1\""
+      "         }"
+      "      },"
+      "      {"
+      "        \"vip\" :"
+      "         { "
+      "           \"ip_address\":\"10.0.0.2\""
+      "         }"
+      "      }"
+      "    ],"
       "   \"visibility\":\"CLUSTER\""
       " }"
       "}");

http://git-wip-us.apache.org/repos/asf/mesos/blob/5b145ade/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 328c853..77750ed 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -2189,16 +2189,25 @@ TEST_F(SlaveTest, DiscoveryInfoAndPorts)
   Port* port1 = ports.add_ports();
   port1->set_number(80);
   port1->mutable_labels()->CopyFrom(labels1);
+  port1->set_instance_port(2222);
 
   Port* port2 = ports.add_ports();
   port2->set_number(8081);
   port2->mutable_labels()->CopyFrom(labels2);
+  port2->set_instance_port(2223);
+
 
   DiscoveryInfo discovery;
   discovery.set_name("test_discovery");
   discovery.set_visibility(DiscoveryInfo::CLUSTER);
   discovery.mutable_ports()->CopyFrom(ports);
 
+  IPAddress* vip1 = discovery.add_vips()->mutable_vip();
+  vip1->set_ip_address("10.0.0.1");
+
+  IPAddress* vip2 = discovery.add_vips()->mutable_vip();
+  vip2->set_ip_address("10.0.0.2");
+
   task.mutable_discovery()->CopyFrom(discovery);
 
   EXPECT_CALL(exec, registered(_, _, _, _));
@@ -2228,18 +2237,23 @@ TEST_F(SlaveTest, DiscoveryInfoAndPorts)
   JSON::Object discoveryObject = discoveryResult.get();
   EXPECT_EQ(JSON::Object(JSON::protobuf(discovery)), discoveryObject);
 
-  // Check the ports are set in the `DiscoveryInfo` object.
+  // Verify that the VIPs retrieved from state.json are the ones that were set.
+  Result<JSON::Object> vipResult1 = parse.get().find<JSON::Object>(
+      "frameworks[0].executors[0].tasks[0].discovery.vips[0]");
+  Result<JSON::Object> vipResult2 = parse.get().find<JSON::Object>(
+      "frameworks[0].executors[0].tasks[0].discovery.vips[1]");
+
+  EXPECT_SOME_EQ(JSON::Object(JSON::protobuf(discovery.vips(0))), vipResult1);
+  EXPECT_SOME_EQ(JSON::Object(JSON::protobuf(discovery.vips(1))), vipResult2);
+
+  // Verify that the ports retrieved from state.json are the ones that were set.
   Result<JSON::Object> portResult1 = parse.get().find<JSON::Object>(
       "frameworks[0].executors[0].tasks[0].discovery.ports.ports[0]");
   Result<JSON::Object> portResult2 = parse.get().find<JSON::Object>(
       "frameworks[0].executors[0].tasks[0].discovery.ports.ports[1]");
 
-  EXPECT_SOME(portResult1);
-  EXPECT_SOME(portResult2);
-
-  // Verify that the ports retrieved from state.json are the ones that were set.
-  EXPECT_EQ(JSON::Object(JSON::protobuf(*port1)), portResult1.get());
-  EXPECT_EQ(JSON::Object(JSON::protobuf(*port2)), portResult2.get());
+  EXPECT_SOME_EQ(JSON::Object(JSON::protobuf(*port1)), portResult1);
+  EXPECT_SOME_EQ(JSON::Object(JSON::protobuf(*port2)), portResult2);
 
   EXPECT_CALL(exec, shutdown(_))
     .Times(AtMost(1));