This is an automated email from the ASF dual-hosted git repository. josephwu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit fa087b2024e9c20558353fd16cb540d3485f7090 Author: Joseph Wu <[email protected]> AuthorDate: Fri Jun 21 07:11:49 2019 -0700 Added master minimum capability for agent draining. This adds a new enum for the agent draining feature in the master. When an agent is marked for draining or deactivation, an associated entry will be added to the master's registry. This will prevent any master downgrades until all agents are reactivated. Review: https://reviews.apache.org/r/70922 --- docs/downgrades.md | 35 ++++++++++++++++++++++++++++++++++- include/mesos/mesos.proto | 4 ++++ include/mesos/v1/mesos.proto | 4 ++++ src/common/protobuf_utils.hpp | 4 ++++ src/master/constants.cpp | 1 + src/tests/master_tests.cpp | 5 +++-- 6 files changed, 50 insertions(+), 3 deletions(-) diff --git a/docs/downgrades.md b/docs/downgrades.md index 0820001..3807254 100644 --- a/docs/downgrades.md +++ b/docs/downgrades.md @@ -20,4 +20,37 @@ these minimum capabilities and remediation for downgrade errors. ## List of Master Minimum Capabilities -Currently, no minimum capabilities will block downgrades. +<table class="table table-striped"> +<thead> +<tr><th>Capability</th><th>Description</th> +</thead> + +<tr> + <td> + <code>AGENT_DRAINING</code> + </td> + <td> + This capability is required when any agent is marked for draining + or deactivated. These states were added in Mesos 1.9 and are + triggered by using the <code>DRAIN_AGENT</code> or + <code>DEACTIVATE_AGENT</code> operator APIs. + <br/> + To remove this minimum capability requirement: + <ol> + <li> + Stop the master downgrade and return to the more recent version. + </li> + <li> + Find all agents that are marked for draining or deactivated. + This can be done by using the <code>GET_AGENTS</code> operator + API and checking the <code>deactivated</code> boolean field of + each agent. All draining agents will also be deactivated. + </li> + <li> + Use the <code>REACTIVATE_AGENT</code> operator API for each + deactivated agent. + </li> + </ol> + </td> +</tr> +</table> diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto index 2b4f350..d2750a6 100644 --- a/include/mesos/mesos.proto +++ b/include/mesos/mesos.proto @@ -920,6 +920,10 @@ message MasterInfo { // The master can handle slaves whose state // changes after reregistering. AGENT_UPDATE = 1; + + // The master can drain or deactivate agents when requested + // via operator APIs. + AGENT_DRAINING = 2; } optional Type type = 1; } diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto index bafc274..10dc29c 100644 --- a/include/mesos/v1/mesos.proto +++ b/include/mesos/v1/mesos.proto @@ -918,6 +918,10 @@ message MasterInfo { // The master can handle slaves whose state // changes after reregistering. AGENT_UPDATE = 1; + + // The master can drain or deactivate agents when requested + // via operator APIs. + AGENT_DRAINING = 2; } optional Type type = 1; } diff --git a/src/common/protobuf_utils.hpp b/src/common/protobuf_utils.hpp index ecaf8ea..f6ea923 100644 --- a/src/common/protobuf_utils.hpp +++ b/src/common/protobuf_utils.hpp @@ -489,11 +489,15 @@ struct Capabilities case MasterInfo::Capability::AGENT_UPDATE: agentUpdate = true; break; + case MasterInfo::Capability::AGENT_DRAINING: + agentDraining = true; + break; } } } bool agentUpdate = false; + bool agentDraining = false; }; namespace event { diff --git a/src/master/constants.cpp b/src/master/constants.cpp index 1109b48..13b3467 100644 --- a/src/master/constants.cpp +++ b/src/master/constants.cpp @@ -24,6 +24,7 @@ std::vector<MasterInfo::Capability> MASTER_CAPABILITIES() { MasterInfo::Capability::Type types[] = { MasterInfo::Capability::AGENT_UPDATE, + MasterInfo::Capability::AGENT_DRAINING, }; std::vector<MasterInfo::Capability> result; diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp index 791c9a0..d7b4613 100644 --- a/src/tests/master_tests.cpp +++ b/src/tests/master_tests.cpp @@ -5034,8 +5034,9 @@ TEST_F(MasterTest, StateEndpoint) JSON::Value masterCapabilities = state.values.at("capabilities"); - // Master should always have the AGENT_UPDATE capability - Try<JSON::Value> expectedCapabilities = JSON::parse("[\"AGENT_UPDATE\"]"); + // Master should always have these default capabilities. + Try<JSON::Value> expectedCapabilities = + JSON::parse("[\"AGENT_UPDATE\", \"AGENT_DRAINING\"]"); ASSERT_SOME(expectedCapabilities); EXPECT_TRUE(masterCapabilities.contains(expectedCapabilities.get()));
