Implemented job view

This commit is contained in:
2021-04-19 01:34:33 +02:00
parent 998658c148
commit 800ed14449
9 changed files with 289 additions and 44 deletions

View File

@@ -6,6 +6,26 @@ Configuration
"""
def get_namespace():
namespace = os.environ.get("WORKING_NAMESPACE")
if namespace:
return namespace
# Try to figure out
try:
# https://github.com/kubernetes-client/python/issues/363
with open("/run/secrets/kubernetes.io/serviceaccount/namespace", "r") as f:
namespace = f.read()
except FileNotFoundError:
pass
if namespace:
return namespace
else:
raise Exception("WORKING_NAMESPACE is not configured!")
class Config:
SQLALCHEMY_DATABASE_URI = os.environ.get("SQLALCHEMY_DATABASE_URI", "sqlite://")
SQLALCHEMY_TRACK_MODIFICATIONS = False
@@ -15,3 +35,9 @@ class Config:
SENTRY_DSN = os.environ.get("SENTRY_DSN")
RELEASE_ID = os.environ.get("RELEASE_ID", "test")
RELEASEMODE = os.environ.get("RELEASEMODE", "dev")
# Technically this could differ from the one this pod is running in, but no one tests this.
WORKING_NAMESPACE = get_namespace()
AUTO_CLEANUP = bool(os.environ.get("AUTO_CLEANUP", "").upper() in ['YES', 'TRUE', '1'])
URSIM_CONTROL_IMAGE = os.environ["URSIM_CONTROL_IMAGE"]
URSIM_CONTROL_CONFIGMAP = os.environ["URSIM_CONTROL_CONFIGMAP"]