feat: optional read-only root filesystem for run pods in the Kubernetes supervisor

Đang mở
#5,078 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
kubernetes, typescript
Lĩnh vực
backend, infrastructure

Hướng nghiên cứu

Start with apps/supervisor/src/env.ts, workloadManager/kubernetes.ts, and workloadManager/kubernetesPodSpec.ts; trace how runner security context settings and pod volumes are configured. Check the existing unit tests for runnerSecurityContext and the proposed runnerTmpVolume helper. Done means both opt-in environment variables work as described, default behavior stays unchanged, and the related tests pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Is your feature request related to a problem? Please describe.

Self-hosters running Trigger.dev on Kubernetes with Pod Security / policy engines (Kyverno, OPA Gatekeeper, CIS benchmarks, some compliance scanners) are often required to run containers with readOnlyRootFilesystem: true. The supervisor's KUBERNETES_RUNNER_SECURITY_CONTEXT (off/baseline/restricted) doesn't set it, and no Pod Security Standards level requires it, so there is currently no way to get it on run pods without patching the supervisor.

Describe the solution you'd like to see

Add two opt-in supervisor env vars:

  • KUBERNETES_RUNNER_READ_ONLY_ROOT_FILESYSTEM (boolean, default false). When true, sets securityContext.readOnlyRootFilesystem: true on the run-controller container. It composes with any KUBERNETES_RUNNER_SECURITY_CONTEXT level, including off.
  • KUBERNETES_RUNNER_TMP_VOLUME_SIZE_LIMIT (default 256Mi, blank = no per-volume cap). When read-only is enabled, an emptyDir is mounted at /tmp so tasks keep a writable os.tmpdir().

The runner runtime itself doesn't write to disk (IPC over socketpair, logs to stdout, OTLP over HTTP), so a single /tmp volume is sufficient. Default behavior is unchanged.

Describe alternate solutions
  • A mutating admission webhook injecting readOnlyRootFilesystem and a /tmp volume. This works but adds cluster-side machinery for something the supervisor can do natively.
  • Maintaining a fork of the supervisor. This is what we do today and what we'd like to stop doing.
  • Making KUBERNETES_RUNNER_SECURITY_CONTEXT=restricted imply the flag. This would break existing users, since restricted doesn't imply a read-only root.
Additional information

We already run this in a private fork (including unit tests for runnerSecurityContext and the new runnerTmpVolume helper). The change touches apps/supervisor/src/env.ts, workloadManager/kubernetes.ts and workloadManager/kubernetesPodSpec.ts, and is roughly 60 lines of source. If this direction is acceptable, we'd be happy to open a PR once vouched, so we can drop our fork.

Ngôn ngữ chính
TypeScript
Star
16.5k
Fork
1.5k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của triggerdotdev/trigger.dev

Tất cả issue của triggerdotdev/trigger.dev

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.