Instantiate dynamic model from instance

This commit is contained in:
Tobias Kunze 2025-05-21 09:17:09 +02:00
parent ba30fb0402
commit fd3cb6a1d4

View file

@ -651,6 +651,20 @@ class ServiceInstance(ServalaModelMixin, models.Model):
spec.pop("writeConnectionSecretToRef", None)
return spec
@cached_property
def spec_object(self):
"""Dynamically generated CRD object."""
return self.context.django_model(
name=self.name,
organization=self.organization,
context=self.context,
spec=self.spec,
# We pass -1 as ID in order to make it clear that a) this object exists (remotely),
# and b) its not a normal database object. This allows us to treat e.g. update
# forms differently from create forms.
pk=-1,
)
@cached_property
def status_conditions(self):
if not self.kubernetes_object: