Merge branch 'master' into feature/bot-upgrade
This commit is contained in:
commit
525fdcf4a7
|
@ -43,6 +43,11 @@ namespace KubernetesWorkflow
|
||||||
return new StartResult(cluster, containerRecipes, deployment, internalService, externalService);
|
return new StartResult(cluster, containerRecipes, deployment, internalService, externalService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void WaitUntilOnline(RunningContainer container)
|
||||||
|
{
|
||||||
|
WaitUntilDeploymentOnline(container.Recipe.Name);
|
||||||
|
}
|
||||||
|
|
||||||
public PodInfo GetPodInfo(RunningDeployment deployment)
|
public PodInfo GetPodInfo(RunningDeployment deployment)
|
||||||
{
|
{
|
||||||
var pod = GetPodForDeployment(deployment);
|
var pod = GetPodForDeployment(deployment);
|
||||||
|
@ -372,7 +377,6 @@ namespace KubernetesWorkflow
|
||||||
};
|
};
|
||||||
|
|
||||||
client.Run(c => c.CreateNamespacedDeployment(deploymentSpec, K8sNamespace));
|
client.Run(c => c.CreateNamespacedDeployment(deploymentSpec, K8sNamespace));
|
||||||
WaitUntilDeploymentOnline(deploymentSpec.Metadata.Name);
|
|
||||||
|
|
||||||
var name = deploymentSpec.Metadata.Name;
|
var name = deploymentSpec.Metadata.Name;
|
||||||
return new RunningDeployment(name, podLabel);
|
return new RunningDeployment(name, podLabel);
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace KubernetesWorkflow
|
||||||
public interface IStartupWorkflow
|
public interface IStartupWorkflow
|
||||||
{
|
{
|
||||||
IKnownLocations GetAvailableLocations();
|
IKnownLocations GetAvailableLocations();
|
||||||
RunningContainers Start(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig);
|
FutureContainers Start(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig);
|
||||||
RunningContainers Start(int numberOfContainers, ILocation location, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig);
|
FutureContainers Start(int numberOfContainers, ILocation location, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig);
|
||||||
PodInfo GetPodInfo(RunningContainer container);
|
PodInfo GetPodInfo(RunningContainer container);
|
||||||
PodInfo GetPodInfo(RunningContainers containers);
|
PodInfo GetPodInfo(RunningContainers containers);
|
||||||
CrashWatcher CreateCrashWatcher(RunningContainer container);
|
CrashWatcher CreateCrashWatcher(RunningContainer container);
|
||||||
|
@ -45,12 +45,12 @@ namespace KubernetesWorkflow
|
||||||
return locationProvider.GetAvailableLocations();
|
return locationProvider.GetAvailableLocations();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RunningContainers Start(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig)
|
public FutureContainers Start(int numberOfContainers, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig)
|
||||||
{
|
{
|
||||||
return Start(numberOfContainers, KnownLocations.UnspecifiedLocation, recipeFactory, startupConfig);
|
return Start(numberOfContainers, KnownLocations.UnspecifiedLocation, recipeFactory, startupConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RunningContainers Start(int numberOfContainers, ILocation location, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig)
|
public FutureContainers Start(int numberOfContainers, ILocation location, ContainerRecipeFactory recipeFactory, StartupConfig startupConfig)
|
||||||
{
|
{
|
||||||
return K8s(controller =>
|
return K8s(controller =>
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,18 @@ namespace KubernetesWorkflow
|
||||||
{
|
{
|
||||||
componentFactory.Update(controller);
|
componentFactory.Update(controller);
|
||||||
}
|
}
|
||||||
return rc;
|
return new FutureContainers(rc, this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WaitUntilOnline(RunningContainers rc)
|
||||||
|
{
|
||||||
|
K8s(controller =>
|
||||||
|
{
|
||||||
|
foreach (var c in rc.Containers)
|
||||||
|
{
|
||||||
|
controller.WaitUntilOnline(c);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
namespace KubernetesWorkflow.Types
|
||||||
|
{
|
||||||
|
public class FutureContainers
|
||||||
|
{
|
||||||
|
private readonly RunningContainers runningContainers;
|
||||||
|
private readonly StartupWorkflow workflow;
|
||||||
|
|
||||||
|
public FutureContainers(RunningContainers runningContainers, StartupWorkflow workflow)
|
||||||
|
{
|
||||||
|
this.runningContainers = runningContainers;
|
||||||
|
this.workflow = workflow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RunningContainers WaitForOnline()
|
||||||
|
{
|
||||||
|
workflow.WaitUntilOnline(runningContainers);
|
||||||
|
return runningContainers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ namespace CodexContractsPlugin
|
||||||
var startupConfig = CreateStartupConfig(gethNode);
|
var startupConfig = CreateStartupConfig(gethNode);
|
||||||
startupConfig.NameOverride = "codex-contracts";
|
startupConfig.NameOverride = "codex-contracts";
|
||||||
|
|
||||||
var containers = workflow.Start(1, new CodexContractsContainerRecipe(), startupConfig);
|
var containers = workflow.Start(1, new CodexContractsContainerRecipe(), startupConfig).WaitForOnline();
|
||||||
if (containers.Containers.Length != 1) throw new InvalidOperationException("Expected 1 Codex contracts container to be created. Test infra failure.");
|
if (containers.Containers.Length != 1) throw new InvalidOperationException("Expected 1 Codex contracts container to be created. Test infra failure.");
|
||||||
var container = containers.Containers[0];
|
var container = containers.Containers[0];
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,14 @@ namespace CodexDiscordBotPlugin
|
||||||
var startupConfig = new StartupConfig();
|
var startupConfig = new StartupConfig();
|
||||||
startupConfig.NameOverride = config.Name;
|
startupConfig.NameOverride = config.Name;
|
||||||
startupConfig.Add(config);
|
startupConfig.Add(config);
|
||||||
return workflow.Start(1, new DiscordBotContainerRecipe(), startupConfig);
|
return workflow.Start(1, new DiscordBotContainerRecipe(), startupConfig).WaitForOnline();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RunningContainers StartRewarderContainer(IStartupWorkflow workflow, RewarderBotStartupConfig config)
|
private RunningContainers StartRewarderContainer(IStartupWorkflow workflow, RewarderBotStartupConfig config)
|
||||||
{
|
{
|
||||||
var startupConfig = new StartupConfig();
|
var startupConfig = new StartupConfig();
|
||||||
startupConfig.Add(config);
|
startupConfig.Add(config);
|
||||||
return workflow.Start(1, new RewarderBotContainerRecipe(), startupConfig);
|
return workflow.Start(1, new RewarderBotContainerRecipe(), startupConfig).WaitForOnline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace CodexPlugin
|
||||||
public class ApiChecker
|
public class ApiChecker
|
||||||
{
|
{
|
||||||
// <INSERT-OPENAPI-YAML-HASH>
|
// <INSERT-OPENAPI-YAML-HASH>
|
||||||
private const string OpenApiYamlHash = "63-7F-46-5E-2C-60-7A-BD-0C-EC-32-87-61-1B-79-FA-C2-EF-73-81-BA-FA-28-77-33-02-81-30-80-5D-00-97";
|
private const string OpenApiYamlHash = "5A-B0-2A-AC-42-B1-A2-49-6F-9D-4E-D8-56-40-10-A6-67-F4-0D-2A-9F-E0-84-5C-EB-B8-2D-4F-D8-56-79-6C";
|
||||||
private const string OpenApiFilePath = "/codex/openapi.yaml";
|
private const string OpenApiFilePath = "/codex/openapi.yaml";
|
||||||
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
|
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace CodexPlugin
|
||||||
{
|
{
|
||||||
public class CodexContainerRecipe : ContainerRecipeFactory
|
public class CodexContainerRecipe : ContainerRecipeFactory
|
||||||
{
|
{
|
||||||
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-f2f1dd5-dist-tests";
|
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-1524803-dist-tests";
|
||||||
public const string ApiPortTag = "codex_api_port";
|
public const string ApiPortTag = "codex_api_port";
|
||||||
public const string ListenPortTag = "codex_listen_port";
|
public const string ListenPortTag = "codex_listen_port";
|
||||||
public const string MetricsPortTag = "codex_metrics_port";
|
public const string MetricsPortTag = "codex_metrics_port";
|
||||||
|
|
|
@ -87,13 +87,16 @@ namespace CodexPlugin
|
||||||
|
|
||||||
private RunningContainers[] StartCodexContainers(StartupConfig startupConfig, int numberOfNodes, ILocation location)
|
private RunningContainers[] StartCodexContainers(StartupConfig startupConfig, int numberOfNodes, ILocation location)
|
||||||
{
|
{
|
||||||
var result = new List<RunningContainers>();
|
var futureContainers = new List<FutureContainers>();
|
||||||
for (var i = 0; i < numberOfNodes; i++)
|
for (var i = 0; i < numberOfNodes; i++)
|
||||||
{
|
{
|
||||||
var workflow = pluginTools.CreateWorkflow();
|
var workflow = pluginTools.CreateWorkflow();
|
||||||
result.Add(workflow.Start(1, location, recipe, startupConfig));
|
futureContainers.Add(workflow.Start(1, location, recipe, startupConfig));
|
||||||
}
|
}
|
||||||
return result.ToArray();
|
|
||||||
|
return futureContainers
|
||||||
|
.Select(f => f.WaitForOnline())
|
||||||
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private PodInfo GetPodInfo(RunningContainers rc)
|
private PodInfo GetPodInfo(RunningContainers rc)
|
||||||
|
|
|
@ -65,6 +65,22 @@ components:
|
||||||
description: A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.
|
description: A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.
|
||||||
default: 10 minutes
|
default: 10 minutes
|
||||||
|
|
||||||
|
SPR:
|
||||||
|
type: string
|
||||||
|
description: Signed Peer Record (libp2p)
|
||||||
|
|
||||||
|
SPRRead:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spr:
|
||||||
|
$ref: "#/components/schemas/SPR"
|
||||||
|
|
||||||
|
PeerIdRead:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
$ref: "#/components/schemas/PeerId"
|
||||||
|
|
||||||
ErasureParameters:
|
ErasureParameters:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -106,8 +122,7 @@ components:
|
||||||
type: string
|
type: string
|
||||||
description: Path of the data repository where all nodes data are stored
|
description: Path of the data repository where all nodes data are stored
|
||||||
spr:
|
spr:
|
||||||
type: string
|
$ref: "#/components/schemas/SPR"
|
||||||
description: Signed Peer Record to advertise DHT connection information
|
|
||||||
|
|
||||||
SalesAvailability:
|
SalesAvailability:
|
||||||
type: object
|
type: object
|
||||||
|
@ -685,6 +700,40 @@ paths:
|
||||||
"503":
|
"503":
|
||||||
description: Purchasing is unavailable
|
description: Purchasing is unavailable
|
||||||
|
|
||||||
|
"/node/spr":
|
||||||
|
get:
|
||||||
|
summary: "Get Node's SPR"
|
||||||
|
operationId: getSPR
|
||||||
|
tags: [ Node ]
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Node's SPR
|
||||||
|
content:
|
||||||
|
plain/text:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/SPR"
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/SPRRead"
|
||||||
|
"503":
|
||||||
|
description: Node SPR not ready, try again later
|
||||||
|
|
||||||
|
"/node/peerid":
|
||||||
|
get:
|
||||||
|
summary: "Get Node's PeerID"
|
||||||
|
operationId: getPeerId
|
||||||
|
tags: [ Node ]
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Node's Peer ID
|
||||||
|
content:
|
||||||
|
plain/text:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/PeerId"
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/PeerIdRead"
|
||||||
|
|
||||||
"/debug/chronicles/loglevel":
|
"/debug/chronicles/loglevel":
|
||||||
post:
|
post:
|
||||||
summary: "Set log level at run time"
|
summary: "Set log level at run time"
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace DeployAndRunPlugin
|
||||||
startupConfig.Add(config);
|
startupConfig.Add(config);
|
||||||
|
|
||||||
var location = workflow.GetAvailableLocations().Get("fixed-s-4vcpu-16gb-amd-yz8rd");
|
var location = workflow.GetAvailableLocations().Get("fixed-s-4vcpu-16gb-amd-yz8rd");
|
||||||
var containers = workflow.Start(1, location, new DeployAndRunContainerRecipe(), startupConfig);
|
var containers = workflow.Start(1, location, new DeployAndRunContainerRecipe(), startupConfig).WaitForOnline();
|
||||||
return containers.Containers.Single();
|
return containers.Containers.Single();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace GethPlugin
|
||||||
startupConfig.NameOverride = gethStartupConfig.NameOverride;
|
startupConfig.NameOverride = gethStartupConfig.NameOverride;
|
||||||
|
|
||||||
var workflow = tools.CreateWorkflow();
|
var workflow = tools.CreateWorkflow();
|
||||||
var containers = workflow.Start(1, new GethContainerRecipe(), startupConfig);
|
var containers = workflow.Start(1, new GethContainerRecipe(), startupConfig).WaitForOnline();
|
||||||
if (containers.Containers.Length != 1) throw new InvalidOperationException("Expected 1 Geth bootstrap node to be created. Test infra failure.");
|
if (containers.Containers.Length != 1) throw new InvalidOperationException("Expected 1 Geth bootstrap node to be created. Test infra failure.");
|
||||||
var container = containers.Containers[0];
|
var container = containers.Containers[0];
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace MetricsPlugin
|
||||||
startupConfig.Add(new PrometheusStartupConfig(GeneratePrometheusConfig(targets)));
|
startupConfig.Add(new PrometheusStartupConfig(GeneratePrometheusConfig(targets)));
|
||||||
|
|
||||||
var workflow = tools.CreateWorkflow();
|
var workflow = tools.CreateWorkflow();
|
||||||
var runningContainers = workflow.Start(1, recipe, startupConfig);
|
var runningContainers = workflow.Start(1, recipe, startupConfig).WaitForOnline();
|
||||||
if (runningContainers.Containers.Length != 1) throw new InvalidOperationException("Expected only 1 Prometheus container to be created.");
|
if (runningContainers.Containers.Length != 1) throw new InvalidOperationException("Expected only 1 Prometheus container to be created.");
|
||||||
|
|
||||||
Log("Metrics server started.");
|
Log("Metrics server started.");
|
||||||
|
|
|
@ -20,10 +20,8 @@ namespace CodexTests.BasicTests
|
||||||
var geth = Ci.StartGethNode(s => s.IsMiner().WithName("disttest-geth"));
|
var geth = Ci.StartGethNode(s => s.IsMiner().WithName("disttest-geth"));
|
||||||
var contracts = Ci.StartCodexContracts(geth);
|
var contracts = Ci.StartCodexContracts(geth);
|
||||||
|
|
||||||
var numberOfHosts = 3;
|
var numberOfHosts = 5;
|
||||||
for (var i = 0; i < numberOfHosts; i++)
|
var hosts = AddCodex(numberOfHosts, s => s
|
||||||
{
|
|
||||||
var host = AddCodex(s => s
|
|
||||||
.WithName("Host")
|
.WithName("Host")
|
||||||
.WithLogLevel(CodexLogLevel.Trace, new CodexLogCustomTopics(CodexLogLevel.Error, CodexLogLevel.Error, CodexLogLevel.Warn)
|
.WithLogLevel(CodexLogLevel.Trace, new CodexLogCustomTopics(CodexLogLevel.Error, CodexLogLevel.Error, CodexLogLevel.Warn)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +33,10 @@ namespace CodexTests.BasicTests
|
||||||
.AsStorageNode()
|
.AsStorageNode()
|
||||||
.AsValidator()));
|
.AsValidator()));
|
||||||
|
|
||||||
AssertBalance(contracts, host, Is.EqualTo(hostInitialBalance));
|
var expectedHostBalance = (numberOfHosts * hostInitialBalance.Amount).TestTokens();
|
||||||
|
foreach (var host in hosts)
|
||||||
|
{
|
||||||
|
AssertBalance(contracts, host, Is.EqualTo(expectedHostBalance));
|
||||||
|
|
||||||
var availability = new StorageAvailability(
|
var availability = new StorageAvailability(
|
||||||
totalSpace: 10.GB(),
|
totalSpace: 10.GB(),
|
||||||
|
|
Loading…
Reference in New Issue