2023-04-12 11:53:55 +00:00
|
|
|
|
namespace KubernetesWorkflow
|
|
|
|
|
{
|
|
|
|
|
public class RunningPod
|
|
|
|
|
{
|
2023-06-27 13:28:00 +00:00
|
|
|
|
public RunningPod(K8sCluster cluster, PodInfo podInfo, string deploymentName, string serviceName, ContainerRecipePortMapEntry[] portMapEntries)
|
2023-04-12 11:53:55 +00:00
|
|
|
|
{
|
|
|
|
|
Cluster = cluster;
|
2023-06-02 08:04:07 +00:00
|
|
|
|
PodInfo = podInfo;
|
2023-04-13 09:07:36 +00:00
|
|
|
|
DeploymentName = deploymentName;
|
|
|
|
|
ServiceName = serviceName;
|
2023-06-27 13:28:00 +00:00
|
|
|
|
PortMapEntries = portMapEntries;
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public K8sCluster Cluster { get; }
|
2023-06-02 08:04:07 +00:00
|
|
|
|
public PodInfo PodInfo { get; }
|
2023-06-27 13:28:00 +00:00
|
|
|
|
public ContainerRecipePortMapEntry[] PortMapEntries { get; }
|
2023-09-25 07:57:27 +00:00
|
|
|
|
public string DeploymentName { get; }
|
|
|
|
|
public string ServiceName { get; }
|
2023-04-12 11:53:55 +00:00
|
|
|
|
|
|
|
|
|
public Port[] GetServicePortsForContainerRecipe(ContainerRecipe containerRecipe)
|
|
|
|
|
{
|
2023-10-19 12:03:36 +00:00
|
|
|
|
return PortMapEntries
|
|
|
|
|
.Where(p => p.ContainerNumber == containerRecipe.Number)
|
|
|
|
|
.SelectMany(p => p.Ports)
|
|
|
|
|
.ToArray();
|
2023-06-27 13:28:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ContainerRecipePortMapEntry
|
|
|
|
|
{
|
|
|
|
|
public ContainerRecipePortMapEntry(int containerNumber, Port[] ports)
|
|
|
|
|
{
|
|
|
|
|
ContainerNumber = containerNumber;
|
|
|
|
|
Ports = ports;
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
2023-06-27 13:28:00 +00:00
|
|
|
|
|
|
|
|
|
public int ContainerNumber { get; }
|
|
|
|
|
public Port[] Ports { get; }
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
2023-06-02 08:04:07 +00:00
|
|
|
|
|
|
|
|
|
public class PodInfo
|
|
|
|
|
{
|
2023-06-27 13:28:00 +00:00
|
|
|
|
public PodInfo(string name, string ip, string k8sNodeName)
|
2023-06-02 08:04:07 +00:00
|
|
|
|
{
|
2023-06-27 13:28:00 +00:00
|
|
|
|
Name = name;
|
|
|
|
|
Ip = ip;
|
2023-06-02 08:04:07 +00:00
|
|
|
|
K8SNodeName = k8sNodeName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name { get; }
|
|
|
|
|
public string Ip { get; }
|
|
|
|
|
public string K8SNodeName { get; }
|
|
|
|
|
}
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|