Skip to content

Conversation

@Arshardh
Copy link
Contributor

@Arshardh Arshardh commented Feb 11, 2026

Summary by CodeRabbit

  • New Features
    • Added LLM proxy deployment management with endpoints to deploy, undeploy, restore, and delete proxy deployments.
    • Enabled querying deployment status with optional filtering by gateway and status.
    • Added internal gateway endpoint for retrieving active LLM proxy deployment configurations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Walkthrough

This PR introduces LLM proxy deployment management, a parallel system to existing LLM provider deployments. It adds data types, services, handlers, and event broadcasting for deploying, undeploying, restoring, and deleting LLM proxy deployments. Configuration updates skip JWT authentication for the new internal endpoint, and API documentation adds full endpoint definitions.

Changes

Cohort / File(s) Summary
Configuration
platform-api/src/config/config.go
Updated JWT skip paths to include /api/internal/v1/llm-proxies, expanding unauthenticated endpoint coverage.
Domain Models
platform-api/src/internal/model/gateway_event.go
Added LLMProxyDeploymentEvent and LLMProxyUndeploymentEvent types with proxy, deployment, vhost, and environment metadata.
DTOs
platform-api/src/internal/dto/gateway_event.go, platform-api/src/internal/dto/llm_deployment.go
Introduced event DTOs (LLMProxyDeploymentEventDTO, LLMProxyUndeploymentEventDTO) and YAML deployment schema types (LLMProxyDeploymentYAML, LLMProxyDeploymentSpec) for marshaling proxy deployments.
Service Layer — Events & Internal
platform-api/src/internal/service/gateway_events.go, platform-api/src/internal/service/gateway_internal.go
Added broadcast methods for proxy deployment/undeployment events; added GetActiveLLMProxyDeploymentByGateway method and injected LLMProxyRepository into GatewayInternalAPIService.
Service Layer — Deployment
platform-api/src/internal/service/llm_deployment.go
Introduced LLMProxyDeploymentService with full lifecycle management: deploy, undeploy, restore, delete, get, list operations; includes YAML generation and event broadcasting.
Handler Layer
platform-api/src/internal/handler/llm_deployment.go, platform-api/src/internal/handler/gateway_internal.go
Added LLMProxyDeploymentHandler with endpoints for proxy deployment CRUD operations; added GetLLMProxy handler in GatewayInternalAPIHandler for internal proxy retrieval.
Utilities
platform-api/src/internal/utils/common.go
Introduced CreateLLMProxyYamlZip function to package proxy YAML configurations into ZIP archives, mirroring existing provider/API utilities.
Server Initialization
platform-api/src/internal/server/server.go
Wired LLMProxyDeploymentService and LLMProxyDeploymentHandler dependencies; registered routes; updated GatewayInternalAPIService to include LLMProxyRepository.
API Documentation
platform-api/src/resources/openapi.yaml
Defined six REST endpoints for LLM proxy deployment lifecycle: POST/GET deployments, GET/DELETE specific deployment, POST undeploy/restore operations with full response schemas.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Handler as LLMProxyDeploymentHandler
    participant Service as LLMProxyDeploymentService
    participant ProxyRepo as ProxyRepository
    participant DeployRepo as DeploymentRepository
    participant EventService as GatewayEventsService

    Client->>Handler: POST /llm-proxies/{id}/deployments
    Handler->>Handler: Validate organization & payload
    Handler->>Service: DeployLLMProxy(proxyID, req, orgUUID)
    Service->>ProxyRepo: Get proxy by ID
    ProxyRepo-->>Service: Proxy data
    Service->>Service: Generate YAML manifest
    Service->>DeployRepo: Create deployment record
    DeployRepo-->>Service: Deployment created
    Service->>EventService: BroadcastLLMProxyDeploymentEvent
    EventService-->>Service: Event broadcast result
    Service-->>Handler: DeploymentResponse
    Handler-->>Client: 201 Created
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Add support for llm provider deployment #1045 — Implements LLM provider deployment management, establishing the parallel patterns (services, handlers, event broadcasting, ZIP utilities) that this PR mirrors for LLM proxy deployments.

Suggested reviewers

  • malinthaprasan
  • dushaniw

Poem

🐰 Hops into the proxy deployment scene,
New services dance where paths have been,
Deploy, undeploy, restore with care,
YAML zips float through the air!
Events broadcast far and wide,
For LLM proxies, standing with pride. 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely empty with no content addressing any of the required template sections (Purpose, Goals, Approach, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, Test environment). Provide a comprehensive description covering all required template sections: Purpose/motivation, Goals, Implementation approach, User stories, Documentation links, Test coverage details, Security verification, and Test environment specifications.
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding proxy deployment logic for the platform API, which aligns with the substantial additions across handler, service, and DTO files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
platform-api/src/internal/utils/common.go (1)

90-120: Consider consolidating the three identical ZIP helpers into a single generic function.

CreateAPIYamlZip, CreateLLMProviderYamlZip, and CreateLLMProxyYamlZip differ only by the filename prefix. A shared helper would eliminate the duplication.

♻️ Proposed refactor
+// createYamlZip creates a ZIP file containing YAML files with the given filename prefix.
+func createYamlZip(filenamePrefix string, yamlMap map[string]string) ([]byte, error) {
+	var buf bytes.Buffer
+	zipWriter := zip.NewWriter(&buf)
+
+	for id, yamlContent := range yamlMap {
+		fileName := fmt.Sprintf("%s%s.yaml", filenamePrefix, id)
+		fileWriter, err := zipWriter.Create(fileName)
+		if err != nil {
+			if closeErr := zipWriter.Close(); closeErr != nil {
+				return nil, fmt.Errorf("failed to create file in zip: %w (close error: %v)", err, closeErr)
+			}
+			return nil, fmt.Errorf("failed to create file in zip: %w", err)
+		}
+
+		_, err = fileWriter.Write([]byte(yamlContent))
+		if err != nil {
+			if closeErr := zipWriter.Close(); closeErr != nil {
+				return nil, fmt.Errorf("failed to write file content: %w (close error: %v)", err, closeErr)
+			}
+			return nil, fmt.Errorf("failed to write file content: %w", err)
+		}
+	}
+
+	err := zipWriter.Close()
+	if err != nil {
+		return nil, fmt.Errorf("failed to close zip writer: %w", err)
+	}
+
+	return buf.Bytes(), nil
+}
+
 // CreateAPIYamlZip creates a ZIP file containing API YAML files
 func CreateAPIYamlZip(apiYamlMap map[string]string) ([]byte, error) {
-	// ... full implementation ...
+	return createYamlZip("api-", apiYamlMap)
 }
 
 // CreateLLMProviderYamlZip creates a ZIP file containing LLM provider YAML files
 func CreateLLMProviderYamlZip(providerYamlMap map[string]string) ([]byte, error) {
-	// ... full implementation ...
+	return createYamlZip("llm-provider-", providerYamlMap)
 }
 
 // CreateLLMProxyYamlZip creates a ZIP file containing LLM proxy YAML files
 func CreateLLMProxyYamlZip(proxyYamlMap map[string]string) ([]byte, error) {
-	// ... full implementation ...
+	return createYamlZip("llm-proxy-", proxyYamlMap)
 }
platform-api/src/internal/service/gateway_events.go (1)

358-502: Growing broadcast boilerplate — consider a generic broadcast helper.

The two new methods are functionally correct and consistent with the existing provider broadcast methods. However, this file now has 6+ broadcast methods with identical structure (correlation ID → serialize → validate size → build DTO → serialize DTO → get connections → fan-out with stats). Only the event type string and payload type differ.

A generic helper like broadcastEvent(gatewayID, eventType string, payload interface{}) error would collapse all of these into one-liners, making the file significantly easier to maintain as new event types are added.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant