Apache Mesos
constants.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MASTER_CONSTANTS_HPP__
18 #define __MASTER_CONSTANTS_HPP__
19 
20 #include <stdint.h>
21 
22 #include <mesos/mesos.hpp>
23 
24 #include <stout/bytes.hpp>
25 #include <stout/duration.hpp>
26 #include <stout/version.hpp>
27 
28 namespace mesos {
29 namespace internal {
30 namespace master {
31 
32 // TODO(benh): Add units after constants.
33 // TODO(benh): Also make configuration options be constants.
34 
35 // TODO(vinod): Move constants that are only used in flags to
36 // 'master/flags.hpp'.
37 
38 // TODO(jieyu): Use static functions for all the constants. See more
39 // details in MESOS-1023.
40 
41 // Maximum number of slot offers to have outstanding for each framework.
42 constexpr int MAX_OFFERS_PER_FRAMEWORK = 50;
43 
44 // Minimum number of cpus per offer.
45 constexpr double MIN_CPUS = 0.01;
46 
47 // Minimum amount of memory per offer.
48 constexpr Bytes MIN_MEM = Megabytes(32);
49 
50 // Default timeout for v0 framework and agent authentication
51 // before the master cancels an in-progress authentication.
52 //
53 // TODO(bmahler): Ideally, we remove this v0-style authentication
54 // in favor of just using HTTP authentication at the libprocess
55 // layer.
57 
58 // Default interval the master uses to send heartbeats to an HTTP
59 // scheduler.
61 
62 // Amount of time within which a slave PING should be received.
63 // NOTE: The slave uses these PING constants to determine when
64 // the master has stopped sending pings. If these are made
65 // configurable, then we'll need to rely on upper/lower bounds
66 // to ensure that the slave is not unnecessarily triggering
67 // re-registrations.
69 
70 // Maximum number of ping timeouts until slave is considered failed.
71 constexpr size_t DEFAULT_MAX_AGENT_PING_TIMEOUTS = 5;
72 
73 // The minimum timeout that can be used by a newly elected leader to
74 // allow re-registration of slaves. Any slaves that do not reregister
75 // within this timeout will be marked unreachable; if/when the agent
76 // reregisters, non-partition-aware tasks running on the agent will
77 // be terminated.
79 
80 // Default limit on the percentage of slaves that will be removed
81 // after recovering if no re-registration attempts were made.
82 // TODO(bmahler): There's no value here that works for all setups.
83 // Currently the default is 100% which is favorable to those running
84 // small clusters or experimenting with Mesos. However, it's important
85 // that we also prevent the catastrophic 100% removal case for
86 // production clusters. This TODO is to provide a --production flag
87 // which would allow flag defaults that are more appropriate for
88 // production use-cases.
89 constexpr double RECOVERY_AGENT_REMOVAL_PERCENT_LIMIT = 1.0; // 100%.
90 
91 // Maximum number of removed slaves to store in the cache.
92 constexpr size_t MAX_REMOVED_SLAVES = 100000;
93 
94 // Default maximum number of completed frameworks to store in the cache.
95 constexpr size_t DEFAULT_MAX_COMPLETED_FRAMEWORKS = 50;
96 
97 // Default maximum number of completed tasks per framework
98 // to store in the cache.
100 
101 // Default maximum number of unreachable tasks per framework
102 // to store in the cache.
104 
105 // Time interval to check for updated watchers list.
107 
108 // Default number of tasks (limit) for /master/tasks endpoint.
109 constexpr size_t TASK_LIMIT = 100;
110 
112 
114 
115 constexpr size_t DEFAULT_REGISTRY_MAX_AGENT_COUNT = 100 * 1024;
116 
122 constexpr char MASTER_INFO_LABEL[] = "info";
123 
129 constexpr char MASTER_INFO_JSON_LABEL[] = "json.info";
130 
131 // Timeout used for ZooKeeper related operations.
132 // TODO(vinod): Master detector/contender should use this timeout.
134 
135 // Name of the default, CRAM-MD5 authenticator.
136 constexpr char DEFAULT_AUTHENTICATOR[] = "crammd5";
137 
138 // Name of the default hierarchical allocator.
139 constexpr char DEFAULT_ALLOCATOR[] = "hierarchical";
140 
141 // The default interval between allocations.
143 
144 // Name of the default, local authorizer.
145 constexpr char DEFAULT_AUTHORIZER[] = "local";
146 
147 // Name of the master HTTP authentication realm for read-only endpoints.
149  "mesos-master-readonly";
150 
151 // Name of the master HTTP authentication realm for read-write endpoints.
153  "mesos-master-readwrite";
154 
155 // Name of the default authentication realm for HTTP frameworks.
157  "mesos-master-scheduler";
158 
159 // Agents older than this version are not allowed to register.
161 
162 std::vector<MasterInfo::Capability> MASTER_CAPABILITIES();
163 
164 } // namespace master {
165 } // namespace internal {
166 } // namespace mesos {
167 
168 #endif // __MASTER_CONSTANTS_HPP__
Definition: master.hpp:27
constexpr Duration DEFAULT_HEARTBEAT_INTERVAL
Definition: constants.hpp:60
constexpr Bytes Megabytes(uint64_t value)
Definition: bytes.hpp:123
constexpr Duration DEFAULT_AGENT_PING_TIMEOUT
Definition: constants.hpp:68
constexpr Duration DEFAULT_AUTHENTICATION_V0_TIMEOUT
Definition: constants.hpp:56
constexpr Duration DEFAULT_REGISTRY_GC_INTERVAL
Definition: constants.hpp:111
constexpr double RECOVERY_AGENT_REMOVAL_PERCENT_LIMIT
Definition: constants.hpp:89
constexpr char MASTER_INFO_JSON_LABEL[]
Label used by the Leader Contender and Detector, for JSON content.
Definition: constants.hpp:129
constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:152
constexpr Duration ZOOKEEPER_SESSION_TIMEOUT
Definition: constants.hpp:133
Definition: duration.hpp:32
constexpr Duration DEFAULT_ALLOCATION_INTERVAL
Definition: constants.hpp:142
constexpr char READONLY_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:148
constexpr size_t TASK_LIMIT
Definition: constants.hpp:109
constexpr char DEFAULT_ALLOCATOR[]
Definition: constants.hpp:139
Definition: duration.hpp:221
Definition: duration.hpp:207
constexpr size_t DEFAULT_MAX_COMPLETED_TASKS_PER_FRAMEWORK
Definition: constants.hpp:99
Definition: spec.hpp:26
std::vector< MasterInfo::Capability > MASTER_CAPABILITIES()
constexpr char MASTER_INFO_LABEL[]
Label used by the Leader Contender and Detector.
Definition: constants.hpp:122
constexpr size_t DEFAULT_MAX_UNREACHABLE_TASKS_PER_FRAMEWORK
Definition: constants.hpp:103
Definition: attributes.hpp:24
constexpr Duration MIN_AGENT_REREGISTER_TIMEOUT
Definition: constants.hpp:78
constexpr char DEFAULT_AUTHENTICATOR[]
Definition: constants.hpp:136
Definition: version.hpp:41
constexpr size_t MAX_REMOVED_SLAVES
Definition: constants.hpp:92
constexpr Duration DEFAULT_REGISTRY_MAX_AGENT_AGE
Definition: constants.hpp:113
constexpr char DEFAULT_AUTHORIZER[]
Definition: constants.hpp:145
constexpr char DEFAULT_HTTP_FRAMEWORK_AUTHENTICATION_REALM[]
Definition: constants.hpp:156
constexpr size_t DEFAULT_REGISTRY_MAX_AGENT_COUNT
Definition: constants.hpp:115
constexpr size_t DEFAULT_MAX_AGENT_PING_TIMEOUTS
Definition: constants.hpp:71
constexpr size_t DEFAULT_MAX_COMPLETED_FRAMEWORKS
Definition: constants.hpp:95
Definition: bytes.hpp:30
constexpr int MAX_OFFERS_PER_FRAMEWORK
Definition: constants.hpp:42
const Version MINIMUM_AGENT_VERSION
Definition: constants.hpp:160
constexpr Duration WHITELIST_WATCH_INTERVAL
Definition: constants.hpp:106
constexpr Bytes MIN_MEM
Definition: constants.hpp:48
Definition: duration.hpp:263
constexpr double MIN_CPUS
Definition: constants.hpp:45