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
{
@ -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; }
}
}

View File

@ -1,4 +1,5 @@
using DistTestCore.Codex;
using KubernetesWorkflow;
namespace DistTestCore
{
@ -13,31 +14,16 @@ namespace DistTestCore
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()

View File

@ -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()

View File

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

View File

@ -11,7 +11,7 @@
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;
}
}