Unknown runner location option.
This commit is contained in:
parent
ea66b5b408
commit
3e500e8346
|
@ -1,25 +1,25 @@
|
||||||
using Logging;
|
using Logging;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using Utils;
|
|
||||||
|
|
||||||
namespace KubernetesWorkflow
|
namespace KubernetesWorkflow
|
||||||
{
|
{
|
||||||
internal enum RunnerLocation
|
internal enum RunnerLocation
|
||||||
{
|
{
|
||||||
|
Unknown,
|
||||||
ExternalToCluster,
|
ExternalToCluster,
|
||||||
InternalToCluster,
|
InternalToCluster,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static class RunnerLocationUtils
|
internal static class RunnerLocationUtils
|
||||||
{
|
{
|
||||||
private static RunnerLocation? knownLocation = null;
|
private static RunnerLocation knownLocation = RunnerLocation.Unknown;
|
||||||
|
|
||||||
internal static RunnerLocation DetermineRunnerLocation(ILog log, PodInfo info, K8sCluster cluster)
|
internal static RunnerLocation DetermineRunnerLocation(ILog log, PodInfo info, K8sCluster cluster)
|
||||||
{
|
{
|
||||||
if (knownLocation != null) return knownLocation.Value;
|
if (knownLocation != RunnerLocation.Unknown) return knownLocation;
|
||||||
knownLocation = PingForLocation(info, cluster);
|
knownLocation = PingForLocation(info, cluster);
|
||||||
log.Log("Runner location set to: " + knownLocation);
|
log.Log("Runner location set to: " + knownLocation);
|
||||||
return knownLocation.Value;
|
return knownLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RunnerLocation PingForLocation(PodInfo podInfo, K8sCluster cluster)
|
private static RunnerLocation PingForLocation(PodInfo podInfo, K8sCluster cluster)
|
||||||
|
|
|
@ -58,10 +58,14 @@ namespace KubernetesWorkflow
|
||||||
{
|
{
|
||||||
select = addresses.Single(a => a.IsInteral);
|
select = addresses.Single(a => a.IsInteral);
|
||||||
}
|
}
|
||||||
else
|
else if (location == RunnerLocation.ExternalToCluster)
|
||||||
{
|
{
|
||||||
select = addresses.Single(a => !a.IsInteral);
|
select = addresses.Single(a => !a.IsInteral);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("Running location not known.");
|
||||||
|
}
|
||||||
|
|
||||||
log.Log($"Container '{Name}' selected for tag '{portTag}' address: '{select}'");
|
log.Log($"Container '{Name}' selected for tag '{portTag}' address: '{select}'");
|
||||||
return select.Address;
|
return select.Address;
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace CodexNetDeployer
|
||||||
public CodexNodeStartResult? Start(int i)
|
public CodexNodeStartResult? Start(int i)
|
||||||
{
|
{
|
||||||
var name = GetCodexContainerName(i);
|
var name = GetCodexContainerName(i);
|
||||||
Console.Write($" - {i} ({name})");
|
Console.Write($" - {i} ({name})\t");
|
||||||
Console.CursorLeft = 30;
|
Console.CursorLeft = 30;
|
||||||
|
|
||||||
ICodexNode? codexNode = null;
|
ICodexNode? codexNode = null;
|
||||||
|
|
Loading…
Reference in New Issue