2023-08-15 11:01:18 +02:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Utils;
|
2023-06-21 08:28:40 +02:00
|
|
|
|
|
|
|
|
|
namespace KubernetesWorkflow
|
2023-04-12 13:53:55 +02:00
|
|
|
|
{
|
|
|
|
|
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 14:36:17 +02:00
|
|
|
|
|
|
|
|
|
public string Describe()
|
|
|
|
|
{
|
2023-04-30 10:56:19 +02:00
|
|
|
|
return string.Join(",", Containers.Select(c => c.Name));
|
2023-04-13 14:36:17 +02:00
|
|
|
|
}
|
2023-04-12 13:53:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class RunningContainer
|
|
|
|
|
{
|
2023-06-23 10:35:23 +02:00
|
|
|
|
public RunningContainer(RunningPod pod, ContainerRecipe recipe, Port[] servicePorts, string name, Address clusterExternalAddress, Address clusterInternalAddress)
|
2023-04-12 13:53:55 +02:00
|
|
|
|
{
|
|
|
|
|
Pod = pod;
|
|
|
|
|
Recipe = recipe;
|
|
|
|
|
ServicePorts = servicePorts;
|
2023-06-23 10:35:23 +02:00
|
|
|
|
Name = name;
|
2023-06-01 09:35:18 +02:00
|
|
|
|
ClusterExternalAddress = clusterExternalAddress;
|
|
|
|
|
ClusterInternalAddress = clusterInternalAddress;
|
2023-04-12 13:53:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-30 10:56:19 +02:00
|
|
|
|
public string Name { get; }
|
2023-04-12 13:53:55 +02:00
|
|
|
|
public RunningPod Pod { get; }
|
|
|
|
|
public ContainerRecipe Recipe { get; }
|
|
|
|
|
public Port[] ServicePorts { get; }
|
2023-06-21 08:28:40 +02:00
|
|
|
|
public Address ClusterExternalAddress { get; }
|
|
|
|
|
public Address ClusterInternalAddress { get; }
|
2023-08-15 11:01:18 +02:00
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public CrashWatcher? CrashWatcher { get; set; }
|
2023-04-12 13:53:55 +02:00
|
|
|
|
}
|
2023-08-07 10:44:48 +02:00
|
|
|
|
|
|
|
|
|
public static class RunningContainersExtensions
|
|
|
|
|
{
|
|
|
|
|
public static RunningContainer[] Containers(this RunningContainers[] runningContainers)
|
|
|
|
|
{
|
|
|
|
|
return runningContainers.SelectMany(c => c.Containers).ToArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string Describe(this RunningContainers[] runningContainers)
|
|
|
|
|
{
|
|
|
|
|
return string.Join(",", runningContainers.Select(c => c.Describe()));
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-12 13:53:55 +02:00
|
|
|
|
}
|