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

[1/2] mesos git commit: Added IPv6 flags for Mesos agent.

Repository: mesos
Updated Branches:
  refs/heads/master 44494452c -> c90bea804


Added IPv6 flags for Mesos agent.

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


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

Branch: refs/heads/master
Commit: 9b9114741a192fdbc7b2ab2729b1a00aa200e9fc
Parents: 4449445
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Thu Jul 6 18:05:54 2017 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Thu Jul 6 18:11:30 2017 -0700

----------------------------------------------------------------------
 src/slave/flags.cpp | 29 +++++++++++++++++++++++++++++
 src/slave/flags.hpp | 14 ++++++++++++++
 2 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9b911474/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 3987686..74df647 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -1077,6 +1077,25 @@ mesos::internal::slave::Flags::Flags()
       "IP address to listen on. This cannot be used in conjunction\n"
       "with `--ip_discovery_command`.");
 
+  add(&Flags::ip6,
+      "ip6",
+      "IPv6 address to listen on. This cannot be used in conjunction\n"
+      "with '--ip6_discovery_command'.\n"
+      "\n"
+      "NOTE: Currently Mesos doesn't listen on IPv6 sockets and hence\n"
+      "this IPv6 address is only used to advertise IPv6 addresses for\n"
+      "containers running on the host network.\n",
+      [](const Option<string>& ip6) -> Option<Error> {
+        if (ip6.isSome()) {
+          LOG(WARNING) << "Currently Mesos doesn't listen on IPv6 sockets"
+                       << "and hence the IPv6 address " << ip6.get() << " "
+                       << "will only be used to advertise IPv6 addresses"
+                       << "for containers running on the host network";
+        }
+
+        return None();
+      });
+
   add(&Flags::port, "port", "Port to listen on.", SlaveInfo().port());
 
   add(&Flags::advertise_ip,
@@ -1105,4 +1124,14 @@ mesos::internal::slave::Flags::Flags()
       "Optional IP discovery binary: if set, it is expected to emit\n"
       "the IP address which the slave will try to bind to.\n"
       "Cannot be used in conjunction with `--ip`.");
+
+  add(&Flags::ip6_discovery_command,
+      "ip6_discovery_command",
+      "Optional IPv6 discovery binary: if set, it is expected to emit\n"
+      "the IPv6 address on which Mesos will try to bind when IPv6 socket\n"
+      "support is enabled in Mesos.\n"
+      "\n"
+      "NOTE: Currently Mesos doesn't listen on IPv6 sockets and hence\n"
+      "this IPv6 address is only used to advertise IPv6 addresses for\n"
+      "containers running on the host network.\n");
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/9b911474/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index c6803eb..858876f 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -182,6 +182,20 @@ public:
   // Optional IP discover script that will set the slave's IP.
   // If set, its output is expected to be a valid parseable IP string.
   Option<std::string> ip_discovery_command;
+
+  // IPv6 flags.
+  //
+  // NOTE: These IPv6 flags are currently input mechanisms
+  // for the operator to specify v6 addresses on which containers
+  // running on host network can listen. Mesos itself doesn't listen
+  // or communicate over v6 addresses at this point.
+  Option<std::string> ip6;
+
+  // Similar to the `ip_discovery_command` this optional discover
+  // script is expected to output a valid IPv6 string. Only one of the
+  // two options `ip6` or `ip6_discovery_command` can be set at any
+  // given point of time.
+  Option<std::string> ip6_discovery_command;
 };
 
 } // namespace slave {


[2/2] mesos git commit: Added initialization logic in Mesos agent for IPv6 flags.

Posted by be...@apache.org.
Added initialization logic in Mesos agent for IPv6 flags.

Operators can now set the IPv6 address for the agent using the `--ip6`
and `--ip6_discovery_command` flags. Currently, the only place the agent
will use the IPv6 address would be to advertise v6 addresses for
containers running on the host network.

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


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

Branch: refs/heads/master
Commit: c90bea80486c089e933bef64aca341e4cfaaef25
Parents: 9b91147
Author: Avinash sridharan <av...@mesosphere.io>
Authored: Thu Jul 6 18:11:47 2017 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Thu Jul 6 18:11:47 2017 -0700

----------------------------------------------------------------------
 src/slave/main.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c90bea80/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index 66ae7db..358a439 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -296,6 +296,11 @@ int main(int argc, char** argv)
         "Only one of `--ip` or `--ip_discovery_command` should be specified");
   }
 
+  if (flags.ip6_discovery_command.isSome() && flags.ip6.isSome()) {
+    EXIT(EXIT_FAILURE) << flags.usage(
+        "Only one of `--ip6` or `--ip6_discovery_command` should be specified");
+  }
+
   if (flags.ip_discovery_command.isSome()) {
     Try<string> ipAddress = os::shell(flags.ip_discovery_command.get());
 
@@ -308,6 +313,17 @@ int main(int argc, char** argv)
     os::setenv("LIBPROCESS_IP", flags.ip.get());
   }
 
+  if (flags.ip6_discovery_command.isSome()) {
+    Try<string> ip6Address = os::shell(flags.ip6_discovery_command.get());
+    if (ip6Address.isError()) {
+      EXIT(EXIT_FAILURE) << ip6Address.error();
+    }
+
+    os::setenv("LIBPROCESS_IP6", strings::trim(ip6Address.get()));
+  } else if (flags.ip6.isSome()) {
+    os::setenv("LIBPROCESS_IP6", flags.ip.get());
+  }
+
   os::setenv("LIBPROCESS_PORT", stringify(flags.port));
 
   if (flags.advertise_ip.isSome()) {