Gives deployments a name.

This commit is contained in:
benbierens 2023-10-23 10:19:52 +02:00
parent ad70394333
commit e11a7d1600
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
7 changed files with 19 additions and 3 deletions

View File

@ -24,8 +24,9 @@ namespace CodexPlugin
public class DeploymentMetadata public class DeploymentMetadata
{ {
public DeploymentMetadata(DateTime startUtc, DateTime finishedUtc, string kubeNamespace, int numberOfCodexNodes, int numberOfValidators, int storageQuotaMB, CodexLogLevel codexLogLevel, int initialTestTokens, int minPrice, int maxCollateral, int maxDuration, int blockTTL, int blockMI, int blockMN) public DeploymentMetadata(string name, DateTime startUtc, DateTime finishedUtc, string kubeNamespace, int numberOfCodexNodes, int numberOfValidators, int storageQuotaMB, CodexLogLevel codexLogLevel, int initialTestTokens, int minPrice, int maxCollateral, int maxDuration, int blockTTL, int blockMI, int blockMN)
{ {
Name = name;
StartUtc = startUtc; StartUtc = startUtc;
FinishedUtc = finishedUtc; FinishedUtc = finishedUtc;
KubeNamespace = kubeNamespace; KubeNamespace = kubeNamespace;
@ -42,6 +43,7 @@ namespace CodexPlugin
BlockMN = blockMN; BlockMN = blockMN;
} }
public string Name { get; }
public DateTime StartUtc { get; } public DateTime StartUtc { get; }
public DateTime FinishedUtc { get; } public DateTime FinishedUtc { get; }
public string KubeNamespace { get; } public string KubeNamespace { get; }

View File

@ -9,6 +9,7 @@ cd ../../Tools/CodexNetDeployer
for i in $( seq 0 $replication) for i in $( seq 0 $replication)
do do
dotnet run \ dotnet run \
--deploy-name=codex-continuous-$name-$i \
--kube-config=/opt/kubeconfig.yaml \ --kube-config=/opt/kubeconfig.yaml \
--kube-namespace=codex-continuous-$name-tests-$i \ --kube-namespace=codex-continuous-$name-tests-$i \
--deploy-file=codex-deployment-$name-$i.json \ --deploy-file=codex-deployment-$name-$i.json \

View File

@ -1,4 +1,5 @@
using Discord.WebSocket; using CodexPlugin;
using Discord.WebSocket;
namespace BiblioTech.Commands namespace BiblioTech.Commands
{ {
@ -25,7 +26,13 @@ namespace BiblioTech.Commands
return; return;
} }
await command.FollowupAsync($"Deployments: {string.Join(", ", deployments.Select(d => d.Metadata.StartUtc.ToString("o")))}"); await command.FollowupAsync($"Deployments: {string.Join(", ", deployments.Select(FormatDeployment))}");
}
private string FormatDeployment(CodexDeployment deployment)
{
var m = deployment.Metadata;
return $"{m.Name} ({m.StartUtc.ToString("o")})";
} }
} }
} }

View File

@ -4,3 +4,4 @@ services:
environment: environment:
- TOKEN=tokenplz - TOKEN=tokenplz
- SERVERNAME=ThatBen's server - SERVERNAME=ThatBen's server
- ADMINROLE=adminers

View File

@ -8,6 +8,9 @@ namespace CodexNetDeployer
public const int SecondsIn1Day = 24 * 60 * 60; public const int SecondsIn1Day = 24 * 60 * 60;
public const int TenMinutes = 10 * 60; public const int TenMinutes = 10 * 60;
[Uniform("deploy-name", "nm", "DEPLOYNAME", false, "Name of the deployment. (optional)")]
public string DeploymentName { get; set; } = "unnamed";
[Uniform("kube-config", "kc", "KUBECONFIG", false, "Path to Kubeconfig file. Use 'null' (default) to use local cluster.")] [Uniform("kube-config", "kc", "KUBECONFIG", false, "Path to Kubeconfig file. Use 'null' (default) to use local cluster.")]
public string KubeConfigFile { get; set; } = "null"; public string KubeConfigFile { get; set; } = "null";

View File

@ -151,6 +151,7 @@ namespace CodexNetDeployer
private DeploymentMetadata CreateMetadata(DateTime startUtc) private DeploymentMetadata CreateMetadata(DateTime startUtc)
{ {
return new DeploymentMetadata( return new DeploymentMetadata(
name: config.DeploymentName,
startUtc: startUtc, startUtc: startUtc,
finishedUtc: DateTime.UtcNow, finishedUtc: DateTime.UtcNow,
kubeNamespace: config.KubeNamespace, kubeNamespace: config.KubeNamespace,

View File

@ -1,4 +1,5 @@
dotnet run \ dotnet run \
--deploy-name=codex-continuous-test-deployment \
--kube-config=/opt/kubeconfig.yaml \ --kube-config=/opt/kubeconfig.yaml \
--kube-namespace=codex-continuous-tests \ --kube-namespace=codex-continuous-tests \
--deploy-file=codex-deployment.json \ --deploy-file=codex-deployment.json \