Added 2 master flags --advertise_ip and --advertise_port.

If set, these IP/Port shall be advertised by libprocess (although bind
is not done on this IP/Port). If not set, libprocess advertises the
IP/Port on which bind was done.

Command line arguments added:
advertise_ip: IP address advertised to reach mesos master.
advertise_port: Port advertised to reach mesos master (used with
                advertise_ip).

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


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

Branch: refs/heads/master
Commit: adecbfa6a216815bd7dc7d26e721c4c87e465c30
Parents: 13e982e
Author: Anindya Sinha <[email protected]>
Authored: Thu Aug 13 10:15:22 2015 -0700
Committer: Vinod Kone <[email protected]>
Committed: Thu Aug 13 10:15:22 2015 -0700

----------------------------------------------------------------------
 docs/configuration.md     | 19 +++++++++++++++++++
 docs/operational-guide.md |  3 +++
 src/master/http.cpp       |  3 ++-
 src/master/main.cpp       | 22 ++++++++++++++++++++++
 4 files changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/adecbfa6/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index 506bab1..5143811 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -171,6 +171,25 @@ If you have special compilation requirements, please refer 
to `./configure --hel
         Explanation
       </th>
   </thead>
+   <tr>
+     <td>
+      --advertise_ip=VALUE
+    </td>
+    <td>
+      IP address advertised to reach mesos master. Mesos master does not bind 
using this
+      IP address. However, this IP address may be used to access Mesos master.
+    </td>
+  </tr>
+  <tr>
+    <td>
+      --advertise_port=VALUE
+    </td>
+    <td>
+      Port advertised to reach mesos master (alongwith advertise_ip). Mesos 
master does not
+      bind using this port. However, this port (alongwith advertise_ip) may be 
used to
+      access Mesos master.
+    </td>
+  </tr>
   <tr>
     <td>
       --quorum=VALUE

http://git-wip-us.apache.org/repos/asf/mesos/blob/adecbfa6/docs/operational-guide.md
----------------------------------------------------------------------
diff --git a/docs/operational-guide.md b/docs/operational-guide.md
index ef81db6..cadf573 100644
--- a/docs/operational-guide.md
+++ b/docs/operational-guide.md
@@ -51,3 +51,6 @@ To decrease the quorum by N, repeat this process to decrement 
the quorum size N
 
 ### Replacing a master
 Please see the NOTE section above. So long as the failed master is guaranteed 
to not re-join the ensemble, it is safe to start a new master _with an empty 
log_ and allow it to catch up.
+
+## External access for mesos master
+If the default ip (or the command line arg `--ip`) points to an internal IP, 
then external entities such as framework scheduler would not be able to reach 
the master. To address that scenario, an externally accessible IP:port can be 
setup via the `--advertise_ip` and `--advertise_port` command line arguments of 
mesos master. If configured, external entities such as framework scheduler 
interact with the advertise_ip:advertise_port from where the request needs to 
be proxied to the internal IP:Port on which mesos master is listening.

http://git-wip-us.apache.org/repos/asf/mesos/blob/adecbfa6/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 579c009..a359e74 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -582,7 +582,8 @@ const string Master::Http::REDIRECT_HELP = HELP(
         "1. This is the recommended way to bookmark the WebUI when",
         "running multiple Masters.",
         "2. This is broken currently \"on the cloud\" (e.g. EC2) as",
-        "this will attempt to redirect to the private IP address."));
+        "this will attempt to redirect to the private IP address, unless",
+        "advertise_ip points to an externally accessible IP"));
 
 
 Future<Response> Master::Http::redirect(const Request& request) const

http://git-wip-us.apache.org/repos/asf/mesos/blob/adecbfa6/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index e05a472..7d7387c 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -125,6 +125,20 @@ int main(int argc, char** argv)
   uint16_t port;
   flags.add(&port, "port", "Port to listen on", MasterInfo().port());
 
+  Option<string> advertise_ip;
+  flags.add(&advertise_ip,
+            "advertise_ip",
+            "IP address advertised to reach mesos master.\n"
+            "Mesos master does not bind using this IP address.\n"
+            "However, this IP address may be used to access Mesos master.");
+
+  Option<string> advertise_port;
+  flags.add(&advertise_port,
+            "advertise_port",
+            "Port advertised to reach mesos master (alongwith advertise_ip).\n"
+            "Mesos master does not bind using this port.\n"
+            "However, this port (alongwith advertise_ip) may be used to access 
Mesos master.");
+
   Option<string> zk;
   flags.add(&zk,
             "zk",
@@ -219,6 +233,14 @@ int main(int argc, char** argv)
 
   os::setenv("LIBPROCESS_PORT", stringify(port));
 
+  if (advertise_ip.isSome()) {
+    os::setenv("LIBPROCESS_ADVERTISE_IP", advertise_ip.get());
+  }
+
+  if (advertise_port.isSome()) {
+    os::setenv("LIBPROCESS_ADVERTISE_PORT", advertise_port.get());
+  }
+
   // Initialize libprocess.
   process::initialize("master");
 

Reply via email to