Implements GetAddress method for runningContainers.
This commit is contained in:
parent
43fa57dc97
commit
45050c34e4
|
@ -5,11 +5,9 @@ namespace Core
|
|||
public static class SerializeGate
|
||||
{
|
||||
/// <summary>
|
||||
/// SerializeGate was added to help ensure deployment objects are serializable
|
||||
/// and remain viable after deserialization.
|
||||
/// SerializeGate was added to help ensure deployment objects are serializable and remain viable after deserialization.
|
||||
/// Tools can be built on top of the core interface that rely on deployment objects being serializable.
|
||||
/// Insert the serialization gate after deployment but before wrapping to ensure any future changes
|
||||
/// don't break this requirement.
|
||||
/// Insert the serialization gate after deployment but before wrapping to ensure any future changes don't break this requirement.
|
||||
/// </summary>
|
||||
public static T Gate<T>(T anything)
|
||||
{
|
||||
|
|
|
@ -39,18 +39,14 @@ namespace KubernetesWorkflow
|
|||
public Port[] ServicePorts { get; }
|
||||
public ContainerPort[] ContainerPorts { get; }
|
||||
|
||||
[JsonIgnore]
|
||||
public Address Address
|
||||
public Address GetAddress(string portTag)
|
||||
{
|
||||
get
|
||||
var containerPort = ContainerPorts.Single(c => c.Port.Tag == portTag);
|
||||
if (RunnerLocationUtils.DetermineRunnerLocation(this) == RunnerLocation.InternalToCluster)
|
||||
{
|
||||
throw new Exception("a");
|
||||
//if (RunnerLocationUtils.DetermineRunnerLocation(this) == RunnerLocation.InternalToCluster)
|
||||
//{
|
||||
// return ClusterInternalAddress;
|
||||
//}
|
||||
//return ClusterExternalAddress;
|
||||
return containerPort.InternalAddress;
|
||||
}
|
||||
return containerPort.ExternalAddress;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,5 +10,10 @@
|
|||
|
||||
public string Host { get; }
|
||||
public int Port { get; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Host}:{Port}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Core;
|
||||
using KubernetesWorkflow;
|
||||
using Utils;
|
||||
|
||||
namespace CodexPlugin
|
||||
{
|
||||
|
@ -98,12 +99,17 @@ namespace CodexPlugin
|
|||
|
||||
private IHttp Http()
|
||||
{
|
||||
return tools.CreateHttp(Container.Address, baseUrl: "/api/codex/v1", CheckContainerCrashed, Container.Name);
|
||||
return tools.CreateHttp(GetAddress(), baseUrl: "/api/codex/v1", CheckContainerCrashed, Container.Name);
|
||||
}
|
||||
|
||||
private IHttp LongHttp()
|
||||
{
|
||||
return tools.CreateHttp(Container.Address, baseUrl: "/api/codex/v1", CheckContainerCrashed, new LongTimeSet(), Container.Name);
|
||||
return tools.CreateHttp(GetAddress(), baseUrl: "/api/codex/v1", CheckContainerCrashed, new LongTimeSet(), Container.Name);
|
||||
}
|
||||
|
||||
private Address GetAddress()
|
||||
{
|
||||
return Container.GetAddress(CodexContainerRecipe.ApiPortTag);
|
||||
}
|
||||
|
||||
private void CheckContainerCrashed(HttpClient client)
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace GethPlugin
|
|||
|
||||
private NethereumInteraction StartInteraction()
|
||||
{
|
||||
var address = StartResult.Container.Address;
|
||||
var address = StartResult.Container.GetAddress(GethContainerRecipe.HttpPortTag);
|
||||
var account = Account;
|
||||
|
||||
var creator = new NethereumInteractionCreator(log, address.Host, address.Port, account.PrivateKey);
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MetricsPlugin
|
|||
public MetricsQuery(IPluginTools tools, RunningContainer runningContainer)
|
||||
{
|
||||
RunningContainer = runningContainer;
|
||||
http = tools.CreateHttp(RunningContainer.Address, "api/v1");
|
||||
http = tools.CreateHttp(RunningContainer.GetAddress(PrometheusContainerRecipe.PortTag), "api/v1");
|
||||
log = tools.GetLog();
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,8 @@ namespace ContinuousTests
|
|||
{
|
||||
cancelToken.ThrowIfCancellationRequested();
|
||||
|
||||
log.Log($"Checking {n.Container.Name} @ '{n.Container.Address.Host}:{n.Container.Address.Port}'...");
|
||||
var address = n.Container.GetAddress(CodexContainerRecipe.ApiPortTag);
|
||||
log.Log($"Checking {n.Container.Name} @ '{address}'...");
|
||||
|
||||
if (EnsureOnline(log, n))
|
||||
{
|
||||
|
@ -95,7 +96,7 @@ namespace ContinuousTests
|
|||
}
|
||||
else
|
||||
{
|
||||
log.Error($"No response from '{n.Container.Address.Host}'.");
|
||||
log.Error($"No response from '{address}'.");
|
||||
pass = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue