Multi-Cloud Provider Abstraction Layer (Production Blocker)
Multi-Cloud Provider Abstraction Layer
Priority: CRITICAL (Production Blocker)
Status: Not Started
Estimated Time: 3-5 days
Description
Create the foundation for multi-cloud support by implementing a provider abstraction layer that allows Genesis to work with any infrastructure provider.
Implementation Details
-
Create Provider Interface (
app/services/providers/base_provider.py):
from abc import ABC, abstractmethod
class CloudProvider(ABC):
@abstractmethod
async def create_instance(self, config: Dict) -> Dict:
"""Create compute instance"""
pass
@abstractmethod
async def start_instance(self, instance_id: str) -> bool:
pass
@abstractmethod
async def stop_instance(self, instance_id: str) -> bool:
pass
@abstractmethod
async def delete_instance(self, instance_id: str) -> bool:
pass
@abstractmethod
async def get_instance_status(self, instance_id: str) -> Dict:
pass
@abstractmethod
async def test_connection(self) -> bool:
pass
-
Database Schema Update:
- Create
CloudProviderConfigmodel - Fields: name, provider_type, config_encrypted, is_primary, is_active, priority, region, last_health_check, is_healthy
- Create
-
Update Container Model:
- Add provider_id, provider_type, provider_resource_id, provider_region, provider_metadata fields
-
Refactor Proxmox Integration:
- Create
ProxmoxProviderclass implementingCloudProvider - Migrate existing
ProxmoxServerto new architecture - Update
ProxmoxServiceto use new pattern
- Create
-
Update Service Templates:
- Add supported_providers and provider_configs fields to ServiceTemplate model
Test Strategy
- Verify Proxmox still works after refactoring
- Test provider factory pattern
- Verify database migration
- Test provider configuration API
- Unit tests for CloudProvider interface
Deliverables
- CloudProvider base class
- CloudProviderConfig model
- ProxmoxProvider implementation
- Database migration
- Updated Container model
- Provider factory
Dependencies: Tasks 1-13 (all foundation work) Labels: backend, architecture, multi-cloud, critical