Provide full data to get_or_create_namespace
This commit is contained in:
parent
5b7c26bbac
commit
918c2a20ec
1 changed files with 3 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue