diff --git a/KubernetesWorkflow/ApplicationLifecycle.cs b/KubernetesWorkflow/ApplicationLifecycle.cs deleted file mode 100644 index b14fe52d..00000000 --- a/KubernetesWorkflow/ApplicationLifecycle.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Utils; - -namespace KubernetesWorkflow -{ - public class ApplicationLifecycle - { - private static object instanceLock = new object(); - private static ApplicationLifecycle? instance; - private readonly NumberSource namespaceNumberSource = new NumberSource(0); - - private ApplicationLifecycle() - { - } - - public static ApplicationLifecycle Instance - { - // I know singletons are quite evil. But we need to be sure this object is created only once - // and persists for the entire application lifecycle. - get - { - lock (instanceLock) - { - if (instance == null) instance = new ApplicationLifecycle(); - return instance; - } - } - } - - public string GetTestNamespace() - { - return namespaceNumberSource.GetNextNumber().ToString("D5"); - } - } -} diff --git a/KubernetesWorkflow/WorkflowCreator.cs b/KubernetesWorkflow/WorkflowCreator.cs index 3a707cc0..d03dca77 100644 --- a/KubernetesWorkflow/WorkflowCreator.cs +++ b/KubernetesWorkflow/WorkflowCreator.cs @@ -16,7 +16,7 @@ namespace KubernetesWorkflow { cluster = new K8sCluster(configuration); this.log = log; - testNamespace = ApplicationLifecycle.Instance.GetTestNamespace(); + testNamespace = Guid.NewGuid().ToString().ToLowerInvariant(); } public StartupWorkflow CreateWorkflow()