fix(llm): make API URL configurable for Kubernetes internal service
ci / test (push) Successful in 1m51s
ci / test (push) Successful in 1m51s
Issue: Orchestrator pods failing with 'api.riotpiao.com is unreachable' - URL was hardcoded to external hostname - Inside Kubernetes cluster, needs to use internal service DNS Changes: - Make LocalLLMBaseURL read from LOCAL_LLM_BASE_URL env var - Default to 'https://api.riotpiao.com' for external deployments - Update orchestrator-job.yaml to pass internal service: http://api-gateway.api:8080 - Update worker-deployment.yaml to use same internal service URL This allows pods to reach the LLM API via Kubernetes DNS without external network access.
This commit is contained in:
+12
-3
@@ -7,16 +7,25 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/rockliang/poimen/workflows/statemachine"
|
||||
)
|
||||
|
||||
const (
|
||||
var (
|
||||
// LocalLLMBaseURL is the base URL for the local LLM API (OpenAI-compatible)
|
||||
// Points to homelab-frontend gateway
|
||||
LocalLLMBaseURL = "https://api.riotpiao.com"
|
||||
// Can be overridden via LOCAL_LLM_BASE_URL env var (for Kubernetes internal service)
|
||||
LocalLLMBaseURL string
|
||||
)
|
||||
|
||||
func init() {
|
||||
LocalLLMBaseURL = os.Getenv("LOCAL_LLM_BASE_URL")
|
||||
if LocalLLMBaseURL == "" {
|
||||
// Default: external hostname (for local dev)
|
||||
LocalLLMBaseURL = "https://api.riotpiao.com"
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
// SupportedModels maps local model names to verify they exist
|
||||
SupportedModels = map[string]bool{
|
||||
|
||||
+2
-2
@@ -9,6 +9,6 @@ metadata:
|
||||
app.kubernetes.io/name: poimen
|
||||
app.kubernetes.io/component: orchestrator
|
||||
data:
|
||||
GIT_COMMIT: "166674d" # Updated automatically by CI/CD
|
||||
GIT_COMMIT: "74a8f2e8" # Updated automatically by CI/CD
|
||||
GIT_BRANCH: "main"
|
||||
DEPLOYMENT_DATE: "2026-08-30"
|
||||
DEPLOYMENT_DATE: "2026-08-31"
|
||||
|
||||
@@ -52,6 +52,8 @@ spec:
|
||||
secretKeyRef:
|
||||
name: poimen-secrets
|
||||
key: ANTHROPIC_API_KEY
|
||||
- name: LOCAL_LLM_BASE_URL
|
||||
value: "http://api-gateway.api:8080"
|
||||
resources:
|
||||
requests:
|
||||
memory: "512Mi"
|
||||
|
||||
@@ -13,8 +13,8 @@ spec:
|
||||
labels:
|
||||
app: poimen-worker
|
||||
annotations:
|
||||
git-commit: "166674d" # ✅ Updated on each push, triggers rolling restart
|
||||
deployment-date: "2026-08-30"
|
||||
git-commit: "74a8f2e8" # ✅ Updated on each push, triggers rolling restart
|
||||
deployment-date: "2026-08-31"
|
||||
spec:
|
||||
containers:
|
||||
- name: worker
|
||||
@@ -51,6 +51,8 @@ spec:
|
||||
secretKeyRef:
|
||||
name: poimen-secrets
|
||||
key: ANTHROPIC_API_KEY
|
||||
- name: LOCAL_LLM_BASE_URL
|
||||
value: "http://api-gateway.api:8080"
|
||||
resources:
|
||||
requests:
|
||||
memory: "512Mi"
|
||||
|
||||
Reference in New Issue
Block a user