Files
SODEW/sodew-bash-main/assets/k3s/templates/worker.yaml
T
2026-08-18 09:40:08 +02:00

53 lines
2.2 KiB
YAML

{{- if .Values.workerHelm }}
---
apiVersion: apps/v1
kind: Deployment
metadata: { name: "{{ .Values.worker }}", namespace: "{{ .Values.namespace }}" }
spec:
replicas: 1
selector: { matchLabels: { app: "{{ .Values.worker }}" } }
template:
metadata: { labels: { app: "{{ .Values.worker }}" } }
spec:
containers:
- name: "{{ .Values.worker }}"
image: python:3.12-slim
imagePullPolicy: IfNotPresent
resources:
requests: { cpu: "50m", memory: "64Mi" }
limits: { cpu: "200m", memory: "256Mi" }
ports:
- { containerPort: 8080 }
workingDir: /app/agent
command: ["/bin/sh","-c"]
args:
- |
set -e
if [ ! -f /app/agent/worker.py ]; then
echo "ERROR: /app/agent/worker.py not found" >&2
ls -la /app/agent >&2 || true
exit 1
fi
exec python -u /app/agent/worker.py
env:
- { name: WORKER_UUID, value: "{{ .Values.workerUuid }}" }
- { name: WORKER_NAME, value: "{{ .Values.workerName }}" }
- { name: WORKER_POOL, value: "{{ .Values.workerPool }}" }
- { name: API_URL, value: "{{ .Values.workerApiUrl }}" }
- { name: GETTING_PAUSE, value: "{{ .Values.workerApiGettingPause }}" }
- { name: SENDING_PAUSE, value: "{{ .Values.workerApiSendingPause }}" }
volumeMounts:
- { name: "{{ .Values.worker }}-agent-volume", mountPath: /app/agent }
- { name: "{{ .Values.worker }}-tasks-volume", mountPath: /app/tasks }
readinessProbe: { httpGet: { path: /healthz, port: 8080 }, periodSeconds: 5, timeoutSeconds: 2 }
livenessProbe: { httpGet: { path: /healthz, port: 8080 }, periodSeconds: 10, timeoutSeconds: 2, failureThreshold: 3 }
startupProbe: { httpGet: { path: /healthz, port: 8080 }, periodSeconds: 2, timeoutSeconds: 2, failureThreshold: 30 }
volumes:
- name: "{{ .Values.worker }}-agent-volume"
hostPath: { path: "{{ .Values.workerAgentPath }}", type: DirectoryOrCreate }
- name: "{{ .Values.worker }}-tasks-volume"
hostPath: { path: "{{ .Values.workerTasksPath }}", type: DirectoryOrCreate }
{{- end }}