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 __SLAVE_CONSTANTS_HPP__
18 #define __SLAVE_CONSTANTS_HPP__
19 
20 #include <stdint.h>
21 #include <vector>
22 
23 #include <mesos/mesos.hpp>
24 
25 #include <stout/bytes.hpp>
26 #include <stout/duration.hpp>
27 
28 namespace mesos {
29 namespace internal {
30 namespace slave {
31 
32 // TODO(jieyu): Use static functions for all the constants. See more
33 // details in MESOS-1023.
34 
37 
38 // The maximum timeout within which an executor can reregister.
39 // Note that this value has to be << 'MIN_AGENT_REREGISTER_TIMEOUT'
40 // declared in 'master/constants.hpp'; since agent recovery will only
41 // complete after this timeout has elapsed, this ensures that the
42 // agent can reregister with the master before it is marked
43 // unreachable and its tasks are transitioned to TASK_UNREACHABLE or
44 // TASK_LOST.
46 
47 // The default amount of time to wait for the executor to
48 // shut down before destroying the container.
50 
52 
53 // TODO(gkleiman): Move this to a different file once `TaskStatusUpdateManager`
54 // uses `StatusUpdateManagerProcess`. See MESOS-8296.
57 
58 // Default backoff interval used by the slave to wait before registration.
60 
61 // The maximum interval the slave waits before retrying registration.
62 // Note that this value has to be << 'MIN_SLAVE_REREGISTER_TIMEOUT'
63 // declared in 'master/constants.hpp'. This helps the slave to retry
64 // (re-)registration multiple times between when the master finishes
65 // recovery and when it times out slave re-registration.
67 
68 // Default value for `--authentication_backoff_factor`. The backoff interval
69 // factor affects the agent timeout interval after failed authentications.
71 
72 // Default value for `--authentication_timeout_min`. The minimum timeout
73 // interval the agent waits before retrying authentication.
75 
76 // Default value for `--authentication_timeout_max`. The maximum timeout
77 // interval the agent waits before retrying authentication.
79 
80 constexpr Duration GC_DELAY = Weeks(1);
82 
83 // Minimum free disk capacity enforced by the garbage collector.
84 constexpr double GC_DISK_HEADROOM = 0.1;
85 
86 // Maximum number of completed frameworks to store in memory.
87 constexpr size_t MAX_COMPLETED_FRAMEWORKS = 50;
88 
89 // Default maximum number of completed executors per framework
90 // to store in memory.
92 
93 // Maximum number of a container id length, according to the
94 // max entry length for directory names on AUFS.
95 constexpr size_t MAX_CONTAINER_ID_LENGTH = 242;
96 
97 // Maximum number of completed tasks per executor to store in memory.
98 //
99 // NOTE: This should be greater than zero because the agent looks
100 // for completed tasks to determine (with false positives) whether
101 // an executor ever received tasks. See MESOS-8411.
102 //
103 // TODO(mzhu): Remove this note once we can determine whether an
104 // executor ever received tasks without looking through the
105 // completed tasks.
106 constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR = 200;
107 
108 // Default cpus offered by the slave.
109 constexpr double DEFAULT_CPUS = 1;
110 
111 // Default memory offered by the slave.
112 constexpr Bytes DEFAULT_MEM = Gigabytes(1);
113 
114 // Default disk space offered by the slave.
115 constexpr Bytes DEFAULT_DISK = Gigabytes(10);
116 
117 // Default ports range offered by the slave.
118 constexpr char DEFAULT_PORTS[] = "[31000-32000]";
119 
120 // Default cpu resource given to a command executor.
121 constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
122 
123 // Default memory resource given to a command executor.
125 
126 #ifdef ENABLE_PORT_MAPPING_ISOLATOR
127 // Default number of ephemeral ports allocated to a container by the
128 // network isolator.
129 constexpr uint16_t DEFAULT_EPHEMERAL_PORTS_PER_CONTAINER = 1024;
130 #endif
131 
132 // Default UNIX socket (Linux) or Named Pipe (Windows) resource that provides
133 // CLI access to the Docker daemon.
134 #ifdef __WINDOWS__
135 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "//./pipe/docker_engine";
136 #else
137 constexpr char DEFAULT_DOCKER_HOST_RESOURCE[] = "/var/run/docker.sock";
138 #endif // __WINDOWS__
139 
140 // Default duration that docker containers will be removed after exit.
142 
143 // Default duration to wait before retry inspecting a docker
144 // container.
146 
147 // Default duration to wait for `inspect` command completion.
149 
150 // Default maximum number of docker inspect calls docker ps will invoke
151 // in parallel to prevent hitting system's open file descriptor limit.
152 constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS = 100;
153 
154 // Default duration that docker containerizer will wait to check
155 // docker version.
156 // TODO(tnachen): Make this a flag.
158 
159 // Additional duration that docker containerizer will wait beyond the
160 // configured `docker_stop_timeout` for docker stop to succeed, before
161 // trying to kill the process by itself.
163 
164 // Name of the default, CRAM-MD5 authenticatee.
165 constexpr char DEFAULT_AUTHENTICATEE[] = "crammd5";
166 
167 // Name of the default, local authorizer.
168 constexpr char DEFAULT_AUTHORIZER[] = "local";
169 
170 // Name of the agent HTTP authentication realm for read-only endpoints.
171 constexpr char READONLY_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readonly";
172 
173 // Name of the agent HTTP authentication realm for read-write endpoints.
174 constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-readwrite";
175 
176 // Name of the agent HTTP authentication realm for HTTP executors.
177 constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[] = "mesos-agent-executor";
178 
179 // Name of the agent HTTP authentication realm for HTTP resource providers.
181  "mesos-agent-resource-provider";
182 
183 // Default maximum storage space to be used by the fetcher cache.
185 
186 // Default timeout for the fetcher to wait when a net download stalls.
188 
189 // If no pings received within this timeout, then the slave will
190 // trigger a re-detection of the master to cause a re-registration.
192 
193 // Name of the executable for default executor.
194 #ifdef __WINDOWS__
195 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor.exe";
196 #else
197 constexpr char MESOS_DEFAULT_EXECUTOR[] = "mesos-default-executor";
198 #endif // __WINDOWS__
199 
200 // Virtual path on which agent logs are mounted in `/files/` endpoint.
201 constexpr char AGENT_LOG_VIRTUAL_PATH[] = "/slave/log";
202 
203 std::vector<SlaveInfo::Capability> AGENT_CAPABILITIES();
204 
205 } // namespace slave {
206 } // namespace internal {
207 } // namespace mesos {
208 
209 #endif // __SLAVE_CONSTANTS_HPP__
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MAX
Definition: constants.hpp:56
constexpr Duration DOCKER_FORCE_KILL_TIMEOUT
Definition: constants.hpp:162
constexpr double DEFAULT_EXECUTOR_CPUS
Definition: constants.hpp:121
constexpr Duration RECOVERY_TIMEOUT
Definition: constants.hpp:51
constexpr char DEFAULT_DOCKER_HOST_RESOURCE[]
Definition: constants.hpp:137
constexpr Duration DEFAULT_FETCHER_STALL_TIMEOUT
Definition: constants.hpp:187
constexpr Bytes Megabytes(uint64_t value)
Definition: bytes.hpp:123
constexpr Duration DOCKER_REMOVE_DELAY
Definition: constants.hpp:141
constexpr size_t MAX_COMPLETED_FRAMEWORKS
Definition: constants.hpp:87
constexpr Duration DEFAULT_AUTHENTICATION_BACKOFF_FACTOR
Definition: constants.hpp:70
constexpr size_t MAX_CONTAINER_ID_LENGTH
Definition: constants.hpp:95
constexpr char DEFAULT_PORTS[]
Definition: constants.hpp:118
constexpr Bytes DEFAULT_MEM
Definition: constants.hpp:112
Definition: duration.hpp:32
constexpr Duration MAX_EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:45
constexpr char MESOS_DEFAULT_EXECUTOR[]
Definition: constants.hpp:197
constexpr Bytes DEFAULT_DISK
Definition: constants.hpp:115
constexpr Duration STATUS_UPDATE_RETRY_INTERVAL_MIN
Definition: constants.hpp:55
constexpr Duration DEFAULT_EXECUTOR_SHUTDOWN_GRACE_PERIOD
Definition: constants.hpp:49
constexpr Duration DOCKER_INSPECT_TIMEOUT
Definition: constants.hpp:148
constexpr Duration DEFAULT_REGISTRATION_BACKOFF_FACTOR
Definition: constants.hpp:59
Definition: duration.hpp:221
constexpr size_t DEFAULT_MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK
Definition: constants.hpp:91
Definition: duration.hpp:207
constexpr Duration GC_DELAY
Definition: constants.hpp:80
Definition: spec.hpp:26
constexpr double DEFAULT_CPUS
Definition: constants.hpp:109
constexpr Duration DEFAULT_AUTHENTICATION_TIMEOUT_MIN
Definition: constants.hpp:74
constexpr Bytes DEFAULT_FETCHER_CACHE_SIZE
Definition: constants.hpp:184
constexpr double GC_DISK_HEADROOM
Definition: constants.hpp:84
Definition: duration.hpp:235
std::vector< SlaveInfo::Capability > AGENT_CAPABILITIES()
constexpr char DEFAULT_AUTHENTICATEE[]
Definition: constants.hpp:165
constexpr Duration EXECUTOR_REREGISTRATION_TIMEOUT
Definition: constants.hpp:36
Definition: attributes.hpp:24
constexpr Duration DEFAULT_AUTHENTICATION_TIMEOUT_MAX
Definition: constants.hpp:78
constexpr size_t DOCKER_PS_MAX_INSPECT_CALLS
Definition: constants.hpp:152
constexpr char AGENT_LOG_VIRTUAL_PATH[]
Definition: constants.hpp:201
constexpr Bytes Gigabytes(uint64_t value)
Definition: bytes.hpp:129
constexpr Duration REGISTER_RETRY_INTERVAL_MAX
Definition: constants.hpp:66
constexpr Duration DISK_WATCH_INTERVAL
Definition: constants.hpp:81
constexpr char RESOURCE_PROVIDER_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:180
constexpr Bytes DEFAULT_EXECUTOR_MEM
Definition: constants.hpp:124
constexpr char EXECUTOR_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:177
constexpr char DEFAULT_AUTHORIZER[]
Definition: constants.hpp:168
Definition: bytes.hpp:30
constexpr Duration EXECUTOR_REGISTRATION_TIMEOUT
Definition: constants.hpp:35
constexpr char READWRITE_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:174
constexpr size_t MAX_COMPLETED_TASKS_PER_EXECUTOR
Definition: constants.hpp:106
Definition: duration.hpp:263
constexpr Duration DOCKER_VERSION_WAIT_TIMEOUT
Definition: constants.hpp:157
constexpr Duration DOCKER_INSPECT_DELAY
Definition: constants.hpp:145
Duration DEFAULT_MASTER_PING_TIMEOUT()
constexpr char READONLY_HTTP_AUTHENTICATION_REALM[]
Definition: constants.hpp:171