ome-projects/ome

Task 4: BaseModel Controller PVC Handling

Open

#164 ouverte le 11 juil. 2025

Voir sur GitHub
 (4 commentaires) (0 réactions) (1 assigné)Go (81 forks)github user discovery
featuregood first issuehigh-priority

Métriques du dépôt

Stars
 (463 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

Task 4: BaseModel Controller PVC Handling

Overview

Update the BaseModel controller to handle the complete PVC storage flow: validation, job creation, and status management. This replaces the original design where model agent was involved.

Scope

  • Add PVC validation logic to controller reconciliation
  • Create metadata extraction jobs for PVC models
  • Monitor job status and update BaseModel accordingly
  • Handle all PVC-related errors and edge cases

Files to Modify

  • pkg/controller/v1beta1/basemodel/controller.go - Main implementation
  • config/rbac/role.yaml - Add PVC and Job permissions
  • pkg/controller/v1beta1/basemodel/controller_test.go - Tests

Implementation Details

Key Functions to Add

  1. PVC Detection in Reconcile Loop

    • Check if BaseModel uses PVC storage URI
    • Route to PVC-specific reconciliation logic
    • Maintain existing behavior for non-PVC models
  2. PVC Validation

    • Parse PVC URI to extract components
    • Verify PVC exists in the same namespace
    • Check PVC binding status
    • Update BaseModel status with validation results
  3. Metadata Extraction Job Management

    • Create Kubernetes Job for metadata extraction
    • Job should mount PVC read-only
    • Monitor job status (running, succeeded, failed)
    • Handle job lifecycle (creation, monitoring, cleanup)
  4. Status Updates

    • Update BaseModel status based on PVC and job states
    • Store PVC information in status annotations
    • Clear node-related status fields (not applicable for PVC)
    • Handle error messages and failure reasons

Job Specification Requirements

The metadata extraction job should:

  • Use the ome-agent image with model-metadata command
  • Mount the PVC at a specific path with subpath support
  • Run with appropriate resource limits
  • Have a reasonable timeout (e.g., 5 minutes)
  • Include TTL for automatic cleanup
  • Use dedicated ServiceAccount with minimal permissions

Controller Watch Configuration

Update the controller to:

  • Watch owned Jobs for status updates
  • Filter ConfigMap watches to exclude PVC models
  • Add appropriate event handlers

Test Cases

  1. Valid PVC Flow:

    • PVC exists and is bound
    • Job created successfully
    • Metadata extracted and updated
    • Status becomes Ready
  2. PVC Validation:

    • PVC not found
    • PVC not bound
    • Invalid PVC URI
  3. Job Management:

    • Job creation
    • Job success handling
    • Job failure handling
    • Job already exists
  4. Edge Cases:

    • Metadata already populated
    • Job timeout
    • Controller restart during job

Acceptance Criteria

  • Controller validates PVC existence and binding
  • Creates metadata extraction job with correct spec
  • Monitors job status and updates BaseModel accordingly
  • Handles all error cases gracefully
  • Status reflects PVC storage accurately
  • No interference with non-PVC models
  • Comprehensive test coverage

Dependencies

  • Task 1: Storage URI Parsing
  • Task 3: Model Metadata Agent

Estimated Effort

5-6 hours (increased due to complete flow ownership)

Guide contributeur