Removes application-level managed namespaces. Use GUIDs instead.

This commit is contained in:
benbierens 2023-06-02 11:10:16 +02:00
parent 8ba4b1a290
commit 303eb99f49
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 1 additions and 35 deletions

View File

@ -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");
}
}
}

View File

@ -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()