2023-09-22 09:10:22 +00:00
|
|
|
|
using DistTestCore;
|
|
|
|
|
using KubernetesWorkflow;
|
2023-11-12 09:07:23 +00:00
|
|
|
|
using KubernetesWorkflow.Recipe;
|
|
|
|
|
using KubernetesWorkflow.Types;
|
2023-09-22 09:10:22 +00:00
|
|
|
|
|
|
|
|
|
namespace CodexNetDeployer
|
|
|
|
|
{
|
|
|
|
|
public class K8sHook : IK8sHooks
|
|
|
|
|
{
|
|
|
|
|
private readonly string testsTypeLabel;
|
2024-02-22 13:41:07 +00:00
|
|
|
|
private readonly string deployId;
|
2023-09-26 12:32:28 +00:00
|
|
|
|
private readonly Dictionary<string, string> metadata;
|
2023-09-22 09:10:22 +00:00
|
|
|
|
|
2024-02-22 13:41:07 +00:00
|
|
|
|
public K8sHook(string testsTypeLabel, string deployId, Dictionary<string, string> metadata)
|
2023-09-22 09:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
this.testsTypeLabel = testsTypeLabel;
|
2024-02-22 13:41:07 +00:00
|
|
|
|
this.deployId = deployId;
|
2023-09-26 12:32:28 +00:00
|
|
|
|
this.metadata = metadata;
|
2023-09-22 09:10:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-13 14:09:17 +00:00
|
|
|
|
public void OnContainersStarted(RunningPod rc)
|
2023-09-22 09:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-13 14:09:17 +00:00
|
|
|
|
public void OnContainersStopped(RunningPod rc)
|
2023-09-22 09:10:22 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnContainerRecipeCreated(ContainerRecipe recipe)
|
|
|
|
|
{
|
|
|
|
|
recipe.PodLabels.Add("tests-type", testsTypeLabel);
|
2024-02-22 13:41:07 +00:00
|
|
|
|
recipe.PodLabels.Add("deployid", deployId);
|
2023-09-22 09:10:22 +00:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|