17 #ifndef __MESOS_CONTAINERIZER_HPP__ 18 #define __MESOS_CONTAINERIZER_HPP__ 61 #define LOG_BASED_ON_CLASS(containerClass) \ 62 LOG_IF(INFO, (containerClass != ContainerClass::DEBUG) || VLOG_IS_ON(1)) 65 class MesosContainerizerProcess;
98 const ContainerID& containerId,
99 const mesos::slave::ContainerConfig& containerConfig,
100 const std::map<std::string, std::string>&
environment,
104 const ContainerID& containerId)
override;
107 const ContainerID& containerId,
109 const google::protobuf::Map<
110 std::string, Value::Scalar>& resourceLimits = {})
override;
113 const ContainerID& containerId)
override;
116 const ContainerID& containerId)
override;
119 const ContainerID& containerId)
override;
122 const ContainerID& containerId)
override;
125 const ContainerID& containerId,
126 int signal)
override;
133 const std::vector<Image>& excludedImages)
override;
162 ioSwitchboard(_ioSwitchboard),
164 provisioner(_provisioner),
165 isolators(_isolators),
166 volumeGidManager(_volumeGidManager),
167 initMemFd(_initMemFd),
168 commandExecutorMemFd(_commandExecutorMemFd) {}
172 if (initMemFd.isSome()) {
175 LOG(WARNING) <<
"Failed to close memfd '" <<
stringify(initMemFd.get())
176 <<
"': " << close.
error();
180 if (commandExecutorMemFd.isSome()) {
183 LOG(WARNING) <<
"Failed to close memfd '" 185 <<
"': " << close.
error();
194 const ContainerID& containerId,
195 const mesos::slave::ContainerConfig& containerConfig,
196 const std::map<std::string, std::string>&
environment,
200 const ContainerID& containerId);
203 const ContainerID& containerId,
205 const google::protobuf::Map<
206 std::string, Value::Scalar>& resourceLimits = {});
209 const ContainerID& containerId);
212 const ContainerID& containerId);
215 const ContainerID& containerId);
218 const ContainerID& containerId,
222 const ContainerID& containerId,
226 const ContainerID& containerId,
234 const std::vector<Image>& excludedImages);
248 friend std::ostream&
operator<<(std::ostream& stream,
const State& state);
251 const std::vector<mesos::slave::ContainerState>& recoverable,
255 const std::vector<mesos::slave::ContainerState>& recoverable,
259 const std::vector<mesos::slave::ContainerState>& recoverable,
263 const std::vector<mesos::slave::ContainerState>& recovered,
267 const ContainerID& containerId,
271 const ContainerID& containerId);
274 const ContainerID& containerId,
276 const std::map<std::string, std::string>& environment,
280 const ContainerID& containerId,
285 const ContainerID& containerId,
287 const State& previousState,
293 const ContainerID& containerId,
299 const ContainerID& containerId,
305 const ContainerID& containerId,
311 const ContainerID& containerId,
317 const ContainerID& containerId,
328 const ContainerID& containerId,
333 const ContainerID& containerId,
338 void reaped(
const ContainerID& containerId);
343 const ContainerID& containerId);
355 const std::vector<process::Owned<mesos::slave::Isolator>> isolators;
365 sequence(
"mesos-container-status-updates") {}
413 google::protobuf::Map<std::string, Value::Scalar> resourceLimits;
424 mesos::slave::ContainerClass containerClass();
452 void transition(
const ContainerID& containerId,
const State& state);
455 bool isSupportedByIsolator(
456 const ContainerID& containerId,
457 bool isolatorSupportsNesting,
458 bool isolatorSupportsStandalone);
471 std::ostream& stream,
472 const MesosContainerizerProcess::State& state);
478 #endif // __MESOS_CONTAINERIZER_HPP__ process::Future< hashset< ContainerID > > containers() override
Try< Nothing > isolate(const std::string &hierarchy, const std::string &cgroup, pid_t pid)
std::string generate(const std::string &prefix="")
Returns 'prefix(N)' where N represents the number of instances where the same prefix (wrt...
process::Future< Containerizer::LaunchResult > launch(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig, const std::map< std::string, std::string > &environment, const Option< std::string > &pidCheckpointPath) override
~MesosContainerizerProcess() override
Definition: containerizer.hpp:170
Definition: option.hpp:29
std::ostream & operator<<(std::ostream &stream, const MesosContainerizerProcess::State &state)
Definition: fetcher.hpp:49
process::Future< Nothing > update(const ContainerID &containerId, const Resources &resourceRequests, const google::protobuf::Map< std::string, Value::Scalar > &resourceLimits={}) override
Definition: csi_server.hpp:49
process::Future< Nothing > pruneImages(const std::vector< Image > &excludedImages) override
process::Future< bool > kill(const ContainerID &containerId, int signal) override
Definition: resources.hpp:83
Definition: volume_gid_manager.hpp:42
Try< T > fetch(const std::string &value)
Definition: fetch.hpp:38
Future< Option< int > > reap(pid_t pid)
process::Future< Option< mesos::slave::ContainerTermination > > wait(const ContainerID &containerId) override
Definition: counter.hpp:26
Definition: sequence.hpp:33
Definition: hashmap.hpp:38
Environment * environment
DWORD pid_t
Definition: windows.hpp:181
Definition: containerizer.hpp:64
static Try< MesosContainerizer * > create(const Flags &flags, bool local, Fetcher *fetcher, GarbageCollector *gc=nullptr, SecretResolver *secretResolver=nullptr, const Option< NvidiaComponents > &nvidia=None(), VolumeGidManager *volumeGidManager=nullptr, PendingFutureTracker *futureTracker=nullptr, CSIServer *csiServer=nullptr)
process::Future< Nothing > recover(const Option< state::SlaveState > &state) override
MesosContainerizerProcess(const Flags &_flags, Fetcher *_fetcher, GarbageCollector *_gc, IOSwitchboard *_ioSwitchboard, const process::Owned< Launcher > &_launcher, const process::Shared< Provisioner > &_provisioner, const std::vector< process::Owned< mesos::slave::Isolator >> &_isolators, VolumeGidManager *_volumeGidManager, const Option< int_fd > &_initMemFd, const Option< int_fd > &_commandExecutorMemFd)
Definition: containerizer.hpp:147
Definition: future_tracker.hpp:84
Try< Nothing > close(int fd)
Definition: close.hpp:24
process::Future< ResourceStatistics > usage(const ContainerID &containerId) override
Definition: switchboard.hpp:53
static Try error(const E &e)
Definition: try.hpp:43
Definition: containerizer.hpp:143
process::Future< process::http::Connection > attach(const ContainerID &containerId) override
#define flags
Definition: decoder.hpp:18
Definition: attributes.hpp:24
bool isError() const
Definition: try.hpp:78
~MesosContainerizer() override
std::set< pid_t > children(pid_t, const std::list< Process > &, bool)
Definition: os.hpp:217
Definition: executor.hpp:48
static Time now()
The current clock time for either the current process that makes this call or the global clock time i...
Definition: containerizer.hpp:68
Try< std::string > prepare(const std::string &baseHierarchy, const std::string &subsystem, const std::string &cgroup)
Definition: resolver.hpp:34
int int_fd
Definition: int_fd.hpp:35
std::string stringify(int flags)
Definition: process.hpp:505
PID< MetricsProcess > metrics
process::Future< Option< mesos::slave::ContainerTermination > > destroy(const ContainerID &containerId) override
process::Future< ContainerStatus > status(const ContainerID &containerId) override