From 7fdca9ffdb17e350d5362913131a5c041fb7afdf Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 22 Jun 2023 10:33:21 +0200 Subject: [PATCH] all wired up --- CodexNetDeployer/Configuration.cs | 5 +++-- CodexNetDeployer/Deployer.cs | 30 ++++++++++++++++++++++++++---- CodexNetDeployer/Program.cs | 3 ++- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/CodexNetDeployer/Configuration.cs b/CodexNetDeployer/Configuration.cs index 0a3504c7..3e5346ca 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 0683e5c4..03f428ad 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 582d2a1a..6f61fc7d 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 );