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"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/rockliang/poimen/workflows/statemachine"
|
"github.com/rockliang/poimen/workflows/statemachine"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
var (
|
||||||
// LocalLLMBaseURL is the base URL for the local LLM API (OpenAI-compatible)
|
// LocalLLMBaseURL is the base URL for the local LLM API (OpenAI-compatible)
|
||||||
// Points to homelab-frontend gateway
|
// Can be overridden via LOCAL_LLM_BASE_URL env var (for Kubernetes internal service)
|
||||||
LocalLLMBaseURL = "https://api.riotpiao.com"
|
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 (
|
var (
|
||||||
// SupportedModels maps local model names to verify they exist
|
// SupportedModels maps local model names to verify they exist
|
||||||
SupportedModels = map[string]bool{
|
SupportedModels = map[string]bool{
|
||||||
|
|||||||
+2
-2
@@ -9,6 +9,6 @@ metadata:
|
|||||||
app.kubernetes.io/name: poimen
|
app.kubernetes.io/name: poimen
|
||||||
app.kubernetes.io/component: orchestrator
|
app.kubernetes.io/component: orchestrator
|
||||||
data:
|
data:
|
||||||
GIT_COMMIT: "166674d" # Updated automatically by CI/CD
|
GIT_COMMIT: "74a8f2e8" # Updated automatically by CI/CD
|
||||||
GIT_BRANCH: "main"
|
GIT_BRANCH: "main"
|
||||||
DEPLOYMENT_DATE: "2026-08-30"
|
DEPLOYMENT_DATE: "2026-08-31"
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: poimen-secrets
|
name: poimen-secrets
|
||||||
key: ANTHROPIC_API_KEY
|
key: ANTHROPIC_API_KEY
|
||||||
|
- name: LOCAL_LLM_BASE_URL
|
||||||
|
value: "http://api-gateway.api:8080"
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
memory: "512Mi"
|
memory: "512Mi"
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: poimen-worker
|
app: poimen-worker
|
||||||
annotations:
|
annotations:
|
||||||
git-commit: "166674d" # ✅ Updated on each push, triggers rolling restart
|
git-commit: "74a8f2e8" # ✅ Updated on each push, triggers rolling restart
|
||||||
deployment-date: "2026-08-30"
|
deployment-date: "2026-08-31"
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: worker
|
- name: worker
|
||||||
@@ -51,6 +51,8 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: poimen-secrets
|
name: poimen-secrets
|
||||||
key: ANTHROPIC_API_KEY
|
key: ANTHROPIC_API_KEY
|
||||||
|
- name: LOCAL_LLM_BASE_URL
|
||||||
|
value: "http://api-gateway.api:8080"
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
memory: "512Mi"
|
memory: "512Mi"
|
||||||
|
|||||||
Reference in New Issue
Block a user