From 1512bd271605ecb8786aa30b84d997acbe322c43 Mon Sep 17 00:00:00 2001 From: benbierens Date: Tue, 11 Apr 2023 12:17:21 +0200 Subject: [PATCH] This needs cleaning up --- CodexDistTestCore/CodexNodeContainer.cs | 6 +++++- CodexDistTestCore/Config/CodexDockerImage.cs | 14 +++++--------- CodexDistTestCore/K8sManager.cs | 7 +++---- CodexDistTestCore/K8sOperations.cs | 12 ++++++------ 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/CodexDistTestCore/CodexNodeContainer.cs b/CodexDistTestCore/CodexNodeContainer.cs index ccf9b87..71994ab 100644 --- a/CodexDistTestCore/CodexNodeContainer.cs +++ b/CodexDistTestCore/CodexNodeContainer.cs @@ -1,4 +1,6 @@ -namespace CodexDistTestCore +using CodexDistTestCore.Marketplace; + +namespace CodexDistTestCore { public class CodexNodeContainer { @@ -24,6 +26,8 @@ public int ListenPort { get; } public string DataDir { get; } public int MetricsPort { get; } + + public GethCompanionNodeContainer? GethCompanionNodeContainer { get; set; } // :C } public class CodexGroupNumberSource diff --git a/CodexDistTestCore/Config/CodexDockerImage.cs b/CodexDistTestCore/Config/CodexDockerImage.cs index 5855f71..a252a26 100644 --- a/CodexDistTestCore/Config/CodexDockerImage.cs +++ b/CodexDistTestCore/Config/CodexDockerImage.cs @@ -50,16 +50,12 @@ namespace CodexDistTestCore.Config AddVar("METRICS_ADDR", "0.0.0.0"); 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_ACCOUNT -//ETH_DEPLOYMENT + //ETH_PROVIDER + //ETH_ACCOUNT + //ETH_DEPLOYMENT + AddVar("ETH_ACCOUNT", container.GethCompanionNodeContainer!.Account); } } diff --git a/CodexDistTestCore/K8sManager.cs b/CodexDistTestCore/K8sManager.cs index 9686bcc..06bcafb 100644 --- a/CodexDistTestCore/K8sManager.cs +++ b/CodexDistTestCore/K8sManager.cs @@ -35,6 +35,7 @@ namespace CodexDistTestCore if (offline.MarketplaceConfig != null) { group.GethCompanionGroup = marketplaceController.BringOnlineMarketplace(offline); + ConnectMarketplace(group); } K8s(k => k.BringOnline(group, offline)); @@ -43,10 +44,6 @@ namespace CodexDistTestCore { BringOnlineMetrics(group); } - if (offline.MarketplaceConfig != null) - { - ConnectMarketplace(group); - } log.Log($"{group.Describe()} online."); @@ -126,6 +123,8 @@ namespace CodexDistTestCore private void ConnectMarketplace(CodexNodeGroup group, OnlineCodexNode node, GethCompanionNodeContainer container) { + node.Container.GethCompanionNodeContainer = container; // :c + var access = new MarketplaceAccess(this, marketplaceController, log, group, container); access.Initialize(); node.Marketplace = access; diff --git a/CodexDistTestCore/K8sOperations.cs b/CodexDistTestCore/K8sOperations.cs index c0c7234..580829e 100644 --- a/CodexDistTestCore/K8sOperations.cs +++ b/CodexDistTestCore/K8sOperations.cs @@ -292,10 +292,10 @@ namespace CodexDistTestCore }; } - private List CreateDeploymentContainers(CodexNodeGroup online, OfflineCodexNodes offline) + private List CreateDeploymentContainers(CodexNodeGroup group, OfflineCodexNodes offline) { var result = new List(); - var containers = online.GetContainers(); + var containers = group.GetContainers(); foreach (var container in containers) { result.Add(new V1Container @@ -317,11 +317,11 @@ namespace CodexDistTestCore return result; } - private void DeleteDeployment(CodexNodeGroup online) + private void DeleteDeployment(CodexNodeGroup group) { - if (online.Deployment == null) return; - client.DeleteNamespacedDeployment(online.Deployment.Name(), K8sNamespace); - online.Deployment = null; + if (group.Deployment == null) return; + client.DeleteNamespacedDeployment(group.Deployment.Name(), K8sNamespace); + group.Deployment = null; } private void CreatePrometheusDeployment(K8sPrometheusSpecs spec)