From d9665f3e793fae1f111085abae7843e364261e9e Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 23 Jun 2023 08:57:31 +0200 Subject: [PATCH 1/2] Successful remote test deploy. Adds option to remove random guid from k8s namespace. --- CodexNetDeployer/Deployer.cs | 2 +- KubernetesWorkflow/WorkflowCreator.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CodexNetDeployer/Deployer.cs b/CodexNetDeployer/Deployer.cs index a5aa56b..2870e4d 100644 --- a/CodexNetDeployer/Deployer.cs +++ b/CodexNetDeployer/Deployer.cs @@ -66,7 +66,7 @@ namespace CodexNetDeployer operationTimeout: timeset.K8sOperationTimeout(), retryDelay: timeset.WaitForK8sServiceDelay()); - var workflowCreator = new WorkflowCreator(log, kubeConfig); + var workflowCreator = new WorkflowCreator(log, kubeConfig, testNamespacePostfix: string.Empty); var lifecycle = new TestLifecycle(log, lifecycleConfig, timeset, workflowCreator); return (workflowCreator, lifecycle); diff --git a/KubernetesWorkflow/WorkflowCreator.cs b/KubernetesWorkflow/WorkflowCreator.cs index d03dca7..ea1775a 100644 --- a/KubernetesWorkflow/WorkflowCreator.cs +++ b/KubernetesWorkflow/WorkflowCreator.cs @@ -13,10 +13,15 @@ namespace KubernetesWorkflow private readonly string testNamespace; public WorkflowCreator(BaseLog log, Configuration configuration) + : this(log, configuration, Guid.NewGuid().ToString().ToLowerInvariant()) + { + } + + public WorkflowCreator(BaseLog log, Configuration configuration, string testNamespacePostfix) { cluster = new K8sCluster(configuration); this.log = log; - testNamespace = Guid.NewGuid().ToString().ToLowerInvariant(); + testNamespace = testNamespacePostfix; } public StartupWorkflow CreateWorkflow() From 2e09c9135e460c461208fa91ee21723dd2ce2345 Mon Sep 17 00:00:00 2001 From: benbierens Date: Fri, 23 Jun 2023 09:08:18 +0200 Subject: [PATCH 2/2] Adds metadata about codex deployment --- CodexNetDeployer/Deployer.cs | 15 +++++++++++++- DistTestCore/Codex/CodexDeployment.cs | 30 ++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/CodexNetDeployer/Deployer.cs b/CodexNetDeployer/Deployer.cs index 2870e4d..3e476b4 100644 --- a/CodexNetDeployer/Deployer.cs +++ b/CodexNetDeployer/Deployer.cs @@ -45,7 +45,7 @@ namespace CodexNetDeployer if (container != null) codexContainers.Add(container); } - return new CodexDeployment(gethResults, codexContainers.ToArray()); + return new CodexDeployment(gethResults, codexContainers.ToArray(), CreateMetadata()); } private (WorkflowCreator, TestLifecycle) CreateFacilities() @@ -72,6 +72,19 @@ namespace CodexNetDeployer return (workflowCreator, lifecycle); } + private DeploymentMetadata CreateMetadata() + { + return new DeploymentMetadata( + codexImage: config.CodexImage, + gethImage: config.GethImage, + contractsImage: config.ContractsImage, + kubeNamespace: config.KubeNamespace, + numberOfCodexNodes: config.NumberOfCodexNodes!.Value, + numberOfValidators: config.NumberOfValidators!.Value, + storageQuotaMB: config.StorageQuota!.Value, + codexLogLevel: config.CodexLogLevel); + } + private void Log(string msg) { Console.WriteLine(msg); diff --git a/DistTestCore/Codex/CodexDeployment.cs b/DistTestCore/Codex/CodexDeployment.cs index f86ad31..cc4246e 100644 --- a/DistTestCore/Codex/CodexDeployment.cs +++ b/DistTestCore/Codex/CodexDeployment.cs @@ -5,13 +5,41 @@ namespace DistTestCore.Codex { public class CodexDeployment { - public CodexDeployment(GethStartResult gethStartResult, RunningContainer[] codexContainers) + public CodexDeployment(GethStartResult gethStartResult, RunningContainer[] codexContainers, DeploymentMetadata metadata) { GethStartResult = gethStartResult; CodexContainers = codexContainers; + Metadata = metadata; } public GethStartResult GethStartResult { get; } public RunningContainer[] CodexContainers { get; } + public DeploymentMetadata Metadata { get; } + } + + public class DeploymentMetadata + { + public DeploymentMetadata(string codexImage, string gethImage, string contractsImage, string kubeNamespace, int numberOfCodexNodes, int numberOfValidators, int storageQuotaMB, CodexLogLevel codexLogLevel) + { + DeployDateTimeUtc = DateTime.UtcNow; + CodexImage = codexImage; + GethImage = gethImage; + ContractsImage = contractsImage; + KubeNamespace = kubeNamespace; + NumberOfCodexNodes = numberOfCodexNodes; + NumberOfValidators = numberOfValidators; + StorageQuotaMB = storageQuotaMB; + CodexLogLevel = codexLogLevel; + } + + public string CodexImage { get; } + public DateTime DeployDateTimeUtc { get; } + public string GethImage { get; } + public string ContractsImage { get; } + public string KubeNamespace { get; } + public int NumberOfCodexNodes { get; } + public int NumberOfValidators { get; } + public int StorageQuotaMB { get; } + public CodexLogLevel CodexLogLevel { get; } } }