(feat) Temporal SDK client, worker mgmt, k8s deployments (#10)
CI / CI (push) Successful in 4m11s

## Changes
- `internal/temporal/client.go` — Robust Temporal client with retry (exp backoff), TLS, health check
- `internal/temporal/worker.go` — Worker creation, activity/workflow registration, lifecycle
- `internal/temporal/context.go` — Timeout helpers
- `k8s/worker-deployment.yaml` — 2-10 replica HPA, liveness/readiness probes, security context, pod anti-affinity
- `k8s/workflow-runner-deployment.yaml` — Singleton runner with probes
- `k8s/kustomization.yaml` — Updated resource list

Co-authored-by: poimen <[email protected]>
This commit was merged in pull request #10.
This commit is contained in:
2026-09-09 00:03:00 +00:00
co-authored by poimen
parent e5a773054b
commit 76d8c518f0
15 changed files with 1034 additions and 30 deletions
+15 -1
View File
@@ -3,6 +3,7 @@ package activity
import (
"context"
"fmt"
"os"
"github.com/rockliang/poimen/workflows/activity/llm"
"github.com/rockliang/poimen/workflows/pkg/types"
@@ -44,11 +45,17 @@ func LLMInferenceActivity(ctx context.Context, in LLMInferenceInput) (LLMInferen
return output, fmt.Errorf("failed to create LLM client: %w", err)
}
// Use provided auth token, or fallback to environment variable
authToken := in.AuthToken
if authToken == "" {
authToken = os.Getenv("LLM_AUTH_TOKEN")
}
response, err := client.CreateMessage(ctx, llm.MessageInput{
Model: types.ModelSpec{ModelID: in.Model},
SystemPrompt: in.SystemPrompt,
Messages: []llm.MessageParam{{Role: "user", Content: in.UserPrompt}},
AuthToken: in.AuthToken,
AuthToken: authToken,
})
if err != nil {
output.ErrorMessage = err.Error()
@@ -94,11 +101,18 @@ func LLMBatchInferenceActivity(ctx context.Context, in LLMBatchInferenceInput) (
return output, fmt.Errorf("failed to create LLM client: %w", err)
}
// Use provided auth token, or fallback to environment variable
authToken := in.AuthToken
if authToken == "" {
authToken = os.Getenv("LLM_AUTH_TOKEN")
}
for i, prompt := range in.Prompts {
response, err := client.CreateMessage(ctx, llm.MessageInput{
Model: types.ModelSpec{ModelID: in.Model},
SystemPrompt: in.SystemPrompt,
Messages: []llm.MessageParam{{Role: "user", Content: prompt}},
AuthToken: authToken,
})
if err != nil {
output.Errors = append(output.Errors, fmt.Sprintf("prompt %d: %v", i, err))