50 lines
1.5 KiB
C#
Raw Normal View History

2023-03-21 08:23:15 +01:00
using k8s.Models;
2023-03-21 13:20:21 +01:00
namespace CodexDistTestCore
2023-03-21 08:23:15 +01:00
{
2023-03-21 15:17:48 +01:00
public class ActiveDeployment
2023-03-21 08:23:15 +01:00
{
2023-03-21 15:17:48 +01:00
public ActiveDeployment(OfflineCodexNodes origin, int orderNumber, CodexNodeContainer[] containers)
2023-03-21 08:23:15 +01:00
{
Origin = origin;
2023-03-21 15:17:48 +01:00
Containers = containers;
2023-03-21 08:23:15 +01:00
SelectorName = orderNumber.ToString().PadLeft(6, '0');
}
2023-03-21 15:17:48 +01:00
public OfflineCodexNodes Origin { get; }
public CodexNodeContainer[] Containers { get; }
2023-03-21 08:23:15 +01:00
public string SelectorName { get; }
public V1Deployment? Deployment { get; set; }
public V1Service? Service { get; set; }
public List<string> ActivePodNames { get; } = new List<string>();
public V1ObjectMeta GetServiceMetadata()
{
return new V1ObjectMeta
{
Name = "codex-test-entrypoint-" + SelectorName,
NamespaceProperty = K8sManager.K8sNamespace
};
}
public V1ObjectMeta GetDeploymentMetadata()
{
return new V1ObjectMeta
{
Name = "codex-test-node-" + SelectorName,
NamespaceProperty = K8sManager.K8sNamespace
};
}
public Dictionary<string, string> GetSelector()
{
return new Dictionary<string, string> { { "codex-test-node", "dist-test-" + SelectorName } };
}
public string Describe()
{
2023-03-21 15:17:48 +01:00
return $"CodexNode{SelectorName}-{Origin.Describe()}";
2023-03-21 08:23:15 +01:00
}
}
}