17 #ifndef __MESOS_CONTAINERIZER_IO_SWITCHBOARD_HPP__ 18 #define __MESOS_CONTAINERIZER_IO_SWITCHBOARD_HPP__ 66 const std::vector<mesos::slave::ContainerState>& states,
70 const ContainerID& containerId,
71 const mesos::slave::ContainerConfig& containerConfig)
override;
74 const ContainerID& containerId)
override;
77 const ContainerID& containerId)
override;
81 const ContainerID& containerId)
const;
86 const ContainerID& containerID);
92 const mesos::slave::ContainerConfig& containerConfig);
112 const ContainerID& containerId,
113 const mesos::slave::ContainerConfig& containerConfig,
117 const ContainerID& containerId)
const;
120 const ContainerID& containerID);
124 const ContainerID& containerId,
126 #endif // __WINDOWS__ 153 class IOSwitchboardServerProcess;
167 "The io switchboard server is designed to feed stdin to a container\n" 168 "from an external source, as well as redirect the stdin/stdout of a\n" 169 "container to multiple targets.\n" 171 "It runs an HTTP server over a unix domain socket in order to process\n" 172 "incoming `ATTACH_CONTAINER_INPUT` and `ATTACH_CONTAINER_OUTPUT`\n" 173 "calls and redirect a containers `stdin/stdout/stderr` through them.\n" 175 "The primary motivation of this component is to enable support in\n" 176 "mesos similar to `docker attach` and `docker exec` whereby an\n" 177 "external client can attach to the stdin/stdout/stderr of a running\n" 178 "container as well as launch arbitrary subcommands inside a container\n" 179 "and attach to its stdin/stdout/stderr.\n");
183 "If a pseudo terminal has been allocated for the container.",
186 add(&Flags::stdin_to_fd,
188 "The file descriptor where incoming stdin data should be written.");
190 add(&Flags::stdout_from_fd,
192 "The file descriptor that should be read to consume stdout data.");
194 add(&Flags::stdout_to_fd,
196 "A file descriptor where data read from\n" 197 "'stdout_from_fd' should be redirected to.");
199 add(&Flags::stderr_from_fd,
201 "The file descriptor that should be read to consume stderr data.");
203 add(&Flags::stderr_to_fd,
205 "A file descriptor where data read from\n" 206 "'stderr_from_fd' should be redirected to.");
208 add(&Flags::wait_for_connection,
209 "wait_for_connection",
210 "A boolean indicating whether the server should wait for the\n" 211 "first connection before reading any data from the '*_from_fd's.",
214 add(&Flags::socket_path,
216 "The path of the unix domain socket this\n" 217 "io switchboard should attach itself to.");
219 add(&Flags::heartbeat_interval,
220 "heartbeat_interval",
221 "A heartbeat interval (e.g. '5secs', '10mins') for messages to\n" 222 "be sent to any open 'ATTACH_CONTAINER_OUTPUT' connections.");
245 const std::string& socketPath,
246 bool waitForConnection =
false,
267 bool waitForConnection,
272 #endif // __WINDOWS__ 278 #endif // __MESOS_CONTAINERIZER_IO_SWITCHBOARD_HPP__
process::Future< Option< mesos::slave::ContainerLaunchInfo > > prepare(const ContainerID &containerId, const mesos::slave::ContainerConfig &containerConfig) override
process::Future< mesos::slave::ContainerLimitation > watch(const ContainerID &containerId) override
bool tty
Definition: switchboard.hpp:225
Definition: switchboard.hpp:156
Option< int > stdout_to_fd
Definition: switchboard.hpp:228
virtual process::Future< ContainerStatus > status(const ContainerID &containerId)
Definition: isolator.hpp:139
const std::string NAME
Definition: logrotate.hpp:38
An abstraction around the IO classes used to redirect stdin/stdout/stderr to/from a container by the ...
Definition: containerizer.hpp:37
Future< Nothing > add(const T &metric)
Definition: metrics.hpp:95
~IOSwitchboard() override
Option< int > stdin_to_fd
Definition: switchboard.hpp:226
bool supportsStandalone() override
Definition: hashmap.hpp:38
Option< int > stderr_from_fd
Definition: switchboard.hpp:229
process::Future< process::http::Connection > connect(const ContainerID &containerId) const
process::Future< Nothing > recover(const std::vector< mesos::slave::ContainerState > &states, const hashset< ContainerID > &orphans) override
Definition: switchboard.hpp:53
Option< int > stdout_from_fd
Definition: switchboard.hpp:227
Definition: isolator.hpp:82
Option< int > stderr_to_fd
Definition: switchboard.hpp:230
void run(std::vector< C > &&callbacks, Arguments &&...arguments)
Definition: future.hpp:621
Flags()
Definition: switchboard.hpp:163
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
process::Future< Option< mesos::slave::ContainerIO > > extractContainerIO(const ContainerID &containerID)
Definition: attributes.hpp:24
bool supportsNesting() override
static bool requiresServer(const mesos::slave::ContainerConfig &containerConfig)
process::Future< Nothing > cleanup(const ContainerID &containerId) override
bool unblock(int signal)
Definition: signals.hpp:80
Try< Netlink< struct nl_sock > > socket(int protocol=NETLINK_ROUTE)
Definition: internal.hpp:91
std::string stringify(int flags)
Definition: switchboard.hpp:161
An abstraction around a socket (file descriptor).
Definition: socket.hpp:258
static Try< IOSwitchboard * > create(const Flags &flags, bool local)
Option< std::string > socket_path
Definition: switchboard.hpp:231
Option< Duration > heartbeat_interval
Definition: switchboard.hpp:233
bool wait_for_connection
Definition: switchboard.hpp:232