MCPcopy Create free account
hub / github.com/apache/mesos / resolveSecrets

Method resolveSecrets

src/csi/v0_volume_manager.cpp:1282–1319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1280
1281
1282Future<Map<string, string>> VolumeManagerProcess::resolveSecrets(
1283 const Map<string, Secret>& secrets)
1284{
1285 if (!secretResolver) {
1286 return Failure(
1287 "CSI volume included secrets but the agent was not initialized with "
1288 "a secret resolver");
1289 }
1290
1291 // This `futures` is used below with `process::collect()` to synchronize the
1292 // continuation. Within the continuation itself, we need to have the
1293 // key:value mapping of the secrets, so we use `resolvedSecrets` instead.
1294 vector<Future<Secret::Value>> futures;
1295 hashmap<string, Future<Secret::Value>> resolvedSecrets;
1296
1297 for (auto it = secrets.begin(); it != secrets.end(); ++it) {
1298 Future<Secret::Value> pendingSecret = secretResolver->resolve(it->second);
1299
1300 futures.push_back(pendingSecret);
1301 resolvedSecrets.insert({it->first, pendingSecret});
1302 }
1303
1304 return process::collect(futures)
1305 .then([=]() {
1306 Map<string, string> result;
1307
1308 foreachpair (
1309 const string& key,
1310 const Future<Secret::Value>& secret,
1311 resolvedSecrets) {
1312 CHECK(secret.isReady());
1313
1314 result.insert({key, secret->data()});
1315 }
1316
1317 return result;
1318 });
1319}
1320
1321
1322VolumeManager::VolumeManager(

Callers

nothing calls this directly

Calls 7

FailureClass · 0.85
collectFunction · 0.85
insertMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
resolveMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected