2023-04-12 11:53:55 +00:00
|
|
|
|
namespace KubernetesWorkflow
|
|
|
|
|
{
|
|
|
|
|
public class RunningPod
|
|
|
|
|
{
|
|
|
|
|
private readonly Dictionary<ContainerRecipe, Port[]> servicePortMap;
|
|
|
|
|
|
2023-06-02 08:04:07 +00:00
|
|
|
|
public RunningPod(K8sCluster cluster, PodInfo podInfo, string deploymentName, string serviceName, Dictionary<ContainerRecipe, Port[]> servicePortMap)
|
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-04-12 11:53:55 +00:00
|
|
|
|
this.servicePortMap = servicePortMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public K8sCluster Cluster { get; }
|
2023-06-02 08:04:07 +00:00
|
|
|
|
public PodInfo PodInfo { get; }
|
2023-04-13 09:07:36 +00:00
|
|
|
|
internal string DeploymentName { get; }
|
|
|
|
|
internal string ServiceName { get; }
|
2023-04-12 11:53:55 +00:00
|
|
|
|
|
|
|
|
|
public Port[] GetServicePortsForContainerRecipe(ContainerRecipe containerRecipe)
|
|
|
|
|
{
|
2023-06-02 09:38:52 +00:00
|
|
|
|
if (!servicePortMap.ContainsKey(containerRecipe)) return Array.Empty<Port>();
|
2023-04-12 11:53:55 +00:00
|
|
|
|
return servicePortMap[containerRecipe];
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-02 08:04:07 +00:00
|
|
|
|
|
|
|
|
|
public class PodInfo
|
|
|
|
|
{
|
|
|
|
|
public PodInfo(string podName, string podIp, string k8sNodeName)
|
|
|
|
|
{
|
|
|
|
|
Name = podName;
|
|
|
|
|
Ip = podIp;
|
|
|
|
|
K8SNodeName = k8sNodeName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name { get; }
|
|
|
|
|
public string Ip { get; }
|
|
|
|
|
public string K8SNodeName { get; }
|
|
|
|
|
}
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|