apiVersion: v1 kind: ConfigMap metadata: name: smarketing-frontend-config namespace: ${namespace} data: runtime-env.js: | console.log('=== RUNTIME-ENV.JS 로드됨 (배포 환경) ==='); window.__runtime_config__ = { // 백엔드 API 구조에 맞게 URL 설정 AUTH_URL: '${auth_url}', MEMBER_URL: '${member_url}', STORE_URL: '${store_url}', MENU_URL: '${menu_url}', SALES_URL: '${sales_url}', CONTENT_URL: '${content_url}', RECOMMEND_URL: '${recommend_url}', // Gateway URL (운영 환경) GATEWAY_URL: 'http://${ingress_host}', // 기능 플래그 FEATURES: { ANALYTICS: true, PUSH_NOTIFICATIONS: true, SOCIAL_LOGIN: false, MULTI_LANGUAGE: false, API_HEALTH_CHECK: true, }, // 환경 설정 (배포 환경) ENV: 'production', DEBUG: false, // API 타임아웃 설정 API_TIMEOUT: 30000, // 재시도 설정 RETRY_ATTEMPTS: 3, RETRY_DELAY: 1000, // 버전 정보 VERSION: '1.0.0', BUILD_DATE: new Date().toISOString() }; // 설정 검증 함수 const validateConfig = () => { const config = window.__runtime_config__; const requiredUrls = ['AUTH_URL', 'STORE_URL', 'SALES_URL', 'RECOMMEND_URL']; for (const url of requiredUrls) { if (!config[url]) { console.error(`❌ [CONFIG] 필수 URL 누락: ${url}`); return false; } } console.log('✅ [CONFIG] 설정 검증 완료'); return true; }; // 전역 설정 접근 함수 window.getApiConfig = () => window.__runtime_config__; window.getApiUrl = (serviceName) => { const config = window.__runtime_config__; const urlKey = `${serviceName.toUpperCase()}_URL`; return config[urlKey] || null; }; // 설정 검증 실행 validateConfig(); console.log('✅ [RUNTIME] 런타임 설정 로드 완료 (배포 환경)'); --- apiVersion: apps/v1 kind: Deployment metadata: name: smarketing-frontend namespace: ${namespace} labels: app: smarketing-frontend spec: replicas: ${replicas} selector: matchLabels: app: smarketing-frontend template: metadata: labels: app: smarketing-frontend spec: imagePullSecrets: - name: acr-secret containers: - name: smarketing-frontend image: ${smarketing_frontend_image_path} imagePullPolicy: Always ports: - containerPort: ${export_port} resources: requests: cpu: ${resources_requests_cpu} memory: ${resources_requests_memory} limits: cpu: ${resources_limits_cpu} memory: ${resources_limits_memory} volumeMounts: - name: runtime-config mountPath: /usr/share/nginx/html/runtime-env.js subPath: runtime-env.js livenessProbe: httpGet: path: /health port: ${export_port} initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 3 readinessProbe: httpGet: path: /health port: ${export_port} initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 3 volumes: - name: runtime-config configMap: name: smarketing-frontend-config --- apiVersion: v1 kind: Service metadata: name: smarketing-frontend-service namespace: ${namespace} labels: app: smarketing-frontend spec: type: LoadBalancer ports: - port: 80 targetPort: ${export_port} protocol: TCP name: http selector: app: smarketing-frontend