2023-04-12 13:11:36 +00:00
|
|
|
|
using Utils;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
private readonly NumberSource servicePortNumberSource = new NumberSource(30001);
|
|
|
|
|
private readonly KnownK8sPods knownPods = new KnownK8sPods();
|
2023-04-12 13:22:09 +00:00
|
|
|
|
private readonly K8sCluster cluster;
|
|
|
|
|
|
|
|
|
|
public WorkflowCreator(Configuration configuration)
|
|
|
|
|
{
|
|
|
|
|
cluster = new K8sCluster(configuration);
|
|
|
|
|
}
|
2023-04-12 11:53:55 +00:00
|
|
|
|
|
|
|
|
|
public StartupWorkflow CreateWorkflow()
|
|
|
|
|
{
|
2023-04-12 13:11:36 +00:00
|
|
|
|
var workflowNumberSource = new WorkflowNumberSource(numberSource.GetNextNumber(), servicePortNumberSource);
|
|
|
|
|
|
|
|
|
|
return new StartupWorkflow(workflowNumberSource, cluster, knownPods);
|
2023-04-12 11:53:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|