Parse out spec data

This commit is contained in:
Tobias Kunze 2025-04-11 10:10:41 +02:00
parent c4522e31e8
commit 912842bd82

View file

@ -584,3 +584,16 @@ class ServiceInstance(ServalaModelMixin, models.Model):
if e.status == 404: if e.status == 404:
return None return None
raise raise
@cached_property
def spec(self):
if not self.kubernetes_object:
return {}
if not (spec := self.kubernetes_object.get("spec")):
return {}
# Remove fields that shouldn't be displayed
spec = spec.copy()
spec.pop("resourceRef", None)
spec.pop("writeConnectionSecretToRef", None)
return spec