diff --git a/CodexNetDeployer/Configuration.cs b/CodexNetDeployer/Configuration.cs index 0a3504c..3e5346c 100644 --- a/CodexNetDeployer/Configuration.cs +++ b/CodexNetDeployer/Configuration.cs @@ -1,4 +1,5 @@ using DistTestCore; +using DistTestCore.Codex; namespace CodexNetDeployer { @@ -12,7 +13,7 @@ namespace CodexNetDeployer string kubeNamespace, int? numberOfCodexNodes, int? storageQuota, - string codexLogLevel, + CodexLogLevel codexLogLevel, TestRunnerLocation runnerLocation) { CodexImage = codexImage; @@ -33,7 +34,7 @@ namespace CodexNetDeployer public string KubeNamespace { get; } public int? NumberOfCodexNodes { get; } public int? StorageQuota { get; } - public string CodexLogLevel { get; } + public CodexLogLevel CodexLogLevel { get; } public TestRunnerLocation RunnerLocation { get; } public void PrintConfig() diff --git a/CodexNetDeployer/Deployer.cs b/CodexNetDeployer/Deployer.cs index 0683e5c..03f428a 100644 --- a/CodexNetDeployer/Deployer.cs +++ b/CodexNetDeployer/Deployer.cs @@ -1,6 +1,4 @@ using DistTestCore; -using DistTestCore.Codex; -using Utils; namespace CodexNetDeployer { @@ -14,6 +12,25 @@ namespace CodexNetDeployer } public void Deploy() + { + Log("Initializing..."); + var starter = CreateStarter(); + + Log("Preparing configuration..."); + var setup = new CodexSetup(config.NumberOfCodexNodes!.Value, config.CodexLogLevel); + + Log("Creating resources..."); + var group = (CodexNodeGroup) starter.BringOnline(setup); + + var containers = group.Containers; + foreach (var container in containers.Containers) + { + var pod = container.Pod.PodInfo; + Log($"Container '{container.Name}' online. Pod: '{pod.Name}@{pod.Ip}' on '{pod.K8SNodeName}'."); + } + } + + private CodexStarter CreateStarter() { var log = new NullLog(); var lifecycleConfig = new DistTestCore.Configuration @@ -22,7 +39,7 @@ namespace CodexNetDeployer logPath: "null", logDebug: false, dataFilesPath: "notUsed", - codexLogLevel: ParseEnum.Parse(config.CodexLogLevel), + codexLogLevel: config.CodexLogLevel, runnerLocation: config.RunnerLocation ); @@ -35,7 +52,12 @@ namespace CodexNetDeployer var lifecycle = new TestLifecycle(log, lifecycleConfig, timeset); var workflowCreator = new KubernetesWorkflow.WorkflowCreator(log, kubeConfig); - var starter = new CodexStarter(lifecycle, workflowCreator); + return new CodexStarter(lifecycle, workflowCreator); + } + + private void Log(string msg) + { + Console.WriteLine(msg); } } } diff --git a/CodexNetDeployer/Program.cs b/CodexNetDeployer/Program.cs index 582d2a1..6f61fc7 100644 --- a/CodexNetDeployer/Program.cs +++ b/CodexNetDeployer/Program.cs @@ -2,6 +2,7 @@ using DistTestCore; using DistTestCore.Codex; using DistTestCore.Marketplace; +using Utils; using Configuration = CodexNetDeployer.Configuration; public class Program @@ -33,7 +34,7 @@ public class Program kubeNamespace: argOrVar.Get(ArgOrVar.KubeNamespace), numberOfCodexNodes: argOrVar.GetInt(ArgOrVar.NumberOfCodexNodes), storageQuota: argOrVar.GetInt(ArgOrVar.StorageQuota), - codexLogLevel: argOrVar.Get(ArgOrVar.LogLevel), + codexLogLevel: ParseEnum.Parse(argOrVar.Get(ArgOrVar.LogLevel, nameof(CodexLogLevel.Debug))), runnerLocation: location );