56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using k8s.Models;
|
|
|
|
namespace CodexDistTestCore
|
|
{
|
|
public class CodexDockerImage
|
|
{
|
|
public string GetImageTag()
|
|
{
|
|
return "thatbenbierens/nim-codex:sha-b204837";
|
|
}
|
|
|
|
public string GetExpectedImageRevision()
|
|
{
|
|
return "b20483";
|
|
}
|
|
|
|
public List<V1EnvVar> CreateEnvironmentVariables(OfflineCodexNode node)
|
|
{
|
|
var formatter = new EnvFormatter();
|
|
formatter.Create(node);
|
|
return formatter.Result;
|
|
}
|
|
|
|
private class EnvFormatter
|
|
{
|
|
public List<V1EnvVar> Result { get; } = new List<V1EnvVar>();
|
|
|
|
public void Create(OfflineCodexNode node)
|
|
{
|
|
if (node.BootstrapNode != null)
|
|
{
|
|
var debugInfo = node.BootstrapNode.GetDebugInfo();
|
|
AddVar("BOOTSTRAP_SPR", debugInfo.spr);
|
|
}
|
|
if (node.LogLevel != null)
|
|
{
|
|
AddVar("LOG_LEVEL", node.LogLevel.ToString()!.ToUpperInvariant());
|
|
}
|
|
if (node.StorageQuota != null)
|
|
{
|
|
AddVar("STORAGE_QUOTA", node.StorageQuota.SizeInBytes.ToString()!);
|
|
}
|
|
}
|
|
|
|
private void AddVar(string key, string value)
|
|
{
|
|
Result.Add(new V1EnvVar
|
|
{
|
|
Name = key,
|
|
Value = value
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|