You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2017/05/24 17:05:44 UTC
[06/10] mesos git commit: Implemented resolving an image secret in
registry puller.
Implemented resolving an image secret in registry puller.
Review: https://reviews.apache.org/r/59014
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/429eca05
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/429eca05
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/429eca05
Branch: refs/heads/master
Commit: 429eca054aed720b14ace059de1df3c7bcc774cf
Parents: 7ca46e2
Author: Gilbert Song <so...@gmail.com>
Authored: Wed May 3 15:46:59 2017 -0700
Committer: Gilbert Song <so...@gmail.com>
Committed: Thu May 25 01:04:30 2017 +0800
----------------------------------------------------------------------
.../provisioner/docker/registry_puller.cpp | 38 ++++++++++++++++----
1 file changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/429eca05/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 1a724f2..f14b4a5 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/registry_puller.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/registry_puller.cpp
@@ -77,9 +77,15 @@ private:
Future<vector<string>> _pull(
const spec::ImageReference& reference,
const string& directory,
- const string& backend);
+ const string& backend,
+ const Option<Secret::Value>& config = None());
Future<vector<string>> __pull(
+ const spec::ImageReference& reference,
+ const string& directory,
+ const string& backend);
+
+ Future<vector<string>> ___pull(
const spec::ImageReference& reference,
const string& directory,
const spec::v2::ImageManifest& manifest,
@@ -210,11 +216,31 @@ static spec::ImageReference normalize(
Future<vector<string>> RegistryPullerProcess::pull(
- const spec::ImageReference& _reference,
+ const spec::ImageReference& reference,
const string& directory,
const string& backend,
const Option<Secret>& config)
{
+ if (config.isNone()) {
+ return _pull(reference, directory, backend);
+ }
+
+ return secretResolver->resolve(config.get())
+ .then(defer(self(),
+ &Self::_pull,
+ reference,
+ directory,
+ backend,
+ lambda::_1));
+}
+
+
+Future<vector<string>> RegistryPullerProcess::_pull(
+ const spec::ImageReference& _reference,
+ const string& directory,
+ const string& backend,
+ const Option<Secret::Value>& config)
+{
spec::ImageReference reference = normalize(_reference, defaultRegistryUrl);
URI manifestUri;
@@ -261,11 +287,11 @@ Future<vector<string>> RegistryPullerProcess::pull(
<< "' to '" << directory << "'";
return fetcher->fetch(manifestUri, directory)
- .then(defer(self(), &Self::_pull, reference, directory, backend));
+ .then(defer(self(), &Self::__pull, reference, directory, backend));
}
-Future<vector<string>> RegistryPullerProcess::_pull(
+Future<vector<string>> RegistryPullerProcess::__pull(
const spec::ImageReference& reference,
const string& directory,
const string& backend)
@@ -291,7 +317,7 @@ Future<vector<string>> RegistryPullerProcess::_pull(
return fetchBlobs(reference, directory, manifest.get(), backend)
.then(defer(self(),
- &Self::__pull,
+ &Self::___pull,
reference,
directory,
manifest.get(),
@@ -300,7 +326,7 @@ Future<vector<string>> RegistryPullerProcess::_pull(
}
-Future<vector<string>> RegistryPullerProcess::__pull(
+Future<vector<string>> RegistryPullerProcess::___pull(
const spec::ImageReference& reference,
const string& directory,
const spec::v2::ImageManifest& manifest,