2023-04-25 09:31:15 +00:00
|
|
|
|
using Logging;
|
|
|
|
|
using Utils;
|
2023-04-12 13:11:36 +00:00
|
|
|
|
|
|
|
|
|
namespace KubernetesWorkflow
|
2023-04-12 11:53:55 +00:00
|
|
|
|
{
|
|
|
|
|
public class WorkflowCreator
|
|
|
|
|
{
|
2023-04-12 13:11:36 +00:00
|
|
|
|
private readonly NumberSource numberSource = new NumberSource(0);
|
2023-04-13 09:07:36 +00:00
|
|
|
|
private readonly NumberSource containerNumberSource = new NumberSource(0);
|
2023-04-12 13:11:36 +00:00
|
|
|
|
private readonly KnownK8sPods knownPods = new KnownK8sPods();
|
2023-04-12 13:22:09 +00:00
|
|
|
|
private readonly K8sCluster cluster;
|
2023-04-25 09:31:15 +00:00
|
|
|
|
private readonly BaseLog log;
|
2023-08-07 13:51:44 +00:00
|
|
|
|
private readonly string testsType;
|
2023-05-03 12:55:26 +00:00
|
|
|
|
private readonly string testNamespace;
|
2023-04-12 13:22:09 +00:00
|
|
|
|
|
2023-08-07 13:51:44 +00:00
|
|
|
|
public WorkflowCreator(BaseLog log, Configuration configuration, string testsType)
|
|
|
|
|
: this(log, configuration, testsType, Guid.NewGuid().ToString().ToLowerInvariant())
|
2023-06-23 06:57:31 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-07 13:51:44 +00:00
|
|
|
|
public WorkflowCreator(BaseLog log, Configuration configuration, string testsType, string testNamespacePostfix)
|
2023-04-12 13:22:09 +00:00
|
|
|
|
{
|
|
|
|
|
cluster = new K8sCluster(configuration);
|
2023-04-25 09:31:15 +00:00
|
|
|
|
this.log = log;
|
2023-08-07 13:51:44 +00:00
|
|
|
|
this.testsType = testsType;
|
2023-06-23 06:57:31 +00:00
|
|
|
|
testNamespace = testNamespacePostfix;
|
2023-04-12 13:22:09 +00:00
|
|
|
|
}
|
2023-04-12 11:53:55 +00:00
|
|
|
|
|
|
|
|
|
public StartupWorkflow CreateWorkflow()
|
|
|
|
|
{
|
2023-04-13 09:07:36 +00:00
|
|
|
|
var workflowNumberSource = new WorkflowNumberSource(numberSource.GetNextNumber(),
|
|
|
|
|
containerNumberSource);
|
2023-04-12 13:11:36 +00:00
|
|
|
|
|
2023-08-07 13:51:44 +00:00
|
|
|
|
return new StartupWorkflow(log, workflowNumberSource, cluster, knownPods, testNamespace, testsType);
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|