(feat) Temporal SDK client, worker mgmt, k8s deployments (#10)
CI / CI (push) Successful in 4m11s
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:
@@ -0,0 +1,140 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: poimen-workflow-runner-config
|
||||
namespace: poimen
|
||||
data:
|
||||
TEMPORAL_HOSTPORT: "temporal-frontend.temporal.svc.cluster.local:7233"
|
||||
TEMPORAL_NAMESPACE: "default"
|
||||
LOG_LEVEL: "info"
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: poimen-workflow-runner
|
||||
namespace: poimen
|
||||
labels:
|
||||
app: poimen-workflow-runner
|
||||
component: workflow-runner
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: poimen-workflow-runner
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: poimen-workflow-runner
|
||||
component: workflow-runner
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "8081"
|
||||
prometheus.io/path: "/metrics"
|
||||
spec:
|
||||
serviceAccountName: poimen-workflow-runner
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
containers:
|
||||
- name: workflow-runner
|
||||
image: forgejo.riotpiao.com/riotpiao-poimen/poimen-workflows:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ["./poimen-workflow-runner"]
|
||||
ports:
|
||||
- name: health
|
||||
containerPort: 8081
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: TEMPORAL_HOSTPORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: poimen-workflow-runner-config
|
||||
key: TEMPORAL_HOSTPORT
|
||||
- name: TEMPORAL_NAMESPACE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: poimen-workflow-runner-config
|
||||
key: TEMPORAL_NAMESPACE
|
||||
- name: LOG_LEVEL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: poimen-workflow-runner-config
|
||||
key: LOG_LEVEL
|
||||
- name: ANTHROPIC_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: poimen-secrets
|
||||
key: anthropic-api-key
|
||||
- name: MEMORY_SERVICE_URL
|
||||
value: "http://poimen-memory.poimen.svc.cluster.local:8080"
|
||||
- name: MEMORY_SERVICE_JWT_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: poimen-secrets
|
||||
key: memory-service-jwt
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health/live
|
||||
port: 8081
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health/ready
|
||||
port: 8081
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 2
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
volumeMounts:
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
volumes:
|
||||
- name: tmp
|
||||
emptyDir:
|
||||
sizeLimit: 100Mi
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: poimen-workflow-runner
|
||||
namespace: poimen
|
||||
labels:
|
||||
app: poimen-workflow-runner
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: poimen-workflow-runner
|
||||
namespace: poimen
|
||||
labels:
|
||||
app: poimen-workflow-runner
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 8081
|
||||
targetPort: 8081
|
||||
protocol: TCP
|
||||
name: health
|
||||
selector:
|
||||
app: poimen-workflow-runner
|
||||
Reference in New Issue
Block a user