Easier local deployments
This commit is contained in:
parent
063b69ef99
commit
731ab90ce1
|
@ -8,16 +8,16 @@ namespace CodexNetDeployer
|
||||||
public class Configuration
|
public class Configuration
|
||||||
{
|
{
|
||||||
[Uniform("codex-image", "ci", "CODEXIMAGE", true, "Docker image of Codex.")]
|
[Uniform("codex-image", "ci", "CODEXIMAGE", true, "Docker image of Codex.")]
|
||||||
public string CodexImage { get; set; } = string.Empty;
|
public string CodexImage { get; set; } = CodexContainerRecipe.DockerImage;
|
||||||
|
|
||||||
[Uniform("geth-image", "gi", "GETHIMAGE", true, "Docker image of Geth.")]
|
[Uniform("geth-image", "gi", "GETHIMAGE", true, "Docker image of Geth.")]
|
||||||
public string GethImage { get; set; } = string.Empty;
|
public string GethImage { get; set; } = GethContainerRecipe.DockerImage;
|
||||||
|
|
||||||
[Uniform("contracts-image", "oi", "CONTRACTSIMAGE", true, "Docker image of Codex Contracts.")]
|
[Uniform("contracts-image", "oi", "CONTRACTSIMAGE", true, "Docker image of Codex Contracts.")]
|
||||||
public string ContractsImage { get; set; } = string.Empty;
|
public string ContractsImage { get; set; } = CodexContractsContainerRecipe.DockerImage;
|
||||||
|
|
||||||
[Uniform("kube-config", "kc", "KUBECONFIG", true, "Path to Kubeconfig file.")]
|
[Uniform("kube-config", "kc", "KUBECONFIG", false, "Path to Kubeconfig file. Use 'null' (default) to use local cluster.")]
|
||||||
public string KubeConfigFile { get; set; } = string.Empty;
|
public string KubeConfigFile { get; set; } = "null";
|
||||||
|
|
||||||
[Uniform("kube-namespace", "kn", "KUBENAMESPACE", true, "Kubernetes namespace to be used for deployment.")]
|
[Uniform("kube-namespace", "kn", "KUBENAMESPACE", true, "Kubernetes namespace to be used for deployment.")]
|
||||||
public string KubeNamespace { get; set; } = string.Empty;
|
public string KubeNamespace { get; set; } = string.Empty;
|
||||||
|
@ -32,18 +32,10 @@ namespace CodexNetDeployer
|
||||||
public int? StorageQuota { get; set; }
|
public int? StorageQuota { get; set; }
|
||||||
|
|
||||||
[Uniform("log-level", "l", "LOGLEVEL", true, "Log level used by each Codex node. [Trace, Debug*, Info, Warn, Error]")]
|
[Uniform("log-level", "l", "LOGLEVEL", true, "Log level used by each Codex node. [Trace, Debug*, Info, Warn, Error]")]
|
||||||
public CodexLogLevel CodexLogLevel { get; set; }
|
public CodexLogLevel CodexLogLevel { get; set; } = CodexLogLevel.Debug;
|
||||||
|
|
||||||
public TestRunnerLocation RunnerLocation { get; set; } = TestRunnerLocation.InternalToCluster;
|
public TestRunnerLocation RunnerLocation { get; set; } = TestRunnerLocation.InternalToCluster;
|
||||||
|
|
||||||
public class Defaults
|
|
||||||
{
|
|
||||||
public string CodexImage { get; set; } = CodexContainerRecipe.DockerImage;
|
|
||||||
public string GethImage { get; set; } = GethContainerRecipe.DockerImage;
|
|
||||||
public string ContractsImage { get; set; } = CodexContractsContainerRecipe.DockerImage;
|
|
||||||
public CodexLogLevel CodexLogLevel { get; set; } = CodexLogLevel.Debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<string> Validate()
|
public List<string> Validate()
|
||||||
{
|
{
|
||||||
var errors = new List<string>();
|
var errors = new List<string>();
|
||||||
|
@ -74,7 +66,7 @@ namespace CodexNetDeployer
|
||||||
{
|
{
|
||||||
if (value == null || value.Value < 1)
|
if (value == null || value.Value < 1)
|
||||||
{
|
{
|
||||||
errors.Add($"{variable} is must be set and must be greater than 0.");
|
errors.Add($"{variable} must be set and must be greater than 0.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +74,7 @@ namespace CodexNetDeployer
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
errors.Add($"{variable} is must be set.");
|
errors.Add($"{variable} must be set.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,11 @@ namespace CodexNetDeployer
|
||||||
|
|
||||||
private (WorkflowCreator, TestLifecycle) CreateFacilities()
|
private (WorkflowCreator, TestLifecycle) CreateFacilities()
|
||||||
{
|
{
|
||||||
|
var kubeConfig = GetKubeConfig(config.KubeConfigFile);
|
||||||
|
|
||||||
var lifecycleConfig = new DistTestCore.Configuration
|
var lifecycleConfig = new DistTestCore.Configuration
|
||||||
(
|
(
|
||||||
kubeConfigFile: config.KubeConfigFile,
|
kubeConfigFile: kubeConfig,
|
||||||
logPath: "null",
|
logPath: "null",
|
||||||
logDebug: false,
|
logDebug: false,
|
||||||
dataFilesPath: "notUsed",
|
dataFilesPath: "notUsed",
|
||||||
|
@ -61,18 +63,24 @@ namespace CodexNetDeployer
|
||||||
runnerLocation: config.RunnerLocation
|
runnerLocation: config.RunnerLocation
|
||||||
);
|
);
|
||||||
|
|
||||||
var kubeConfig = new KubernetesWorkflow.Configuration(
|
var kubeFlowConfig = new KubernetesWorkflow.Configuration(
|
||||||
k8sNamespacePrefix: config.KubeNamespace,
|
k8sNamespacePrefix: config.KubeNamespace,
|
||||||
kubeConfigFile: config.KubeConfigFile,
|
kubeConfigFile: kubeConfig,
|
||||||
operationTimeout: timeset.K8sOperationTimeout(),
|
operationTimeout: timeset.K8sOperationTimeout(),
|
||||||
retryDelay: timeset.WaitForK8sServiceDelay());
|
retryDelay: timeset.WaitForK8sServiceDelay());
|
||||||
|
|
||||||
var workflowCreator = new WorkflowCreator(log, kubeConfig, testNamespacePostfix: string.Empty);
|
var workflowCreator = new WorkflowCreator(log, kubeFlowConfig, testNamespacePostfix: string.Empty);
|
||||||
var lifecycle = new TestLifecycle(log, lifecycleConfig, timeset, workflowCreator);
|
var lifecycle = new TestLifecycle(log, lifecycleConfig, timeset, workflowCreator);
|
||||||
|
|
||||||
return (workflowCreator, lifecycle);
|
return (workflowCreator, lifecycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string? GetKubeConfig(string kubeConfigFile)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(kubeConfigFile) || kubeConfigFile.ToLowerInvariant() == "null") return null;
|
||||||
|
return kubeConfigFile;
|
||||||
|
}
|
||||||
|
|
||||||
private DeploymentMetadata CreateMetadata()
|
private DeploymentMetadata CreateMetadata()
|
||||||
{
|
{
|
||||||
return new DeploymentMetadata(
|
return new DeploymentMetadata(
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class Program
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uniformArgs = new ArgsUniform<Configuration>(new Configuration.Defaults(), args);
|
var uniformArgs = new ArgsUniform<Configuration>(args);
|
||||||
var config = uniformArgs.Parse(true);
|
var config = uniformArgs.Parse(true);
|
||||||
|
|
||||||
if (args.Any(a => a == "--external"))
|
if (args.Any(a => a == "--external"))
|
||||||
|
|
Loading…
Reference in New Issue