mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tnac...@apache.org
Subject mesos git commit: Removed docker provisioner port slave flags.
Date Wed, 30 Dec 2015 22:35:19 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 3ad7b3471 -> b54d9ee06


Removed docker provisioner port slave flags.

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


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

Branch: refs/heads/master
Commit: b54d9ee065b336fd93497d226d641e527d938925
Parents: 3ad7b34
Author: Timothy Chen <tnachen@apache.org>
Authored: Fri Dec 25 16:24:43 2015 -0800
Committer: Timothy Chen <tnachen@apache.org>
Committed: Wed Dec 30 13:19:15 2015 -0800

----------------------------------------------------------------------
 docs/configuration.md                           | 26 +++--------------
 .../provisioner/docker/registry_client.hpp      |  2 +-
 .../provisioner/docker/registry_puller.cpp      | 30 ++++++--------------
 src/slave/flags.cpp                             | 18 +++---------
 src/slave/flags.hpp                             |  2 --
 .../containerizer/provisioner_docker_tests.cpp  | 15 ++++------
 6 files changed, 23 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b54d9ee0/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index 29fdb03..a33e802 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1016,17 +1016,8 @@ file:///path/to/file (where file contains one of the above)</code></pre>
       --docker_auth_server=VALUE
     </td>
     <td>
-      Docker authentication server.
-      (default: auth.docker.io)
-    </td>
-  </tr>
-  <tr>
-    <td>
-      --docker_auth_server_port=VALUE
-    </td>
-    <td>
-      Docker authentication server port.
-      (default: 443)
+      Docker authentication server used to authenticate with Docker registry
+      (default: https://auth.docker.io)
     </td>
   </tr>
   <tr>
@@ -1061,17 +1052,8 @@ file:///path/to/file (where file contains one of the above)</code></pre>
       --docker_registry=VALUE
     </td>
     <td>
-      Default Docker image registry server host.
-      (default: registry-1.docker.io)
-    </td>
-  </tr>
-  <tr>
-    <td>
-      --docker_registry_port=VALUE
-    </td>
-    <td>
-      Default Docker registry server port.
-      (default: 443)
+      Default Docker image registry server.
+      (default: https://registry-1.docker.io)
     </td>
   </tr>
   <tr>

http://git-wip-us.apache.org/repos/asf/mesos/blob/b54d9ee0/src/slave/containerizer/mesos/provisioner/docker/registry_client.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/docker/registry_client.hpp b/src/slave/containerizer/mesos/provisioner/docker/registry_client.hpp
index 798431c..e73d4d7 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/registry_client.hpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/registry_client.hpp
@@ -70,7 +70,7 @@ public:
   static Try<process::Owned<RegistryClient>> create(
       const process::http::URL& registryServer,
       const process::http::URL& authorizationServer,
-      const Option<Credentials>& credentials);
+      const Option<Credentials>& credentials = None());
 
   /**
    * Fetches manifest for a repository from the client's remote registry server.

http://git-wip-us.apache.org/repos/asf/mesos/blob/b54d9ee0/src/slave/containerizer/mesos/provisioner/docker/registry_puller.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/docker/registry_puller.cpp b/src/slave/containerizer/mesos/provisioner/docker/registry_puller.cpp
index 7cdb15b..049d46c 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/registry_puller.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/registry_puller.cpp
@@ -141,33 +141,19 @@ Try<Owned<RegistryPullerProcess>> RegistryPullerProcess::create(
         flags.docker_puller_timeout_secs);
   }
 
-  auto getPort = [](
-      const string& stringVal) -> Try<uint16_t> {
-    Result<uint16_t> port = numify<uint16_t>(stringVal);
-    if (port.isError()) {
-      return Error("Failed to parse '" + stringVal + "' as port");
-    }
-
-    return port.get();
-  };
-
-  // TODO(jojy): Maybe do a nslookup/tcp dial of these servers.
-  Try<uint16_t> registryPort = getPort(flags.docker_registry_port);
-  if (registryPort.isError()) {
-    return Error("Failed to parse registry port: " + registryPort.error());
+  Try<http::URL> registryUrl = http::URL::parse(flags.docker_registry);
+  if (registryUrl.isError()) {
+    return Error("Failed to parse Docker registry: " + registryUrl.error());
   }
 
-  Try<uint16_t> authServerPort = getPort(flags.docker_auth_server_port);
-  if (authServerPort.isError()) {
-    return Error(
-        "Failed to parse authentication server port: " +
-        authServerPort.error());
+  Try<http::URL> authServerUrl = http::URL::parse(flags.docker_auth_server);
+  if (authServerUrl.isError()) {
+    return Error("Failed to parse Docker auth server: " +
+                 authServerUrl.error());
   }
 
   Try<Owned<RegistryClient>> registry = RegistryClient::create(
-      http::URL("https", flags.docker_registry, registryPort.get()),
-      http::URL("https", flags.docker_auth_server, authServerPort.get()),
-      None());
+      registryUrl.get(), authServerUrl.get());
 
   if (registry.isError()) {
     return Error("Failed to create registry client: " + registry.error());

http://git-wip-us.apache.org/repos/asf/mesos/blob/b54d9ee0/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 5daeecd..a60d3c8 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -120,13 +120,8 @@ mesos::internal::slave::Flags::Flags()
 
   add(&Flags::docker_auth_server,
       "docker_auth_server",
-      "Docker authentication server",
-      "auth.docker.io");
-
-  add(&Flags::docker_auth_server_port,
-      "docker_auth_server_port",
-      "Docker authentication server port",
-      "443");
+      "Docker authentication server used to authenticate with Docker registry",
+      "https://auth.docker.io");
 
   add(&Flags::docker_local_archives_dir,
       "docker_local_archives_dir",
@@ -145,13 +140,8 @@ mesos::internal::slave::Flags::Flags()
 
   add(&Flags::docker_registry,
       "docker_registry",
-      "Default Docker image registry server host",
-      "registry-1.docker.io");
-
-  add(&Flags::docker_registry_port,
-      "docker_registry_port",
-      "Default Docker registry server port",
-      "443");
+      "Default Docker image registry server",
+      "https://registry-1.docker.io");
 
   add(&Flags::docker_store_dir,
       "docker_store_dir",

http://git-wip-us.apache.org/repos/asf/mesos/blob/b54d9ee0/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index 980f05b..2b2679c 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -52,12 +52,10 @@ public:
   std::string appc_store_dir;
 
   std::string docker_auth_server;
-  std::string docker_auth_server_port;
   std::string docker_local_archives_dir;
   std::string docker_puller;
   std::string docker_puller_timeout_secs;
   std::string docker_registry;
-  std::string docker_registry_port;
   std::string docker_store_dir;
 
   std::string default_role;

http://git-wip-us.apache.org/repos/asf/mesos/blob/b54d9ee0/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp b/src/tests/containerizer/provisioner_docker_tests.cpp
index bb142f5..d51f342 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -72,7 +72,6 @@ namespace mesos {
 namespace internal {
 namespace tests {
 
-
 TEST(DockerUtilsTest, ParseImageName)
 {
   slave::docker::Image::Name name;
@@ -1131,20 +1130,18 @@ TEST_F(RegistryClientTest, SimpleRegistryPuller)
   Future<Socket> blobServerAcceptSock = blobServer.get().accept();
 
   Flags flags;
-  flags.docker_registry = server.get().address().get().hostname().get();
-  flags.docker_registry_port = stringify(server.get().address().get().port);
-  flags.docker_auth_server = server.get().address().get().hostname().get();
-  flags.docker_auth_server_port = stringify(server.get().address().get().port);
+  process::network::Address address = server.get().address().get();
+  const string url = "https://" + address.hostname().get() + ":" +
+                     stringify(address.port);
+  flags.docker_registry = url;
+  flags.docker_auth_server = url;
 
   Try<Owned<Puller>> registryPuller = RegistryPuller::create(flags);
-
   ASSERT_SOME(registryPuller);
 
   const Path registryPullerPath(os::getcwd());
 
-  Try<slave::docker::Image::Name> imageName =
-    parseImageName("busybox");
-
+  Try<slave::docker::Image::Name> imageName = parseImageName("busybox");
   ASSERT_SOME(imageName);
 
   Future<list<pair<string, string>>> registryPullerFuture =


Mime
View raw message