From bb81d7f0377d80d05d1904fd0f924282dc5adeb1 Mon Sep 17 00:00:00 2001 From: benbierens Date: Wed, 12 Apr 2023 16:12:04 +0200 Subject: [PATCH] rewiring codex node starter --- DistTestCore/Codex/CodexStartupConfig.cs | 7 ++++--- DistTestCore/CodexSetupConfig.cs | 20 +++----------------- DistTestCore/CodexStarter.cs | 9 ++++++++- DistTestCore/DistTestCore.csproj | 1 + KubernetesWorkflow/StartupConfig.cs | 2 +- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/DistTestCore/Codex/CodexStartupConfig.cs b/DistTestCore/Codex/CodexStartupConfig.cs index fdbffcf..a978b5c 100644 --- a/DistTestCore/Codex/CodexStartupConfig.cs +++ b/DistTestCore/Codex/CodexStartupConfig.cs @@ -1,6 +1,4 @@ -using KubernetesWorkflow; - -namespace DistTestCore.Codex +namespace DistTestCore.Codex { public class CodexStartupConfig { @@ -8,5 +6,8 @@ namespace DistTestCore.Codex public CodexLogLevel? LogLevel { get; set; } public ByteSize? StorageQuota { get; set; } public bool MetricsEnabled { get; set; } + + //public IOnlineCodexNode? BootstrapNode { get; private set; } + //public MarketplaceInitialConfig? MarketplaceConfig { get; private set; } } } diff --git a/DistTestCore/CodexSetupConfig.cs b/DistTestCore/CodexSetupConfig.cs index 1f1a632..c7dfef8 100644 --- a/DistTestCore/CodexSetupConfig.cs +++ b/DistTestCore/CodexSetupConfig.cs @@ -1,4 +1,5 @@ using DistTestCore.Codex; +using KubernetesWorkflow; namespace DistTestCore { @@ -12,32 +13,17 @@ namespace DistTestCore //ICodexSetupConfig EnableMarketplace(int initialBalance); ICodexNodeGroup BringOnline(); } - - public enum Location - { - Unspecified, - BensLaptop, - BensOldGamingMachine, - } - - public class CodexSetupConfig : ICodexSetupConfig + + public class CodexSetupConfig : CodexStartupConfig, ICodexSetupConfig { private readonly CodexStarter starter; public int NumberOfNodes { get; } - public Location Location { get; private set; } - public CodexLogLevel? LogLevel { get; private set; } - //public IOnlineCodexNode? BootstrapNode { get; private set; } - public ByteSize? StorageQuota { get; private set; } - public bool MetricsEnabled { get; private set; } - //public MarketplaceInitialConfig? MarketplaceConfig { get; private set; } public CodexSetupConfig(CodexStarter starter, int numberOfNodes) { this.starter = starter; NumberOfNodes = numberOfNodes; - Location = Location.Unspecified; - MetricsEnabled = false; } public ICodexNodeGroup BringOnline() diff --git a/DistTestCore/CodexStarter.cs b/DistTestCore/CodexStarter.cs index f295d0a..0222925 100644 --- a/DistTestCore/CodexStarter.cs +++ b/DistTestCore/CodexStarter.cs @@ -1,4 +1,5 @@ -using KubernetesWorkflow; +using DistTestCore.Codex; +using KubernetesWorkflow; using Logging; namespace DistTestCore @@ -14,7 +15,13 @@ namespace DistTestCore public ICodexNodeGroup BringOnline(CodexSetupConfig codexSetupConfig) { + var workflow = workflowCreator.CreateWorkflow(); + var startupConfig = new StartupConfig(); + startupConfig.Add(codexSetupConfig); + var runningContainers = workflow.Start(codexSetupConfig.NumberOfNodes, codexSetupConfig.Location, new CodexContainerRecipe(), startupConfig); + + // create access objects. Easy, right? } public void DeleteAllResources() diff --git a/DistTestCore/DistTestCore.csproj b/DistTestCore/DistTestCore.csproj index ae8e964..c57463d 100644 --- a/DistTestCore/DistTestCore.csproj +++ b/DistTestCore/DistTestCore.csproj @@ -16,5 +16,6 @@ + diff --git a/KubernetesWorkflow/StartupConfig.cs b/KubernetesWorkflow/StartupConfig.cs index 7c13347..406cea9 100644 --- a/KubernetesWorkflow/StartupConfig.cs +++ b/KubernetesWorkflow/StartupConfig.cs @@ -11,7 +11,7 @@ public T Get() { - var match = configs.Single(c => c.GetType() == typeof(T)); + var match = configs.Single(c => typeof(T).IsAssignableFrom(c.GetType())); return (T)match; } }