return domains of internal apps

This commit is contained in:
Maarten de Waard 2022-09-26 13:42:13 +02:00
parent a2019a32d0
commit fd28d5b774
No known key found for this signature in database
GPG key ID: 1D3E893A657CC8DA
3 changed files with 27 additions and 4 deletions

View file

@ -33,14 +33,22 @@ class App(db.Model):
if self.external:
return self.url
# TODO: Get URL from Kubernetes
return "unknown"
# Get domain name from configmap
ks_config_map = k8s.get_kubernetes_config_map_data(
f"stackspin-{self.slug}-kustomization-variables",
"flux-system")
domain_key = f"{self.slug}_domain"
if ks_config_map is None or domain_key not in ks_config_map.keys():
return None
return ks_config_map[domain_key]
def get_status(self):
"""Returns a string that describes the app state in the cluster"""
if self.external:
return("External app")
return "External app"
# TODO: Get some kind of caching for those values, as this is called