First draft of ServiceInstance model

This commit is contained in:
Tobias Kunze 2025-03-27 11:26:42 +01:00
parent 2f127e94f7
commit 26a3a4942f

View file

@ -404,3 +404,35 @@ class ServiceOffering(ServalaModelMixin, models.Model):
return _("{service_name} at {provider_name}").format(
service_name=self.service.name, provider_name=self.provider.name
)
class ServiceInstance(ServalaModelMixin, models.Model):
"""
The source of truth for service instances is Kubernetes.
The Django model only contains metadata, all other information is queried
on the fly.
"""
name = models.CharField(max_length=100, verbose_name=_("Name"))
organization = models.ForeignKey(
to="core.Organization",
on_delete=models.PROTECT,
verbose_name=_("Organization"),
related_name="service_instances",
)
created_by = models.ForeignKey(
to="core.User",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="created_service_instances",
)
context = models.ForeignKey(
to="core.ServiceOfferingControlPlane",
related_name="service_instances",
on_delete=models.PROTECT,
)
class Meta:
verbose_name = _("Service instance")
verbose_name_plural = _("Service instances")