Billing Entity Management #66

Merged
rixx merged 32 commits from 54-billing-entity-management into main 2025-06-22 15:42:14 +00:00
Showing only changes of commit 918c2a20ec - Show all commits

View file

@ -210,8 +210,9 @@ class ControlPlane(ServalaModelMixin, models.Model):
except Exception as e:
return False, _("Connection error: {}").format(str(e))
def get_or_create_namespace(self, name):
def get_or_create_namespace(self, organization):
api_instance = kubernetes.client.CoreV1Api(self.get_kubernetes_client())
name = organization.namespace
try:
api_instance.read_namespace(name=name)
except kubernetes.client.ApiException as e:
@ -551,7 +552,7 @@ class ServiceInstance(ServalaModelMixin, models.Model):
@classmethod
def create_instance(cls, name, organization, context, created_by, spec_data):
# Ensure the namespace exists
context.control_plane.get_or_create_namespace(organization.namespace)
context.control_plane.get_or_create_namespace(organization)
try:
instance = cls.objects.create(
name=name,