72 lines
2.4 KiB
C#
Raw Normal View History

2023-06-22 09:51:25 +02:00
using CodexNetDeployer;
2023-06-22 10:17:12 +02:00
using DistTestCore;
2023-06-22 09:51:25 +02:00
using DistTestCore.Codex;
using DistTestCore.Marketplace;
2023-06-22 10:33:21 +02:00
using Utils;
2023-06-22 10:17:12 +02:00
using Configuration = CodexNetDeployer.Configuration;
2023-06-22 09:51:25 +02:00
public class Program
2023-06-22 08:29:33 +02:00
{
public static void Main(string[] args)
{
2023-06-22 14:37:37 +02:00
args = new[]
{
@"--kube-config=C:\Users\Ben\.kube\codex-tests-ams3-dev-kubeconfig.yaml",
"--kube-namespace=testing-deployer",
2023-06-22 15:58:18 +02:00
"--nodes=5",
"--validators=3",
2023-06-23 08:18:48 +02:00
"--storage-quota=1024",
"--external"
2023-06-22 14:37:37 +02:00
};
2023-06-22 09:51:25 +02:00
var nl = Environment.NewLine;
Console.WriteLine("CodexNetDeployer" + nl + nl);
var argOrVar = new ArgOrVar(args);
if (args.Any(a => a == "-h" || a == "--help" || a == "-?"))
{
argOrVar.PrintHelp();
return;
}
2023-06-23 08:18:48 +02:00
var location = TestRunnerLocation.InternalToCluster;
if (args.Any(a => a == "--external"))
2023-06-22 10:17:12 +02:00
{
2023-06-23 08:18:48 +02:00
location = TestRunnerLocation.ExternalToCluster;
2023-06-22 10:17:12 +02:00
}
2023-06-22 09:51:25 +02:00
var config = new Configuration(
codexImage: argOrVar.Get(ArgOrVar.CodexImage, CodexContainerRecipe.DockerImage),
gethImage: argOrVar.Get(ArgOrVar.GethImage, GethContainerRecipe.DockerImage),
contractsImage: argOrVar.Get(ArgOrVar.ContractsImage, CodexContractsContainerRecipe.DockerImage),
kubeConfigFile: argOrVar.Get(ArgOrVar.KubeConfigFile),
kubeNamespace: argOrVar.Get(ArgOrVar.KubeNamespace),
numberOfCodexNodes: argOrVar.GetInt(ArgOrVar.NumberOfCodexNodes),
2023-06-22 15:58:18 +02:00
numberOfValidators: argOrVar.GetInt(ArgOrVar.NumberOfValidatorNodes),
2023-06-22 10:17:12 +02:00
storageQuota: argOrVar.GetInt(ArgOrVar.StorageQuota),
2023-06-22 10:33:21 +02:00
codexLogLevel: ParseEnum.Parse<CodexLogLevel>(argOrVar.Get(ArgOrVar.LogLevel, nameof(CodexLogLevel.Debug))),
2023-06-22 10:17:12 +02:00
runnerLocation: location
2023-06-22 09:51:25 +02:00
);
Console.WriteLine("Using:");
config.PrintConfig();
Console.WriteLine(nl);
var errors = config.Validate();
if (errors.Any())
{
Console.WriteLine($"Configuration errors: ({errors.Count})");
foreach ( var error in errors ) Console.WriteLine("\t" + error);
Console.WriteLine(nl);
argOrVar.PrintHelp();
return;
}
2023-06-22 10:17:12 +02:00
var deployer = new Deployer(config);
deployer.Deploy();
2023-06-22 09:51:25 +02:00
2023-06-22 10:17:12 +02:00
Console.WriteLine("Done!");
2023-06-22 08:29:33 +02:00
}
}