| 500 | |
| 501 | |
| 502 | Try<Owned<CSIServer>> CSIServer::create( |
| 503 | const Flags& flags, |
| 504 | const process::http::URL& agentUrl, |
| 505 | SecretGenerator* secretGenerator, |
| 506 | SecretResolver* secretResolver) |
| 507 | { |
| 508 | if (!strings::contains(flags.isolation, "volume/csi")) { |
| 509 | return Error("Missing required isolator 'volume/csi'"); |
| 510 | } |
| 511 | |
| 512 | if (flags.csi_plugin_config_dir.isNone() || |
| 513 | flags.csi_plugin_config_dir->empty()) { |
| 514 | return Error("Missing required '--csi_plugin_config_dir' flag"); |
| 515 | } |
| 516 | |
| 517 | if (!os::exists(flags.csi_plugin_config_dir.get())) { |
| 518 | return Error( |
| 519 | "The CSI plugin configuration directory '" + |
| 520 | flags.csi_plugin_config_dir.get() + "' does not exist"); |
| 521 | } |
| 522 | |
| 523 | return new CSIServer( |
| 524 | agentUrl, |
| 525 | slave::paths::getCsiRootDir(flags.work_dir), |
| 526 | flags.csi_plugin_config_dir.get(), |
| 527 | secretGenerator, |
| 528 | secretResolver); |
| 529 | } |
| 530 | |
| 531 | |
| 532 | Future<Nothing> CSIServer::start(const SlaveID& agentId) |