You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2020/03/03 14:38:50 UTC
[mesos] 01/02: Added the 'TASK_RESOURCE_LIMITS' agent capability.
This is an automated email from the ASF dual-hosted git repository.
grag pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit f445e3aea44b4060292fa5e029dbb2c19e219c25
Author: Greg Mann <gr...@mesosphere.io>
AuthorDate: Tue Mar 3 06:03:57 2020 -0800
Added the 'TASK_RESOURCE_LIMITS' agent capability.
This capability will be used by the master to detect whether
or not an agent can handle task resource limits.
Review: https://reviews.apache.org/r/71991/
---
docs/configuration/agent.md | 5 +++--
docs/upgrades.md | 5 +++++
include/mesos/mesos.proto | 4 ++++
include/mesos/v1/mesos.proto | 4 ++++
src/common/protobuf_utils.cpp | 3 ++-
src/common/protobuf_utils.hpp | 7 +++++++
src/slave/constants.cpp | 1 +
src/slave/flags.cpp | 12 ++++++++----
src/tests/master_tests.cpp | 3 ++-
src/tests/slave_tests.cpp | 3 ++-
10 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/docs/configuration/agent.md b/docs/configuration/agent.md
index 0e703d8..1498df4 100644
--- a/docs/configuration/agent.md
+++ b/docs/configuration/agent.md
@@ -93,7 +93,7 @@ Example:
<td>
JSON representation of agent features to whitelist. We always require
'MULTI_ROLE', 'HIERARCHICAL_ROLE', 'RESERVATION_REFINEMENT',
-'AGENT_OPERATION_FEEDBACK', and 'AGENT_DRAINING'.
+'AGENT_OPERATION_FEEDBACK', 'AGENT_DRAINING', and 'TASK_RESOURCE_LIMITS'.
<p/>
Example:
<pre><code>
@@ -103,7 +103,8 @@ Example:
{"type": "HIERARCHICAL_ROLE"},
{"type": "RESERVATION_REFINEMENT"},
{"type": "AGENT_OPERATION_FEEDBACK"},
- {"type": "AGENT_DRAINING"}
+ {"type": "AGENT_DRAINING"},
+ {"type": "TASK_RESOURCE_LIMITS"}
]
}
</pre></code>
diff --git a/docs/upgrades.md b/docs/upgrades.md
index afd9dbb..1e73e3d 100644
--- a/docs/upgrades.md
+++ b/docs/upgrades.md
@@ -54,6 +54,7 @@ We categorize the changes as follows:
<td style="word-wrap: break-word; overflow-wrap: break-word;"><!--Flags-->
<ul style="padding-left:10px;">
+ <li>C <a href="#1-10-x-agent-features">agent_features</a></li>
</ul>
</td>
@@ -558,6 +559,10 @@ We categorize the changes as follows:
The canonical name for the environment variable `LIBPROCESS_SSL_REQUIRE_CERT` was changed to `LIBPROCESS_SSL_REQUIRE_CLIENT_CERT`.
The old names will continue to work as before, but operators are encouraged to update their configuration to reduce confusion.
+<a name="1-10-x-agent-features"></a>
+
+* The Mesos agent now requires the new `TASK_RESOURCE_LIMITS` feature. This capability is set by default, but if the `--agent_features` flag is specified explicitly, `TASK_RESOURCE_LIMITS` must be included.
+
## Upgrading from 1.8.x to 1.9.x ##
<a name="1-9-x-automatic-agent-draining"></a>
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index d0aed5a..40c45de 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -1050,6 +1050,10 @@ message SlaveInfo {
// This expresses the ability for the agent to automatically drain tasks
// in preparation for operator maintenance. This capability is required.
AGENT_DRAINING = 7;
+
+ // This expresses the ability for the agent to launch tasks which specify
+ // resource limits for CPU and/or memory.
+ TASK_RESOURCE_LIMITS = 8;
}
// Enum fields should be optional, see: MESOS-4997.
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 06c4816..6387636 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -1038,6 +1038,10 @@ message AgentInfo {
// This expresses the ability for the agent to automatically drain tasks
// in preparation for operator maintenance. This capability is required.
AGENT_DRAINING = 7;
+
+ // This expresses the ability for the agent to launch tasks which specify
+ // resource limits for CPU and/or memory.
+ TASK_RESOURCE_LIMITS = 8;
}
// Enum fields should be optional, see: MESOS-4997.
diff --git a/src/common/protobuf_utils.cpp b/src/common/protobuf_utils.cpp
index 7fe4a44..b3057be 100644
--- a/src/common/protobuf_utils.cpp
+++ b/src/common/protobuf_utils.cpp
@@ -1140,7 +1140,8 @@ bool operator==(const Capabilities& left, const Capabilities& right)
left.resourceProvider == right.resourceProvider &&
left.resizeVolume == right.resizeVolume &&
left.agentOperationFeedback == right.agentOperationFeedback &&
- left.agentDraining == right.agentDraining;
+ left.agentDraining == right.agentDraining &&
+ left.taskResourceLimits == right.taskResourceLimits;
}
diff --git a/src/common/protobuf_utils.hpp b/src/common/protobuf_utils.hpp
index 3852f59..0558249 100644
--- a/src/common/protobuf_utils.hpp
+++ b/src/common/protobuf_utils.hpp
@@ -361,6 +361,9 @@ struct Capabilities
case SlaveInfo::Capability::AGENT_DRAINING:
agentDraining = true;
break;
+ case SlaveInfo::Capability::TASK_RESOURCE_LIMITS:
+ taskResourceLimits = true;
+ break;
// If adding another case here be sure to update the
// equality operator.
}
@@ -375,6 +378,7 @@ struct Capabilities
bool resizeVolume = false;
bool agentOperationFeedback = false;
bool agentDraining = false;
+ bool taskResourceLimits = false;
google::protobuf::RepeatedPtrField<SlaveInfo::Capability>
toRepeatedPtrField() const
@@ -401,6 +405,9 @@ struct Capabilities
if (agentDraining) {
result.Add()->set_type(SlaveInfo::Capability::AGENT_DRAINING);
}
+ if (taskResourceLimits) {
+ result.Add()->set_type(SlaveInfo::Capability::TASK_RESOURCE_LIMITS);
+ }
return result;
}
diff --git a/src/slave/constants.cpp b/src/slave/constants.cpp
index 1963890..319729e 100644
--- a/src/slave/constants.cpp
+++ b/src/slave/constants.cpp
@@ -43,6 +43,7 @@ vector<SlaveInfo::Capability> AGENT_CAPABILITIES()
SlaveInfo::Capability::RESIZE_VOLUME,
SlaveInfo::Capability::AGENT_OPERATION_FEEDBACK,
SlaveInfo::Capability::AGENT_DRAINING,
+ SlaveInfo::Capability::TASK_RESOURCE_LIMITS,
};
vector<SlaveInfo::Capability> result;
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 0f159a3..5966436 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -812,7 +812,8 @@ mesos::internal::slave::Flags::Flags()
"agent_features",
"JSON representation of agent features to whitelist. We always require\n"
"'MULTI_ROLE', 'HIERARCHICAL_ROLE', 'RESERVATION_REFINEMENT',\n"
- "'AGENT_OPERATION_FEEDBACK', and 'AGENT_DRAINING'.\n"
+ "'AGENT_OPERATION_FEEDBACK', 'AGENT_DRAINING', and\n"
+ "'TASK_RESOURCE_LIMITS'.\n"
"\n"
"Example:\n"
"{\n"
@@ -821,7 +822,8 @@ mesos::internal::slave::Flags::Flags()
" {\"type\": \"HIERARCHICAL_ROLE\"},\n"
" {\"type\": \"RESERVATION_REFINEMENT\"},\n"
" {\"type\": \"AGENT_OPERATION_FEEDBACK\"},\n"
- " {\"type\": \"AGENT_DRAINING\"}\n"
+ " {\"type\": \"AGENT_DRAINING\"},\n"
+ " {\"type\": \"TASK_RESOURCE_LIMITS\"}\n"
" ]\n"
"}\n",
[](const Option<SlaveCapabilities>& agentFeatures) -> Option<Error> {
@@ -834,11 +836,13 @@ mesos::internal::slave::Flags::Flags()
!capabilities.hierarchicalRole ||
!capabilities.reservationRefinement ||
!capabilities.agentOperationFeedback ||
- !capabilities.agentDraining) {
+ !capabilities.agentDraining ||
+ !capabilities.taskResourceLimits) {
return Error(
"At least the following agent features need to be enabled:"
" MULTI_ROLE, HIERARCHICAL_ROLE, RESERVATION_REFINEMENT,"
- " AGENT_OPERATION_FEEDBACK, and AGENT_DRAINING");
+ " AGENT_OPERATION_FEEDBACK, AGENT_DRAINING, and"
+ " TASK_RESOURCE_LIMITS");
}
if (capabilities.resizeVolume && !capabilities.resourceProvider) {
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index c47d4c3..d0f53b2 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -5319,7 +5319,8 @@ TEST_F(MasterTest, StateEndpointAgentCapabilities)
"RESOURCE_PROVIDER",
"RESIZE_VOLUME",
"AGENT_OPERATION_FEEDBACK",
- "AGENT_DRAINING"
+ "AGENT_DRAINING",
+ "TASK_RESOURCE_LIMITS"
]
)~");
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index fd4fd6b..92fa299 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -1556,7 +1556,8 @@ TEST_F(SlaveTest, StateEndpoint)
"RESOURCE_PROVIDER",
"RESIZE_VOLUME",
"AGENT_OPERATION_FEEDBACK",
- "AGENT_DRAINING"
+ "AGENT_DRAINING",
+ "TASK_RESOURCE_LIMITS"
]
)~");