This needs cleaning up

This commit is contained in:
benbierens 2023-04-11 12:17:21 +02:00
parent d33eb53003
commit 1512bd2716
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
4 changed files with 19 additions and 20 deletions

View File

@ -1,4 +1,6 @@
namespace CodexDistTestCore using CodexDistTestCore.Marketplace;
namespace CodexDistTestCore
{ {
public class CodexNodeContainer public class CodexNodeContainer
{ {
@ -24,6 +26,8 @@
public int ListenPort { get; } public int ListenPort { get; }
public string DataDir { get; } public string DataDir { get; }
public int MetricsPort { get; } public int MetricsPort { get; }
public GethCompanionNodeContainer? GethCompanionNodeContainer { get; set; } // :C
} }
public class CodexGroupNumberSource public class CodexGroupNumberSource

View File

@ -50,16 +50,12 @@ namespace CodexDistTestCore.Config
AddVar("METRICS_ADDR", "0.0.0.0"); AddVar("METRICS_ADDR", "0.0.0.0");
AddVar("METRICS_PORT", container.MetricsPort.ToString()); AddVar("METRICS_PORT", container.MetricsPort.ToString());
} }
if (container.GethCompanionNodeContainer != null) if (node.MarketplaceConfig != null)
{ {
// well, darn: To get the account here, the geth companion needs to have been started and account string fetched.
// but the codex node and geth companion node are in the same pod. so they start at the same time.
// so we cannot start the codex node with the correct account string at the same time as we start the geth node that
// is supposed to generate that string.
// begin rework: Separate pod for geth companion node.
//ETH_PROVIDER //ETH_PROVIDER
//ETH_ACCOUNT //ETH_ACCOUNT
//ETH_DEPLOYMENT //ETH_DEPLOYMENT
AddVar("ETH_ACCOUNT", container.GethCompanionNodeContainer!.Account);
} }
} }

View File

@ -35,6 +35,7 @@ namespace CodexDistTestCore
if (offline.MarketplaceConfig != null) if (offline.MarketplaceConfig != null)
{ {
group.GethCompanionGroup = marketplaceController.BringOnlineMarketplace(offline); group.GethCompanionGroup = marketplaceController.BringOnlineMarketplace(offline);
ConnectMarketplace(group);
} }
K8s(k => k.BringOnline(group, offline)); K8s(k => k.BringOnline(group, offline));
@ -43,10 +44,6 @@ namespace CodexDistTestCore
{ {
BringOnlineMetrics(group); BringOnlineMetrics(group);
} }
if (offline.MarketplaceConfig != null)
{
ConnectMarketplace(group);
}
log.Log($"{group.Describe()} online."); log.Log($"{group.Describe()} online.");
@ -126,6 +123,8 @@ namespace CodexDistTestCore
private void ConnectMarketplace(CodexNodeGroup group, OnlineCodexNode node, GethCompanionNodeContainer container) private void ConnectMarketplace(CodexNodeGroup group, OnlineCodexNode node, GethCompanionNodeContainer container)
{ {
node.Container.GethCompanionNodeContainer = container; // :c
var access = new MarketplaceAccess(this, marketplaceController, log, group, container); var access = new MarketplaceAccess(this, marketplaceController, log, group, container);
access.Initialize(); access.Initialize();
node.Marketplace = access; node.Marketplace = access;

View File

@ -292,10 +292,10 @@ namespace CodexDistTestCore
}; };
} }
private List<V1Container> CreateDeploymentContainers(CodexNodeGroup online, OfflineCodexNodes offline) private List<V1Container> CreateDeploymentContainers(CodexNodeGroup group, OfflineCodexNodes offline)
{ {
var result = new List<V1Container>(); var result = new List<V1Container>();
var containers = online.GetContainers(); var containers = group.GetContainers();
foreach (var container in containers) foreach (var container in containers)
{ {
result.Add(new V1Container result.Add(new V1Container
@ -317,11 +317,11 @@ namespace CodexDistTestCore
return result; return result;
} }
private void DeleteDeployment(CodexNodeGroup online) private void DeleteDeployment(CodexNodeGroup group)
{ {
if (online.Deployment == null) return; if (group.Deployment == null) return;
client.DeleteNamespacedDeployment(online.Deployment.Name(), K8sNamespace); client.DeleteNamespacedDeployment(group.Deployment.Name(), K8sNamespace);
online.Deployment = null; group.Deployment = null;
} }
private void CreatePrometheusDeployment(K8sPrometheusSpecs spec) private void CreatePrometheusDeployment(K8sPrometheusSpecs spec)