feat(domains): migrate user namespaces to wildcard CNAMEs
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
82fa50e9d5
commit
2768f5f97d
6 files changed
+503
-296
No files matched your search
@@ -3,7 +3,6 @@
|
||||
|
||||
from currency_service import fetch_exchange_rates
|
||||
from database_service import database_connection, dict_from_row
|
||||
from domain_runtime import domain_manager
|
||||
from domain_service import cleanup_orphaned_ingressroutes
|
||||
from kubernetes_service import k8s_manager
|
||||
import os
|
||||
@@ -175,52 +174,6 @@ def initialize_sample_data():
|
||||
else:
|
||||
logger.info(f"✓ Sample user exists: {existing_user['username']}")
|
||||
|
||||
# CREATE USER DOMAIN IN DNS IF IT DOESN'T EXIST
|
||||
if domain_manager and existing_user:
|
||||
try:
|
||||
logger.info(f"Checking/Creating domain for user: u-{existing_user['username']}.{domain_manager.base_domain}")
|
||||
|
||||
# Check if user domain exists
|
||||
user_domain = f"u-{existing_user['username']}.{domain_manager.base_domain}"
|
||||
domain_exists = domain_manager._check_domain_exists(user_domain)
|
||||
|
||||
if domain_exists is None:
|
||||
logger.error(f"Error checking domain {user_domain}")
|
||||
elif not domain_exists:
|
||||
logger.info(f"User domain doesn't exist, creating: {user_domain}")
|
||||
success = domain_manager._create_domain(user_domain)
|
||||
if success:
|
||||
logger.info(f"✓ Created user domain: {user_domain}")
|
||||
|
||||
# SETUP DNSSEC DELEGATION for new domain
|
||||
logger.info("Setting up DNSSEC delegation...")
|
||||
dnssec_result = domain_manager.setup_dnssec_delegation(existing_user['username'])
|
||||
if dnssec_result.get('success'):
|
||||
logger.info(f"✓ DNSSEC delegation configured")
|
||||
else:
|
||||
logger.warning(f"⚠ DNSSEC setup issues: {dnssec_result.get('message')}")
|
||||
|
||||
# Also create a default subdomain for testing
|
||||
test_result = domain_manager.create_subdomain(existing_user['username'], 'test')
|
||||
if test_result.get('success'):
|
||||
logger.info(f"✓ Created test subdomain for user")
|
||||
else:
|
||||
logger.error(f"✗ Failed to create test subdomain: {test_result.get('message')}")
|
||||
else:
|
||||
logger.error(f"✗ Failed to create user domain: {user_domain}")
|
||||
else:
|
||||
logger.info(f"✓ User domain already exists: {user_domain}")
|
||||
|
||||
# ENSURE DNSSEC IS PROPERLY CONFIGURED for existing domain
|
||||
logger.info("Ensuring DNSSEC is properly configured...")
|
||||
dnssec_result = domain_manager.setup_dnssec_delegation(existing_user['username'])
|
||||
if dnssec_result.get('success'):
|
||||
logger.info(f"✓ DNSSEC properly configured")
|
||||
else:
|
||||
logger.warning(f"⚠ DNSSEC configuration issues: {dnssec_result.get('message')}")
|
||||
except Exception as e:
|
||||
logger.error(f"Error creating user domain: {e}")
|
||||
|
||||
if k8s_manager.connected:
|
||||
try:
|
||||
k8s_manager.create_namespace('user-testuser')
|
||||
|
||||
Reference in new issue
Block a user