2023-09-22 09:10:22 +00:00
|
|
|
|
using DistTestCore;
|
|
|
|
|
using KubernetesWorkflow;
|
|
|
|
|
|
|
|
|
|
namespace CodexNetDeployer
|
|
|
|
|
{
|
|
|
|
|
public class K8sHook : IK8sHooks
|
|
|
|
|
{
|
|
|
|
|
private readonly string testsTypeLabel;
|
2023-09-26 12:32:28 +00:00
|
|
|
|
private readonly Dictionary<string, string> metadata;
|
2023-09-22 09:10:22 +00:00
|
|
|
|
|
2023-09-26 12:32:28 +00:00
|
|
|
|
public K8sHook(string testsTypeLabel, Dictionary<string, string> metadata)
|
2023-09-22 09:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
this.testsTypeLabel = testsTypeLabel;
|
2023-09-26 12:32:28 +00:00
|
|
|
|
this.metadata = metadata;
|
2023-09-22 09:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnContainersStarted(RunningContainers rc)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnContainersStopped(RunningContainers rc)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnContainerRecipeCreated(ContainerRecipe recipe)
|
|
|
|
|
{
|
|
|
|
|
recipe.PodLabels.Add("tests-type", testsTypeLabel);
|
|
|
|
|
recipe.PodLabels.Add("runid", NameUtils.GetRunId());
|
|
|
|
|
recipe.PodLabels.Add("testid", NameUtils.GetTestId());
|
2023-09-26 12:32:28 +00:00
|
|
|
|
|
|
|
|
|
foreach (var pair in metadata)
|
|
|
|
|
{
|
|
|
|
|
recipe.PodLabels.Add(pair.Key, pair.Value);
|
|
|
|
|
}
|
2023-09-22 09:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|