Fix Kubernetes namespaces for dotted usernames
Build and publish Docker image / build-and-publish (push) Successful in 8s
Build and publish Docker image / build-and-publish (push) Successful in 8s
This commit is contained in:
1 parent
522e5c5634
commit
6732ee9d47
8 files changed
+70
-19
No files matched your search
@@ -13,6 +13,7 @@ from kubernetes import client
|
||||
from kubernetes.client.rest import ApiException
|
||||
from kubernetes.stream import stream
|
||||
from kubernetes_service import custom_objects_api, k8s_manager, v1
|
||||
from namespace_utils import user_namespace
|
||||
import os
|
||||
import paramiko
|
||||
import pyotp
|
||||
@@ -1263,7 +1264,7 @@ async def handle_register(client_id, data):
|
||||
|
||||
if k8s_manager.connected:
|
||||
try:
|
||||
k8s_manager.create_namespace(f"user-{username}".lower())
|
||||
k8s_manager.create_namespace(user_namespace(username))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -2051,7 +2052,7 @@ async def handle_upload_file(client_id, data):
|
||||
})
|
||||
return
|
||||
|
||||
namespace = f"user-{user['username']}".lower()
|
||||
namespace = user_namespace(user['username'])
|
||||
pods = k8s_manager.get_pods_for_server(namespace, server_id)
|
||||
|
||||
if not pods:
|
||||
@@ -3776,7 +3777,7 @@ async def handle_delete_custom_domain(client_id, data):
|
||||
|
||||
# If domain was linked to a server, delete IngressRoute
|
||||
if domain.get('server_id'):
|
||||
namespace = f"user-{username}".lower()
|
||||
namespace = user_namespace(username)
|
||||
# Extract subdomain for IngressRoute name
|
||||
domain_name = domain['domain']
|
||||
subdomain = domain_name.split('.')[0] if '.' in domain_name else domain_name
|
||||
|
||||
Reference in new issue
Block a user