Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
eaadd32
Add host type alias
sitaowang1998 Jul 16, 2026
8e4456f
Replace host in core
sitaowang1998 Jul 16, 2026
27b7e7a
Update proto serde
sitaowang1998 Jul 16, 2026
233e43b
Update scheduler
sitaowang1998 Jul 16, 2026
9d695cb
Update db
sitaowang1998 Jul 16, 2026
016bf89
Update lock
sitaowang1998 Jul 16, 2026
db62d43
feat(helm): Add scheduler service to the Helm chart.
20001020ycx Jul 16, 2026
8660491
grammar
20001020ycx Jul 17, 2026
c8d01f9
Merge branch 'main' into hostname
sitaowang1998 Jul 17, 2026
048fad8
Merge branch 'hostname' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 17, 2026
970ee69
Remove hostname resolution in helm
sitaowang1998 Jul 17, 2026
67d8bbd
Merge branch 'main' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 17, 2026
7835342
Add worker chart
sitaowang1998 Jul 17, 2026
053b119
Remove ip from em config
sitaowang1998 Jul 18, 2026
3860435
Fix lint
sitaowang1998 Jul 18, 2026
2c6ecdb
Merge branch 'em-remove-ip' into helm-worker
sitaowang1998 Jul 18, 2026
eda3a30
Remove ip
sitaowang1998 Jul 18, 2026
0fd1dca
Make worker replica configurable
sitaowang1998 Jul 18, 2026
431c8e9
Update comment.
LinZhihao-723 Jul 18, 2026
20133e0
Merge branch 'main' into em-remove-ip
sitaowang1998 Jul 18, 2026
82fd8c6
Merge branch 'em-remove-ip' into helm-worker
sitaowang1998 Jul 18, 2026
14081b2
Merge branch 'main' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 18, 2026
a952898
Merge branch 'main' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 18, 2026
4352c6a
Merge branch 'main' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 19, 2026
a2f38f3
Merge branch 'main' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 19, 2026
87d29ea
Merge branch 'feat/2026-07-16-helm-scheduler' into helm-worker
sitaowang1998 Jul 21, 2026
8234c56
Change config
sitaowang1998 Jul 21, 2026
f3cbc9a
Rename to policy
sitaowang1998 Jul 21, 2026
0b0efa1
Merge branch 'scheduler-config' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 21, 2026
6cd96d1
Update config in helm
sitaowang1998 Jul 21, 2026
36be511
Merge branch 'feat/2026-07-16-helm-scheduler' into helm-worker
sitaowang1998 Jul 21, 2026
7a23b79
Merge branch 'main' into feat/2026-07-16-helm-scheduler
sitaowang1998 Jul 21, 2026
c788de6
Merge branch 'feat/2026-07-16-helm-scheduler' into helm-worker
sitaowang1998 Jul 22, 2026
397b981
Merge branch 'main' into helm-worker
sitaowang1998 Jul 22, 2026
274c0a1
Reorder alphabetically
sitaowang1998 Jul 23, 2026
8b08049
Move replicas to worker
sitaowang1998 Jul 23, 2026
a02bf00
Add extra values
sitaowang1998 Jul 23, 2026
02e706f
Merge branch 'main' into helm-worker
sitaowang1998 Jul 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/deployment/spider-helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: "v2"
name: "spider"
description: "A Helm chart for the Spider Huntsman deployment"
type: "application"
version: "0.1.2"
version: "0.1.3"
appVersion: "0.1.0"
home: "https://github.com/y-scope/spider"
sources: ["https://github.com/y-scope/spider"]
Expand Down
13 changes: 13 additions & 0 deletions tools/deployment/spider-helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
labels:
{{- include "spider.labels" . | nindent 4 }}
data:
execution-manager.yaml: |
Comment thread
sitaowang1998 marked this conversation as resolved.
connection_pool_size: {{ .Values.spiderConfig.execution_manager.connection_pool_size }}
liveness:
{{- toYaml .Values.spiderConfig.execution_manager.liveness | nindent 6 }}
scheduler:
host: {{ include "spider.componentFullname" (dict "root" . "component" "scheduler") | quote }}
port: {{ .Values.spiderConfig.scheduler.port }}
scheduler_poll_wait_ms: {{ .Values.spiderConfig.execution_manager.scheduler_poll_wait_ms }}
storage:
host: {{ include "spider.componentFullname" (dict "root" . "component" "storage") | quote }}
port: {{ .Values.spiderConfig.storage.port }}
task_executor:
{{- toYaml .Values.spiderConfig.execution_manager.task_executor | nindent 6 }}
scheduler.yaml: |
connection_pool_size: {{ .Values.spiderConfig.scheduler.connection_pool_size }}
host: "0.0.0.0"
Expand Down
40 changes: 40 additions & 0 deletions tools/deployment/spider-helm/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: {{ include "spider.componentFullname" (dict "root" . "component" "worker") }}
labels:
{{- include "spider.labels" . | nindent 4 }}
app.kubernetes.io/component: "worker"
spec:
replicas: {{ .Values.spiderConfig.worker.replicas }}
selector:
matchLabels:
{{- include "spider.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: "worker"
template:
metadata:
labels:
{{- include "spider.labels" . | nindent 8 }}
app.kubernetes.io/component: "worker"
spec:
containers:
- name: "execution-manager"
Comment on lines +20 to +21

@hoophalab hoophalab Jul 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to inject a liveness probe? I'm not sure how spider is designed: I guess the scheduler will reschedule the job if one worker doesn't respond in X minutes, but will the worker restart automatically if there is an unexpected deadlock in user.so, or the execution manager itself?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User can set a hard timeout on a task, and task executor will be killed and retried if it exceeds the timeout.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the execution manager could still deadlock and this pod just hangs forever?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. For this PR we just assume that it will not hang. We will design and implement a proper liveness hook later.

image: {{ include "spider.imageRef" (dict "root" . "component" "worker") | quote }}
imagePullPolicy: {{ .Values.image.worker.pullPolicy | quote }}
command: ["spider-execution-manager", "--config", "/etc/spider/execution-manager.yaml"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe pod termination skips the graceful path here. Kubernetes uses SIGTERM because the worker image has no STOPSIGNAL, while the binary only awaits ctrl_c() / SIGINT; the scheduler shutdown RPC is therefore bypassed and assignments wait for cutoff recovery.

can we handle SIGTERM in the binary?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this is already tracked in #393?

@LinZhihao-723 LinZhihao-723 Jul 23, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we're aware of this issue. We (the Spider team) should try to address it next week.

{{- with .Values.spiderConfig.worker.extra_envs }}
env:
{{- range $name, $value := . }}
- name: {{ $name | quote }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
volumeMounts:
- name: "config"
mountPath: "/etc/spider/execution-manager.yaml"
subPath: "execution-manager.yaml"
readOnly: true
Comment on lines +32 to +36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the chart files and inspect the worker deployment plus related templates.
git ls-files tools/deployment/spider-helm/templates
printf '\n--- worker-deployment.yaml ---\n'
cat -n tools/deployment/spider-helm/templates/worker-deployment.yaml | sed -n '1,220p'
printf '\n--- configmap-related files ---\n'
fd -a -t f 'configmap.yaml|_helpers.tpl|deployment.yaml' tools/deployment/spider-helm/templates
for f in tools/deployment/spider-helm/templates/configmap.yaml tools/deployment/spider-helm/templates/_helpers.tpl tools/deployment/spider-helm/templates/deployment.yaml; do
  if [ -f "$f" ]; then
    printf '\n--- %s ---\n' "$f"
    cat -n "$f" | sed -n '1,260p'
  fi
done
printf '\n--- search for checksum/config and subPath usage ---\n'
rg -n "checksum/config|subPath:|mountPath:|configmap" tools/deployment/spider-helm -S

Repository: y-scope/spider

Length of output: 11654


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read only the worker deployment file if it is short enough and map the template structure.
wc -l tools/deployment/spider-helm/templates/worker-deployment.yaml
ast-grep outline tools/deployment/spider-helm/templates/worker-deployment.yaml --view expanded

Repository: y-scope/spider

Length of output: 293


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the current Helm chart's values and any rollout annotations already present.
for f in tools/deployment/spider-helm/values.yaml tools/deployment/spider-helm/templates/*.yaml; do
  [ -f "$f" ] || continue
  printf '\n--- %s ---\n' "$f"
  rg -n "checksum|rollout|annotations|subPath|ConfigMap|config" "$f" -n -S
done

Repository: y-scope/spider

Length of output: 729


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check whether the proposed annotation expression references an existing template path.
python3 - <<'PY'
from pathlib import Path
p = Path('tools/deployment/spider-helm/templates/configmap.yaml')
print(p.exists(), p)
if p.exists():
    print(p.read_text()[:500])
PY

Repository: y-scope/spider

Length of output: 712


Trigger a worker rollout when the ConfigMap changes. This Deployment mounts execution-manager.yaml through subPath, so ConfigMap updates won’t reach running workers. Add a checksum annotation under spec.template.metadata to force a new ReplicaSet when the config changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/deployment/spider-helm/templates/worker-deployment.yaml` around lines
25 - 29, Add a checksum annotation under the Deployment pod template metadata
for the ConfigMap containing execution-manager.yaml, using Helm’s rendered
ConfigMap content as the checksum source. Ensure the annotation changes whenever
the ConfigMap changes so Kubernetes creates a new ReplicaSet and workers receive
the updated subPath-mounted configuration.

Source: MCP tools

volumes:
- name: "config"
configMap:
name: {{ include "spider.componentFullname" (dict "root" . "component" "config") }}
20 changes: 20 additions & 0 deletions tools/deployment/spider-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ image:
pullPolicy: "Always"
repository: "ghcr.io/y-scope/spider/storage"
tag: "main"
worker:
pullPolicy: "Always"
repository: "ghcr.io/y-scope/spider/worker"
tag: "main"

spiderConfig:
# List of third-party services bundled (deployed) as part of the chart.
Expand All @@ -34,6 +38,18 @@ spiderConfig:
root_password: "spider-root-password"
username: "spider-user"

execution_manager:
connection_pool_size: 4
liveness:
scheduler_heartbeat_interval_sec: 10
storage_heartbeat_interval_sec: 10
scheduler_poll_wait_ms: 1000
task_executor:
bin_path: "/usr/local/bin/spider-task-executor"
inherited_env: []

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inherited_env names variables to forward into the task executor, but the Deployment exposes no env / envFrom hook, so operators cannot inject Secret-backed values through the chart. can we expose worker environment configuration alongside this option?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think this is missed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key is to allow users to define environment variables in the execution manager container. For now, we can leave inherited_env empty: the current configuration will ensure all the forked processes to automatically inherit the execution manager's environment. We only need to make sure env variables can be passed into the execution manager. @sitaowang1998 @20001020ycx Can you check this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the key is to allow users to define environment variables in the execution manager container.

This is exactly what I am doing in #2408

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I do wonder should we plan out adding some test .so within spider's worker container, such that the spider k8s can be tested as a standalone entity?

Of course, not in this PR, I am okay with leaving it empty in this PR. In fact, this should be left as empty even we have the test.so as the CLP_HOME shall be defined in the container image rather than here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think defining it in image works. Some envs are only known at deployment time. My plan is to add a extra_envs map in values, default to empty, and fill it in worker deployment's env. User can define extra_envs and pass in the values they need.

log_dir: "/tmp/spider/task-executor"

@hoophalab hoophalab Jul 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess /tmp is meant for disposable files. /var/log/spider/task-executor might be more suitable.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logs are written to stderr, and our goal is to route it into container's stdout. But I'll change the log_dir in case we change the behavior latter.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is /var/log is not writtable by a non-root user, such as spider-user. Should we use a user-owned directory?

@hoophalab hoophalab Jul 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm right. How about ~/.cache/spider/task-executor? But I haven't seen any pod use user home folder for log.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe we just mount an emptydir to /var/log/spider and set uid so that spider-user is writable?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. The logs are written to stderr, and currently redirected to {log_dir}/{em_id}-{executor_id}.log.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to an offline discussion with Zhihao, we decided to use /tmp/spider/task-executor/ for now. Next week we will fix the log routing and remove the log_dir entirely.

package_dir: "/opt/spider/packages"

scheduler:
connection_pool_size: 4
port: 50052
Expand All @@ -57,3 +73,7 @@ spiderConfig:
cleanup_capacity: 256
commit_capacity: 256
task_capacity: 1048576

worker:
extra_envs: {}
replicas: 4
Loading