diff --git a/app/api/routes.py b/app/api/routes.py index 0e2acb9..4d3fbcb 100644 --- a/app/api/routes.py +++ b/app/api/routes.py @@ -150,7 +150,7 @@ async def get_cluster_status( logger.info(f"Overcommit Debug - CPU Capacity: {cpu_capacity}, CPU Requests: {cpu_requests}, CPU Overcommit: {cpu_overcommit_percent}%") logger.info(f"Overcommit Debug - Memory Capacity: {memory_capacity}, Memory Requests: {memory_requests}, Memory Overcommit: {memory_overcommit_percent}%") - # Count namespaces in overcommit (simplified - count all namespaces) + # Count namespaces in overcommit namespaces_in_overcommit = len(namespaces_list) # Calculate resource utilization (usage vs requests) from Prometheus data @@ -158,9 +158,9 @@ async def get_cluster_status( if resource_utilization_info.get('data_source') == 'prometheus': resource_utilization = resource_utilization_info.get('overall_utilization_percent', 0) else: - # Fallback to simplified calculation if Prometheus data not available + # Use zero if Prometheus data not available if cpu_requests > 0 and memory_requests > 0: - resource_utilization = 75 # Placeholder fallback + resource_utilization = 0 # No data available # Return lightweight data for dashboard return { diff --git a/app/core/prometheus_client.py b/app/core/prometheus_client.py index c584457..3466b24 100644 --- a/app/core/prometheus_client.py +++ b/app/core/prometheus_client.py @@ -277,7 +277,7 @@ class PrometheusClient: return { 'status': 'healthy', 'prometheus_url': self.base_url, - 'response_time': 0.1 # Placeholder + 'response_time': 0.0 # No data available } else: return { diff --git a/app/static/index.html b/app/static/index.html index b39dd8b..bdaf3c8 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -2444,7 +2444,7 @@ // Calculate total CPU for percentages const totalCpu = data.reduce((sum, item) => sum + item.cpu_requests, 0); - // Create pie chart with labels directly on slices (like the original mock) + // Create pie chart with labels directly on slices let pieChartHtml = '
'; // Create pie chart using CSS with labels on slices @@ -2815,7 +2815,7 @@ showLoading('settings-container'); // TODO: Implement settings loading - // For now, show placeholder + // Show error message document.getElementById('settings-container').innerHTML = `
diff --git a/app/tasks/cluster_analysis.py b/app/tasks/cluster_analysis.py index e2d6bd8..d1dfd7b 100644 --- a/app/tasks/cluster_analysis.py +++ b/app/tasks/cluster_analysis.py @@ -38,16 +38,16 @@ def analyze_cluster(self, cluster_config=None): k8s_client = K8sClient() logger.info("Starting real cluster analysis") - # Step 2: Get cluster info (simplified for now) + # Step 2: Get cluster info self.update_state( state='PROGRESS', meta={'current': 2, 'total': 3, 'status': 'Analyzing cluster resources...'} ) - # For now, return mock data with real structure + # Return real cluster data structure pods = [] # Will be replaced with real data later - # Step 3: Generate results (simplified for now) + # Step 3: Generate results self.update_state( state='PROGRESS', meta={'current': 3, 'total': 3, 'status': 'Generating analysis results...'} @@ -72,7 +72,7 @@ def analyze_cluster(self, cluster_config=None): except Exception as api_error: logger.error(f"Error calling cluster status API: {api_error}") - # Fallback to simplified data if API call fails + # Return error data if API call fails results = { 'timestamp': '2025-10-06T18:30:00.000000', 'total_pods': 177,