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 21:54:17 UTC

[1/4] mesos git commit: Updated runtime isolators to use new task_environment member.

Repository: mesos
Updated Branches:
  refs/heads/1.2.x e56ba1778 -> 28091c453


Updated runtime isolators to use new task_environment member.

Review: https://reviews.apache.org/r/58925/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/38bffef4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/38bffef4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/38bffef4

Branch: refs/heads/1.2.x
Commit: 38bffef42c109c12743e1e6ecb4e68195abd006b
Parents: d6c0261
Author: Till Toenshoff <to...@me.com>
Authored: Mon May 8 23:10:56 2017 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon May 8 23:53:57 2017 +0200

----------------------------------------------------------------------
 src/slave/containerizer/mesos/isolators/appc/runtime.cpp   | 4 +---
 src/slave/containerizer/mesos/isolators/docker/runtime.cpp | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/38bffef4/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/appc/runtime.cpp b/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
index ffaec5a..f76b22b 100644
--- a/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
+++ b/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
@@ -116,9 +116,7 @@ Future<Option<ContainerLaunchInfo>> AppcRuntimeIsolatorProcess::prepare(
     CommandInfo executorCommand = containerConfig.executor_info().command();
 
     if (environment.isSome()) {
-      executorCommand.add_arguments(
-          "--task_environment=" +
-          stringify(JSON::protobuf(environment.get())));
+      launchInfo.mutable_task_environment()->CopyFrom(environment.get());
     }
 
     // Pass working directory to command executor as a flag.

http://git-wip-us.apache.org/repos/asf/mesos/blob/38bffef4/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/docker/runtime.cpp b/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
index 08350e6..2a6e0b1 100644
--- a/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
+++ b/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
@@ -136,9 +136,7 @@ Future<Option<ContainerLaunchInfo>> DockerRuntimeIsolatorProcess::prepare(
     CommandInfo executorCommand = containerConfig.executor_info().command();
 
     if (environment.isSome()) {
-      executorCommand.add_arguments(
-          "--task_environment=" +
-          stringify(JSON::protobuf(environment.get())));
+      launchInfo.mutable_task_environment()->CopyFrom(environment.get());
     }
 
     // Pass working directory to command executor as a flag.


[2/4] mesos git commit: Updated containerizer for isolator task_environment merge.

Posted by ti...@apache.org.
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/d6c02612
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d6c02612
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d6c02612

Branch: refs/heads/1.2.x
Commit: d6c026125f8fb5d4c5b4f0205eff3125755753d6
Parents: f477b3e
Author: Till Toenshoff <to...@me.com>
Authored: Mon May 8 23:10:41 2017 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon May 8 23:53: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/d6c02612/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 7676a4d..4bd73ba 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1339,6 +1339,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


[4/4] mesos git commit: Added MESOS-7429 to 1.2.1 CHANGELOG.

Posted by ti...@apache.org.
Added MESOS-7429 to 1.2.1 CHANGELOG.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/28091c45
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/28091c45
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/28091c45

Branch: refs/heads/1.2.x
Commit: 28091c4530224121d7bd3b3587557506723c5d64
Parents: 38bffef
Author: Till Toenshoff <to...@me.com>
Authored: Mon May 8 23:06:08 2017 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon May 8 23:53:58 2017 +0200

----------------------------------------------------------------------
 CHANGELOG | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/28091c45/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 2907e3c..5737459 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,6 +25,7 @@ All Issues:
   * [MESOS-7389] - Mesos 1.2.0 crashes with pre-1.0 Mesos agents.
   * [MESOS-7400] - The mesos crashes due to an incorrect invariant check in the decoder.
   * [MESOS-7427] - Registry puller cannot fetch manifests from Amazon ECR: 405 Unsupported.
+  * [MESOS-7429] - Allow isolators to inject task-specific environment variables.
   * [MESOS-7453] - glyphicons-halflings-regular.woff2 is missing in WebUI.
 
 


[3/4] mesos git commit: Added new ContainerLaunchInfo task_environment.

Posted by ti...@apache.org.
Added new ContainerLaunchInfo task_environment.

Review: https://reviews.apache.org/r/58923/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f477b3e9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f477b3e9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f477b3e9

Branch: refs/heads/1.2.x
Commit: f477b3e95442f3bb631e6ef0219c0c6865b63267
Parents: e56ba17
Author: Till Toenshoff <to...@me.com>
Authored: Mon May 8 23:10:31 2017 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon May 8 23:53:57 2017 +0200

----------------------------------------------------------------------
 include/mesos/slave/containerizer.proto | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f477b3e9/include/mesos/slave/containerizer.proto
----------------------------------------------------------------------
diff --git a/include/mesos/slave/containerizer.proto b/include/mesos/slave/containerizer.proto
index de2cd37..8a07a49 100644
--- a/include/mesos/slave/containerizer.proto
+++ b/include/mesos/slave/containerizer.proto
@@ -159,6 +159,8 @@ message ContainerLaunchInfo {
   // The additional preparation commands to execute before
   // executing the command.
   repeated CommandInfo pre_exec_commands = 1;
+
+  // The environment set for the container.
   optional Environment environment = 2;
 
   // (Linux only) The root filesystem for the container.
@@ -194,6 +196,12 @@ message ContainerLaunchInfo {
 
   // (POSIX only) The slave path of the pseudo terminal.
   optional string tty_slave_path = 14;
+
+  // The environment specific for command tasks. Gets merged with
+  // 'environment' and the 'command' `Environment`.
+  // TODO(tillt): Remove this once we no longer support the old style
+  // command task (i.e., that uses mesos-execute).
+  optional Environment task_environment = 15;
 }