You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2017/05/08 17:24:36 UTC
[2/3] mesos git commit: Updated containerizer for isolator
task_environment merge.
Updated containerizer for isolator task_environment merge.
Review: https://reviews.apache.org/r/58924/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1973ab59
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1973ab59
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1973ab59
Branch: refs/heads/master
Commit: 1973ab59f731cb7c44c2abfc851567f3b9e6555a
Parents: c3130bd
Author: Till Toenshoff <to...@me.com>
Authored: Mon May 8 19:15:57 2017 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon May 8 19:15:57 2017 +0200
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 26 ++++++++++++++++++++
1 file changed, 26 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1973ab59/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index b58baed..58ab745 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1347,6 +1347,32 @@ Future<bool> MesosContainerizerProcess::_launch(
launchInfo.mutable_command()->CopyFrom(container->config.command_info());
}
+ // For command tasks specifically, we should add the task_environment
+ // flag to the launch command of the command executor.
+ // TODO(tillt): Remove this once we no longer support the old style
+ // command task (i.e., that uses mesos-execute).
+ if (container->config.has_task_info() && launchInfo.has_task_environment()) {
+ hashmap<string, string> commandTaskEnvironment;
+
+ foreach (const Environment::Variable& variable,
+ launchInfo.task_environment().variables()) {
+ const string& name = variable.name();
+ const string& value = variable.value();
+ if (commandTaskEnvironment.contains(name) &&
+ commandTaskEnvironment[name] != value) {
+ LOG(WARNING) << "Overwriting environment variable '" << name << "' "
+ << "for container " << containerId;
+ }
+ // TODO(tillt): Consider making this 'secret' aware.
+ commandTaskEnvironment[name] = value;
+ }
+
+ if (!commandTaskEnvironment.empty()) {
+ launchInfo.mutable_command()->add_arguments(
+ "--task_environment=" + string(jsonify(commandTaskEnvironment)));
+ }
+ }
+
// For the command executor case, we should add the rootfs flag to
// the launch command of the command executor.
// TODO(jieyu): Remove this once we no longer support the old style