You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ne...@apache.org on 2017/07/11 18:03:44 UTC
[3/8] mesos git commit: Added master and agent flags to specify
domain.
Added master and agent flags to specify domain.
Added master and agent flags to specify domain.
Review: https://reviews.apache.org/r/59761/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5b99d394
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5b99d394
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5b99d394
Branch: refs/heads/master
Commit: 5b99d39472b5b5d974b7f40c6ae47753ac86d89c
Parents: 4189a45
Author: Neil Conway <ne...@gmail.com>
Authored: Tue Jul 11 10:43:20 2017 -0700
Committer: Neil Conway <ne...@gmail.com>
Committed: Tue Jul 11 10:43:20 2017 -0700
----------------------------------------------------------------------
docs/configuration.md | 30 ++++++++++++++++++++++++++++++
src/common/parse.hpp | 12 ++++++++++++
src/master/flags.cpp | 36 ++++++++++++++++++++++++++++++++++++
src/master/flags.hpp | 1 +
src/slave/flags.cpp | 37 +++++++++++++++++++++++++++++++++++++
src/slave/flags.hpp | 1 +
6 files changed, 117 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/5b99d394/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index 007d0f5..f39d220 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -112,6 +112,36 @@ Example:
</tr>
<tr>
<td>
+ --domain=VALUE
+ </td>
+ <td>
+Domain that the master or agent belongs to. Mesos currently only supports
+fault domains, which identify groups of hosts with similar failure
+characteristics. A fault domain consists of a region and a zone. All masters
+in the same Mesos cluster must be in the same region (they can be in
+different zones). Agents configured to use a different region than the
+master's region will not appear in resource offers to frameworks that have
+not enabled the <code>REGION_AWARE</code> capability. This value can be
+specified as either a JSON-formatted string or a file path containing JSON.
+<p/>
+Example:
+<pre><code>{
+ "fault_domain":
+ {
+ "region":
+ {
+ "name": "aws-us-east-1"
+ },
+ "zone":
+ {
+ "name": "aws-us-east-1a"
+ }
+ }
+}</code></pre>
+ </td>
+</tr>
+<tr>
+ <td>
--[no-]help
</td>
<td>
http://git-wip-us.apache.org/repos/asf/mesos/blob/5b99d394/src/common/parse.hpp
----------------------------------------------------------------------
diff --git a/src/common/parse.hpp b/src/common/parse.hpp
index 64eabf8..212d640 100644
--- a/src/common/parse.hpp
+++ b/src/common/parse.hpp
@@ -214,6 +214,18 @@ inline Try<mesos::RLimitInfo> parse(const std::string& value)
template <>
+inline Try<mesos::DomainInfo> parse(const std::string& value)
+{
+ Try<JSON::Object> json = parse<JSON::Object>(value);
+ if (json.isError()) {
+ return Error(json.error());
+ }
+
+ return protobuf::parse<mesos::DomainInfo>(json.get());
+}
+
+
+template <>
inline Try<mesos::FrameworkID> parse(const std::string& value)
{
mesos::FrameworkID frameworkId;
http://git-wip-us.apache.org/repos/asf/mesos/blob/5b99d394/src/master/flags.cpp
----------------------------------------------------------------------
diff --git a/src/master/flags.cpp b/src/master/flags.cpp
index ca5f02c..fa6d274 100644
--- a/src/master/flags.cpp
+++ b/src/master/flags.cpp
@@ -641,4 +641,40 @@ mesos::internal::master::Flags::Flags()
"Optional IP discovery binary: if set, it is expected to emit\n"
"the IP address which the master will try to bind to.\n"
"Cannot be used in conjunction with `--ip`.");
+
+ add(&Flags::domain,
+ "domain",
+ "Domain that the master belongs to. Mesos currently only supports\n"
+ "fault domains, which identify groups of hosts with similar failure\n"
+ "characteristics. A fault domain consists of a region and a zone.\n"
+ "All masters in the same Mesos cluster must be in the same region\n"
+ "(they can be in different zones). This value can be specified as\n"
+ "either a JSON-formatted string or a file path containing JSON.\n"
+ "\n"
+ "Example:\n"
+ "{\n"
+ " \"fault_domain\":\n"
+ " {\n"
+ " \"region\":\n"
+ " {\n"
+ " \"name\": \"aws-us-east-1\"\n"
+ " },\n"
+ " \"zone\":\n"
+ " {\n"
+ " \"name\": \"aws-us-east-1a\"\n"
+ " }\n"
+ " }\n"
+ "}",
+ [](const Option<DomainInfo>& domain) -> Option<Error> {
+ if (domain.isSome()) {
+ // Don't let the user specify a domain without a fault
+ // domain. This is allowed by the protobuf spec (for forward
+ // compatibility with possible future changes), but is not a
+ // useful configuration right now.
+ if (!domain->has_fault_domain()) {
+ return Error("`domain` must define `fault_domain`");
+ }
+ }
+ return None();
+ });
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/5b99d394/src/master/flags.hpp
----------------------------------------------------------------------
diff --git a/src/master/flags.hpp b/src/master/flags.hpp
index 8a9bd2d..edda71a 100644
--- a/src/master/flags.hpp
+++ b/src/master/flags.hpp
@@ -96,6 +96,7 @@ public:
Duration registry_gc_interval;
Duration registry_max_agent_age;
size_t registry_max_agent_count;
+ Option<DomainInfo> domain;
// The following flags are executable specific (e.g., since we only
// have one instance of libprocess per execution, we only want to
http://git-wip-us.apache.org/repos/asf/mesos/blob/5b99d394/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 74df647..a4c1a0c 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -1134,4 +1134,41 @@ mesos::internal::slave::Flags::Flags()
"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");
+
+ add(&Flags::domain,
+ "domain",
+ "Domain that the agent belongs to. Mesos currently only supports\n"
+ "fault domains, which identify groups of hosts with similar failure\n"
+ "characteristics. A fault domain consists of a region and a zone.\n"
+ "If this agent is placed in a different region than the master, it\n"
+ "will not appear in resource offers to frameworks that have not\n"
+ "enabled the REGION_AWARE capability. This value can be specified\n"
+ "as either a JSON-formatted string or a file path containing JSON.\n"
+ "\n"
+ "Example:\n"
+ "{\n"
+ " \"fault_domain\":\n"
+ " {\n"
+ " \"region\":\n"
+ " {\n"
+ " \"name\": \"aws-us-east-1\"\n"
+ " },\n"
+ " \"zone\":\n"
+ " {\n"
+ " \"name\": \"aws-us-east-1a\"\n"
+ " }\n"
+ " }\n"
+ "}",
+ [](const Option<DomainInfo>& domain) -> Option<Error> {
+ if (domain.isSome()) {
+ // Don't let the user specify a domain without a fault
+ // domain. This is allowed by the protobuf spec (for forward
+ // compatibility with possible future changes), but is not a
+ // useful configuration right now.
+ if (!domain->has_fault_domain()) {
+ return Error("`domain` must define `fault_domain`");
+ }
+ }
+ return None();
+ });
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/5b99d394/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index 858876f..bf9adf0 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -168,6 +168,7 @@ public:
std::string xfs_project_range;
#endif
bool http_command_executor;
+ Option<DomainInfo> domain;
// The following flags are executable specific (e.g., since we only
// have one instance of libprocess per execution, we only want to