Mandatory port tags for exposed ports
This commit is contained in:
parent
3a8bb760ef
commit
43fa57dc97
|
@ -24,6 +24,8 @@
|
|||
{
|
||||
Name = $"ctnr{Number}";
|
||||
}
|
||||
|
||||
if (exposedPorts.Any(p => string.IsNullOrEmpty(p.Tag))) throw new Exception("Port tags are required for all exposed ports.");
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
|
|
@ -50,12 +50,12 @@ namespace KubernetesWorkflow
|
|||
protected int Index { get; private set; } = 0;
|
||||
protected abstract void Initialize(StartupConfig config);
|
||||
|
||||
protected Port AddExposedPort(string tag = "")
|
||||
protected Port AddExposedPort(string tag)
|
||||
{
|
||||
return AddExposedPort(factory.CreatePort(tag));
|
||||
}
|
||||
|
||||
protected Port AddExposedPort(int number, string tag = "")
|
||||
protected Port AddExposedPort(int number, string tag)
|
||||
{
|
||||
return AddExposedPort(factory.CreatePort(number, tag));
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace KubernetesWorkflow
|
|||
return p;
|
||||
}
|
||||
|
||||
protected void AddExposedPortAndVar(string name, string tag = "")
|
||||
protected void AddExposedPortAndVar(string name, string tag)
|
||||
{
|
||||
AddEnvVar(name, AddExposedPort(tag));
|
||||
}
|
||||
|
|
|
@ -8,8 +8,10 @@ namespace CodexPlugin
|
|||
private readonly MarketplaceStarter marketplaceStarter = new MarketplaceStarter();
|
||||
|
||||
private const string DefaultDockerImage = "codexstorage/nim-codex:latest-dist-tests";
|
||||
public const string MetricsPortTag = "metrics_port";
|
||||
public const string DiscoveryPortTag = "discovery-port";
|
||||
public const string ApiPortTag = "codex_api_port";
|
||||
public const string ListenPortTag = "codex_listen_port";
|
||||
public const string MetricsPortTag = "codex_metrics_port";
|
||||
public const string DiscoveryPortTag = "codex_discovery_port";
|
||||
|
||||
// Used by tests for time-constraint assertions.
|
||||
public static readonly TimeSpan MaxUploadTimePerMegabyte = TimeSpan.FromSeconds(2.0);
|
||||
|
@ -27,7 +29,7 @@ namespace CodexPlugin
|
|||
|
||||
var config = startupConfig.Get<CodexStartupConfig>();
|
||||
|
||||
AddExposedPortAndVar("CODEX_API_PORT");
|
||||
AddExposedPortAndVar("CODEX_API_PORT", ApiPortTag);
|
||||
AddEnvVar("CODEX_API_BINDADDR", "0.0.0.0");
|
||||
|
||||
var dataDir = $"datadir{ContainerNumber}";
|
||||
|
@ -40,7 +42,7 @@ namespace CodexPlugin
|
|||
// This makes the node announce itself to its local (pod) IP address.
|
||||
AddEnvVar("NAT_IP_AUTO", "true");
|
||||
|
||||
var listenPort = AddExposedPort();
|
||||
var listenPort = AddExposedPort(ListenPortTag);
|
||||
AddEnvVar("CODEX_LISTEN_ADDRS", $"/ip4/0.0.0.0/tcp/{listenPort.Number}");
|
||||
|
||||
if (!string.IsNullOrEmpty(config.BootstrapSpr))
|
||||
|
|
|
@ -7,11 +7,13 @@ namespace MetricsPlugin
|
|||
public override string AppName => "prometheus";
|
||||
public override string Image => "codexstorage/dist-tests-prometheus:latest";
|
||||
|
||||
public const string PortTag = "prometheus_port_tag";
|
||||
|
||||
protected override void Initialize(StartupConfig startupConfig)
|
||||
{
|
||||
var config = startupConfig.Get<PrometheusStartupConfig>();
|
||||
|
||||
AddExposedPortAndVar("PROM_PORT");
|
||||
AddExposedPortAndVar("PROM_PORT", PortTag);
|
||||
AddEnvVar("PROM_CONFIG", config.PrometheusConfigBase64);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue