You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by qi...@apache.org on 2020/08/03 02:51:35 UTC

[mesos] 03/04: Introduced a new agent flag `--csi_plugin_config_dir`.

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

qianzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 4d3c3d770eceff12ea5d39dbd57ce6bae602266e
Author: Qian Zhang <zh...@gmail.com>
AuthorDate: Mon Jul 13 17:16:28 2020 +0800

    Introduced a new agent flag `--csi_plugin_config_dir`.
    
    Review: https://reviews.apache.org/r/72672
---
 docs/configuration/agent.md | 43 +++++++++++++++++++++++++++++++++++++++++++
 src/slave/flags.cpp         | 39 +++++++++++++++++++++++++++++++++++++++
 src/slave/flags.hpp         |  1 +
 3 files changed, 83 insertions(+)

diff --git a/docs/configuration/agent.md b/docs/configuration/agent.md
index 01ffa38..e8608d9 100644
--- a/docs/configuration/agent.md
+++ b/docs/configuration/agent.md
@@ -1511,6 +1511,49 @@ Example config file in this directory:
   </td>
 </tr>
 
+<tr id="csi_plugin_config_dir">
+  <td>
+    --csi_plugin_config_dir=VALUE
+  </td>
+  <td>
+Path to a directory that contains CSI plugin configs.
+Each file in the config dir should contain a JSON object representing
+a <code>CSIPluginInfo</code> object which can be either a managed CSI
+plugin (i.e. the plugin launched by Mesos as a standalone container)
+or an unmanaged CSI plugin (i.e. the plugin launched out of Mesos).
+<p/>
+Example config files in this directory:
+<pre><code>{
+  "type": "org.apache.mesos.csi.managed-plugin",
+  "containers": [
+    {
+      "services": [
+        "CONTROLLER_SERVICE",
+        "NODE_SERVICE"
+      ],
+      "command": {
+        "shell": false,
+        "value": "managed-plugin",
+        "arguments": [
+          "managed-plugin",
+          "--endpoint=$(CSI_ENDPOINT)"
+        ]
+      },
+      "resources": [
+        {"name": "cpus", "type": "SCALAR", "scalar": {"value": 0.1}},
+        {"name": "mem", "type": "SCALAR", "scalar": {"value": 1024}}
+      ]
+    }
+  ]
+}</code></pre>
+<pre><code>{
+  "type": "org.apache.mesos.csi.unmanaged-plugin",
+  "node_service_endpoint": "/var/lib/unmanaged-plugin/csi.sock",
+  "target_path_root": "/mnt/unmanaged-plugin"
+}</code></pre>
+  </td>
+</tr>
+
 <tr id="revocable_cpu_low_priority">
   <td>
     --[no-]revocable_cpu_low_priority
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 2f88b90..02a5568 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -115,6 +115,45 @@ mesos::internal::slave::Flags::Flags()
       "  \"name\": \"lvm\"\n"
       "}");
 
+  add(&Flags::csi_plugin_config_dir,
+      "csi_plugin_config_dir",
+      "Path to a directory that contains CSI plugin configs.\n"
+      "Each file in the config dir should contain a JSON object representing\n"
+      "a `CSIPluginInfo` object which can be either a managed CSI plugin\n"
+      "(i.e. the plugin launched by Mesos as a standalone container) or an\n"
+      "unmanaged CSI plugin (i.e. the plugin launched out of Mesos).\n"
+      "\n"
+      "Example config files in this directory:\n"
+      "{\n"
+      "  \"type\": \"org.apache.mesos.csi.managed-plugin\",\n"
+      "  \"containers\": [\n"
+      "    {\n"
+      "      \"services\": [\n"
+      "        \"CONTROLLER_SERVICE\",\n"
+      "        \"NODE_SERVICE\"\n"
+      "      ],\n"
+      "      \"command\": {\n"
+      "        \"shell\": false,\n"
+      "        \"value\": \"managed-plugin\",\n"
+      "        \"arguments\": [\n"
+      "          \"managed-plugin\",\n"
+      "          \"--endpoint=$(CSI_ENDPOINT)\"\n"
+      "        ]\n"
+      "      },\n"
+      "      \"resources\": [\n"
+      "        {\"name\": \"cpus\", \"type\": \"SCALAR\", \"scalar\": {\"value\": 0.1}},\n" // NOLINT(whitespace/line_length)
+      "        {\"name\": \"mem\", \"type\": \"SCALAR\", \"scalar\": {\"value\": 1024}}\n" // NOLINT(whitespace/line_length)
+      "      ]\n"
+      "    }\n"
+      "  ]\n"
+      "}\n"
+      "\n"
+      "{\n"
+      "  \"type\": \"org.apache.mesos.csi.unmanaged-plugin\",\n"
+      "  \"node_service_endpoint\": \"/var/lib/unmanaged-plugin/csi.sock\",\n"
+      "  \"target_path_root\": \"/mnt/unmanaged-plugin\"\n"
+      "}");
+
   add(&Flags::disk_profile_adaptor,
       "disk_profile_adaptor",
       "The name of the disk profile adaptor module that storage resource\n"
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index c3ff887..51770f5 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -46,6 +46,7 @@ public:
   bool hostname_lookup;
   Option<std::string> resources;
   Option<std::string> resource_provider_config_dir;
+  Option<std::string> csi_plugin_config_dir;
   Option<std::string> disk_profile_adaptor;
   std::string isolation;
   std::string launcher;