rewiring codex node starter

This commit is contained in:
benbierens 2023-04-12 16:12:04 +02:00
parent 68d089874d
commit bb81d7f037
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
5 changed files with 17 additions and 22 deletions

View File

@ -1,6 +1,4 @@
using KubernetesWorkflow; namespace DistTestCore.Codex
namespace DistTestCore.Codex
{ {
public class CodexStartupConfig public class CodexStartupConfig
{ {
@ -8,5 +6,8 @@ namespace DistTestCore.Codex
public CodexLogLevel? LogLevel { get; set; } public CodexLogLevel? LogLevel { get; set; }
public ByteSize? StorageQuota { get; set; } public ByteSize? StorageQuota { get; set; }
public bool MetricsEnabled { get; set; } public bool MetricsEnabled { get; set; }
//public IOnlineCodexNode? BootstrapNode { get; private set; }
//public MarketplaceInitialConfig? MarketplaceConfig { get; private set; }
} }
} }

View File

@ -1,4 +1,5 @@
using DistTestCore.Codex; using DistTestCore.Codex;
using KubernetesWorkflow;
namespace DistTestCore namespace DistTestCore
{ {
@ -12,32 +13,17 @@ namespace DistTestCore
//ICodexSetupConfig EnableMarketplace(int initialBalance); //ICodexSetupConfig EnableMarketplace(int initialBalance);
ICodexNodeGroup BringOnline(); ICodexNodeGroup BringOnline();
} }
public enum Location public class CodexSetupConfig : CodexStartupConfig, ICodexSetupConfig
{
Unspecified,
BensLaptop,
BensOldGamingMachine,
}
public class CodexSetupConfig : ICodexSetupConfig
{ {
private readonly CodexStarter starter; private readonly CodexStarter starter;
public int NumberOfNodes { get; } 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) public CodexSetupConfig(CodexStarter starter, int numberOfNodes)
{ {
this.starter = starter; this.starter = starter;
NumberOfNodes = numberOfNodes; NumberOfNodes = numberOfNodes;
Location = Location.Unspecified;
MetricsEnabled = false;
} }
public ICodexNodeGroup BringOnline() public ICodexNodeGroup BringOnline()

View File

@ -1,4 +1,5 @@
using KubernetesWorkflow; using DistTestCore.Codex;
using KubernetesWorkflow;
using Logging; using Logging;
namespace DistTestCore namespace DistTestCore
@ -14,7 +15,13 @@ namespace DistTestCore
public ICodexNodeGroup BringOnline(CodexSetupConfig codexSetupConfig) 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() public void DeleteAllResources()

View File

@ -16,5 +16,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\KubernetesWorkflow\KubernetesWorkflow.csproj" /> <ProjectReference Include="..\KubernetesWorkflow\KubernetesWorkflow.csproj" />
<ProjectReference Include="..\Logging\Logging.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -11,7 +11,7 @@
public T Get<T>() public T Get<T>()
{ {
var match = configs.Single(c => c.GetType() == typeof(T)); var match = configs.Single(c => typeof(T).IsAssignableFrom(c.GetType()));
return (T)match; return (T)match;
} }
} }