You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2018/09/27 22:44:50 UTC

[mesos] branch 1.7.x updated (dcbb942 -> ceae358)

This is an automated email from the ASF dual-hosted git repository.

jieyu pushed a change to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git.


    from dcbb942  Added a note about allocaiton cycle performance in the 1.7.1 CHANGELOG.
     new 8ca9dd2  Skipped CNI config load if named network is not enabled.
     new 22b8eec  Removed unneeded pluginDir field from CNI isolator.
     new ceae358  Added MESOS-9267 to 1.7.1 CHANGELOG.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG                                          |  1 +
 .../mesos/isolators/network/cni/cni.cpp            | 73 ++++++++++++----------
 .../mesos/isolators/network/cni/cni.hpp            |  9 +--
 3 files changed, 43 insertions(+), 40 deletions(-)


[mesos] 01/03: Skipped CNI config load if named network is not enabled.

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jieyu pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 8ca9dd23be7765eae638dc6a8783f4c09a517df6
Author: Jie Yu <yu...@gmail.com>
AuthorDate: Wed Sep 26 21:38:05 2018 -0700

    Skipped CNI config load if named network is not enabled.
    
    If the operator didn't turn on named CNI network support (i.e., both
    agent flags `network_cni_config_dir` and `network_cni_plugins_dir` are
    not specified), the CNI should not attempt to load the network configs.
    This patch fixed a potential CHECK failure.
    
    Review: https://reviews.apache.org/r/68861
    (cherry picked from commit 832ebc2beddbe8d38427c2ce0e5578bcaee69b35)
---
 .../mesos/isolators/network/cni/cni.cpp            | 41 ++++++++++++----------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index ed47046..8af853c 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -1929,27 +1929,32 @@ Try<JSON::Object> NetworkCniIsolatorProcess::getNetworkConfigJSON(
   }
 
   // Cache-miss.
-  Try<hashmap<string, string>> _networkConfigs = loadNetworkConfigs(
-      flags.network_cni_config_dir.get(),
-      flags.network_cni_plugins_dir.get());
+  if (rootDir.isSome()) {
+    CHECK_SOME(flags.network_cni_config_dir);
+    CHECK_SOME(flags.network_cni_plugins_dir);
 
-  if (_networkConfigs.isError()) {
-      return Error(
-          "Encountered error while loading CNI config during "
-          "a cache-miss for CNI network '" + network + "': " +
-          _networkConfigs.error());
-  }
+    Try<hashmap<string, string>> _networkConfigs = loadNetworkConfigs(
+        flags.network_cni_config_dir.get(),
+        flags.network_cni_plugins_dir.get());
 
-  networkConfigs = _networkConfigs.get();
+    if (_networkConfigs.isError()) {
+        return Error(
+            "Encountered error while loading CNI config during "
+            "a cache-miss for CNI network '" + network + "': " +
+            _networkConfigs.error());
+    }
 
-  // Do another search.
-  if (networkConfigs.contains(network)) {
-    // This is a best-effort retrieval of the CNI network config. So
-    // if it fails in this attempt just return the `Error` instead of
-    // trying to erase the network from cache. Deletion of the
-    // network, in case of an error, will happen on its own in the
-    // next attempt.
-    return getNetworkConfigJSON(network, networkConfigs[network]);
+    networkConfigs = _networkConfigs.get();
+
+    // Do another search.
+    if (networkConfigs.contains(network)) {
+      // This is a best-effort retrieval of the CNI network config. So
+      // if it fails in this attempt just return the `Error` instead of
+      // trying to erase the network from cache. Deletion of the
+      // network, in case of an error, will happen on its own in the
+      // next attempt.
+      return getNetworkConfigJSON(network, networkConfigs[network]);
+    }
   }
 
   return Error("Unknown CNI network '" + network + "'");


[mesos] 03/03: Added MESOS-9267 to 1.7.1 CHANGELOG.

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jieyu pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit ceae358d1a4d5c4e9c9320b3cddcb3ec665b6fb5
Author: Jie Yu <yu...@gmail.com>
AuthorDate: Thu Sep 27 15:41:32 2018 -0700

    Added MESOS-9267 to 1.7.1 CHANGELOG.
    
    (cherry picked from commit 52b57ec6ec9129dd36fbb8206689cc07a656aab1)
---
 CHANGELOG | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG b/CHANGELOG
index 123d90b..9b36f8b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@ Release Notes - Mesos - Version 1.7.1 (WIP)
   * [MESOS-8545] - AgentAPIStreamingTest.AttachInputToNestedContainerSession is flaky.
   * [MESOS-9131] - Health checks launching nested containers while a container is being destroyed lead to unkillable tasks.
   * [MESOS-9228] - SLRP does not clean up plugin containers after it is removed.
+  * [MESOS-9267] - Mesos agent crashes when CNI network is not configured but used.
 
 ** Improvement:
   * [MESOS-9239] - Improve sorting performance in the DRF sorter.


[mesos] 02/03: Removed unneeded pluginDir field from CNI isolator.

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jieyu pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 22b8eec8e18bcb5363498790ed70fa465c62a0b0
Author: Jie Yu <yu...@gmail.com>
AuthorDate: Wed Sep 26 21:57:14 2018 -0700

    Removed unneeded pluginDir field from CNI isolator.
    
    The field member is redundant as it's already included in the flags.
    
    Review: https://reviews.apache.org/r/68862
    (cherry picked from commit 84b0a51e7174885f45b155ef912772c2593fc398)
---
 .../mesos/isolators/network/cni/cni.cpp            | 32 ++++++++++++----------
 .../mesos/isolators/network/cni/cni.hpp            |  9 ++----
 2 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index 8af853c..ba46552 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -289,8 +289,7 @@ Try<Isolator*> NetworkCniIsolatorProcess::create(const Flags& flags)
           networkConfigs.get(),
           cniDNSMap,
           defaultCniDNS,
-          rootDir.get(),
-          flags.network_cni_plugins_dir.get())));
+          rootDir.get())));
 }
 
 
@@ -860,12 +859,11 @@ Future<Nothing> NetworkCniIsolatorProcess::isolate(
   // level or nested) wants to join non-host networks.
 
   // If the `network/cni` isolator is providing network isolation to a
-  // container its `rootDir` and `pluginDir` should always be set.
-  // These properties of the isolator will not be set only if the
-  // operator does not specify the '--network_cni_plugins_dir' and
-  // '--network_cni_config_dir' flags at agent startup.
+  // container its `rootDir` should always be set.  It will not be set
+  // only if the operator does not specify the
+  // '--network_cni_plugins_dir' and '--network_cni_config_dir' flags
+  // at agent startup.
   CHECK_SOME(rootDir);
-  CHECK_SOME(pluginDir);
 
   // NOTE: DEBUG container should not have Info struct. Thus if the
   // control reaches here, the container is not a DEBUG container.
@@ -1216,10 +1214,12 @@ Future<Nothing> NetworkCniIsolatorProcess::attach(
   }
 
   // Prepare environment variables for CNI plugin.
+  CHECK_SOME(flags.network_cni_plugins_dir);
+
   map<string, string> environment;
   environment["CNI_COMMAND"] = "ADD";
   environment["CNI_CONTAINERID"] = stringify(containerId);
-  environment["CNI_PATH"] = pluginDir.get();
+  environment["CNI_PATH"] = flags.network_cni_plugins_dir.get();
   environment["CNI_IFNAME"] = containerNetwork.ifName;
   environment["CNI_NETNS"] = netNsHandle;
 
@@ -1264,8 +1264,8 @@ Future<Nothing> NetworkCniIsolatorProcess::attach(
 
   // Invoke the CNI plugin.
   //
-  // NOTE: We want to execute only the plugin found in the `pluginDir`
-  // path specified by the operator.
+  // NOTE: We want to execute only the plugin found in the
+  // `flags.network_cni_plugins_dir` path specified by the operator.
   Result<JSON::String> _plugin = networkConfigJSON->at<JSON::String>("type");
   if (!_plugin.isSome()) {
     return Failure(
@@ -1277,7 +1277,7 @@ Future<Nothing> NetworkCniIsolatorProcess::attach(
 
   Option<string> plugin = os::which(
       _plugin->value,
-      pluginDir.get());
+      flags.network_cni_plugins_dir.get());
 
   if (plugin.isNone()) {
     return Failure(
@@ -1699,10 +1699,12 @@ Future<Nothing> NetworkCniIsolatorProcess::detach(
     infos[containerId]->containerNetworks[networkName];
 
   // Prepare environment variables for CNI plugin.
+  CHECK_SOME(flags.network_cni_plugins_dir);
+
   map<string, string> environment;
   environment["CNI_COMMAND"] = "DEL";
   environment["CNI_CONTAINERID"] = stringify(containerId);
-  environment["CNI_PATH"] = pluginDir.get();
+  environment["CNI_PATH"] = flags.network_cni_plugins_dir.get();
   environment["CNI_IFNAME"] = containerNetwork.ifName;
   environment["CNI_NETNS"] =
       paths::getNamespacePath(rootDir.get(), containerId);
@@ -1760,11 +1762,11 @@ Future<Nothing> NetworkCniIsolatorProcess::detach(
 
   // Invoke the CNI plugin.
   //
-  // NOTE: We want to execute only the plugin found in the `pluginDir`
-  // path specified by the operator.
+  // NOTE: We want to execute only the plugin found in the
+  // `flags.network_cni_plugins_dir` path specified by the operator.
   Option<string> plugin = os::which(
       _plugin->value,
-      pluginDir.get());
+      flags.network_cni_plugins_dir.get());
 
   if (plugin.isNone()) {
     return Failure(
diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.hpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.hpp
index 4ac55c8..0e23a26 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.hpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.hpp
@@ -135,15 +135,13 @@ private:
       const hashmap<std::string, std::string>& _networkConfigs,
       const hashmap<std::string, ContainerDNSInfo::MesosInfo>& _cniDNSMap,
       const Option<ContainerDNSInfo::MesosInfo>& _defaultCniDNS = None(),
-      const Option<std::string>& _rootDir = None(),
-      const Option<std::string>& _pluginDir = None())
+      const Option<std::string>& _rootDir = None())
     : ProcessBase(process::ID::generate("mesos-network-cni-isolator")),
       flags(_flags),
       networkConfigs(_networkConfigs),
       cniDNSMap(_cniDNSMap),
       defaultCniDNS(_defaultCniDNS),
-      rootDir(_rootDir),
-      pluginDir(_pluginDir) {}
+      rootDir(_rootDir) {}
 
   process::Future<Nothing> _isolate(
       const ContainerID& containerId,
@@ -221,9 +219,6 @@ private:
   // CNI network information root directory.
   const Option<std::string> rootDir;
 
-  // CNI plugins directory.
-  const Option<std::string> pluginDir;
-
   // Information of CNI networks that each container joins.
   hashmap<ContainerID, process::Owned<Info>> infos;