2023-04-12 11:53:55 +00:00
|
|
|
|
namespace KubernetesWorkflow
|
|
|
|
|
{
|
|
|
|
|
public class RunningContainers
|
|
|
|
|
{
|
|
|
|
|
public RunningContainers(StartupConfig startupConfig, RunningPod runningPod, RunningContainer[] containers)
|
|
|
|
|
{
|
|
|
|
|
StartupConfig = startupConfig;
|
|
|
|
|
RunningPod = runningPod;
|
|
|
|
|
Containers = containers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public StartupConfig StartupConfig { get; }
|
|
|
|
|
public RunningPod RunningPod { get; }
|
|
|
|
|
public RunningContainer[] Containers { get; }
|
2023-04-13 12:36:17 +00:00
|
|
|
|
|
|
|
|
|
public string Describe()
|
|
|
|
|
{
|
2023-04-30 08:56:19 +00:00
|
|
|
|
return string.Join(",", Containers.Select(c => c.Name));
|
2023-04-13 12:36:17 +00:00
|
|
|
|
}
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class RunningContainer
|
|
|
|
|
{
|
2023-06-01 07:35:18 +00:00
|
|
|
|
public RunningContainer(RunningPod pod, ContainerRecipe recipe, Port[] servicePorts, StartupConfig startupConfig, RunningContainerAddress clusterExternalAddress, RunningContainerAddress clusterInternalAddress)
|
2023-04-12 11:53:55 +00:00
|
|
|
|
{
|
|
|
|
|
Pod = pod;
|
|
|
|
|
Recipe = recipe;
|
|
|
|
|
ServicePorts = servicePorts;
|
2023-04-30 08:56:19 +00:00
|
|
|
|
Name = GetContainerName(recipe, startupConfig);
|
2023-06-01 07:35:18 +00:00
|
|
|
|
ClusterExternalAddress = clusterExternalAddress;
|
|
|
|
|
ClusterInternalAddress = clusterInternalAddress;
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-30 08:56:19 +00:00
|
|
|
|
public string Name { get; }
|
2023-04-12 11:53:55 +00:00
|
|
|
|
public RunningPod Pod { get; }
|
|
|
|
|
public ContainerRecipe Recipe { get; }
|
|
|
|
|
public Port[] ServicePorts { get; }
|
2023-06-01 07:35:18 +00:00
|
|
|
|
public RunningContainerAddress ClusterExternalAddress { get; }
|
|
|
|
|
public RunningContainerAddress ClusterInternalAddress { get; }
|
2023-04-30 08:56:19 +00:00
|
|
|
|
|
|
|
|
|
private string GetContainerName(ContainerRecipe recipe, StartupConfig startupConfig)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(startupConfig.NameOverride))
|
|
|
|
|
{
|
|
|
|
|
return $"<{startupConfig.NameOverride}{recipe.Number}>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return $"<{recipe.Name}>";
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
2023-06-01 07:35:18 +00:00
|
|
|
|
|
|
|
|
|
public class RunningContainerAddress
|
|
|
|
|
{
|
|
|
|
|
public RunningContainerAddress(string host, int port)
|
|
|
|
|
{
|
|
|
|
|
Host = host;
|
|
|
|
|
Port = port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Host { get; }
|
|
|
|
|
public int Port { get; }
|
|
|
|
|
}
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|