2023-04-25 11:31:15 +02:00
|
|
|
|
using Logging;
|
|
|
|
|
|
using Utils;
|
2023-04-12 15:11:36 +02:00
|
|
|
|
|
|
|
|
|
|
namespace KubernetesWorkflow
|
2023-04-12 13:53:55 +02:00
|
|
|
|
{
|
|
|
|
|
|
public class WorkflowCreator
|
|
|
|
|
|
{
|
2023-04-12 15:11:36 +02:00
|
|
|
|
private readonly NumberSource numberSource = new NumberSource(0);
|
2023-04-13 11:07:36 +02:00
|
|
|
|
private readonly NumberSource containerNumberSource = new NumberSource(0);
|
2023-04-12 15:11:36 +02:00
|
|
|
|
private readonly KnownK8sPods knownPods = new KnownK8sPods();
|
2023-04-12 15:22:09 +02:00
|
|
|
|
private readonly K8sCluster cluster;
|
2023-04-25 11:31:15 +02:00
|
|
|
|
private readonly BaseLog log;
|
2023-05-03 14:55:26 +02:00
|
|
|
|
private readonly string testNamespace;
|
2023-04-12 15:22:09 +02:00
|
|
|
|
|
2023-09-04 10:08:34 +03:00
|
|
|
|
public WorkflowCreator(BaseLog log, Configuration configuration, string testNamespace)
|
2023-04-12 15:22:09 +02:00
|
|
|
|
{
|
|
|
|
|
|
cluster = new K8sCluster(configuration);
|
2023-04-25 11:31:15 +02:00
|
|
|
|
this.log = log;
|
2023-08-10 13:58:50 +02:00
|
|
|
|
this.testNamespace = testNamespace.ToLowerInvariant();
|
2023-04-12 15:22:09 +02:00
|
|
|
|
}
|
2023-04-12 13:53:55 +02:00
|
|
|
|
|
2023-09-11 16:57:57 +02:00
|
|
|
|
public IStartupWorkflow CreateWorkflow()
|
2023-04-12 13:53:55 +02:00
|
|
|
|
{
|
2023-04-13 11:07:36 +02:00
|
|
|
|
var workflowNumberSource = new WorkflowNumberSource(numberSource.GetNextNumber(),
|
|
|
|
|
|
containerNumberSource);
|
2023-04-12 15:11:36 +02:00
|
|
|
|
|
2023-09-04 10:08:34 +03:00
|
|
|
|
return new StartupWorkflow(log, workflowNumberSource, cluster, knownPods, testNamespace);
|
2023-04-12 13:53:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|