diff --git a/Tools/CodexNetDeployer/Configuration.cs b/Tools/CodexNetDeployer/Configuration.cs index b65ad72..fdb8f27 100644 --- a/Tools/CodexNetDeployer/Configuration.cs +++ b/Tools/CodexNetDeployer/Configuration.cs @@ -68,6 +68,9 @@ namespace CodexNetDeployer [Uniform("check-connect", "cc", "CHECKCONNECT", false, "If true, deployer check ensure peer-connectivity between all deployed nodes after deployment. Default is false.")] public bool CheckPeerConnection { get; set; } = false; + [Uniform("replication", "rep", "REPLICATION", false, "Number of times to repeat")] + public int Replication { get; set; } = 0; + public List Validate() { var errors = new List(); diff --git a/Tools/CodexNetDeployer/Program.cs b/Tools/CodexNetDeployer/Program.cs index 0029d56..291c85c 100644 --- a/Tools/CodexNetDeployer/Program.cs +++ b/Tools/CodexNetDeployer/Program.cs @@ -33,13 +33,31 @@ public class Program Console.WriteLine("I think so too."); } - var deployment = deployer.Deploy(); + if (config.Replication == 0) + { + var deployment = deployer.Deploy(); - Console.WriteLine($"Writing deployment file '{config.DeployFile}'..."); + Console.WriteLine($"Writing deployment file '{config.DeployFile}'..."); + File.WriteAllText(config.DeployFile, JsonConvert.SerializeObject(deployment, Formatting.Indented)); + Console.WriteLine("Done!"); + } + else + { + var originalNamespace = config.KubeNamespace; + var originalDeployFile = config.DeployFile; + for (var i = 0; i < config.Replication; i++) + { + config.KubeNamespace = originalNamespace + "-" + i; + config.DeployFile = originalDeployFile.ToLowerInvariant().Replace(".json", $"-{i}.json"); - File.WriteAllText(config.DeployFile, JsonConvert.SerializeObject(deployment, Formatting.Indented)); + var deployment = deployer.Deploy(); - Console.WriteLine("Done!"); + Console.WriteLine($"Writing deployment file '{config.DeployFile}'..."); + File.WriteAllText(config.DeployFile, JsonConvert.SerializeObject(deployment, Formatting.Indented)); + } + + Console.WriteLine("Done!"); + } } private static void PrintHelp()