feat(supervisor): parameterize worker pod annotations, securityContext, SA, envFrom#3758
Conversation
Merge upstream main into our main
…t, SA, envFrom The Kubernetes workload manager now reads five new env vars from the supervisor process and applies them to every spawned worker pod: - KUBERNETES_WORKER_POD_ANNOTATIONS (JSON, Record<string,string>) - KUBERNETES_WORKER_POD_SECURITY_CONTEXT (JSON, V1PodSecurityContext) - KUBERNETES_WORKER_CONTAINER_SECURITY_CONTEXT (JSON, V1SecurityContext) - KUBERNETES_WORKER_SERVICE_ACCOUNT (string, SA name) - KUBERNETES_WORKER_ENV_FROM_SECRET (string, Secret name) All five are optional. When unset, behavior matches today. Lets compliance-sensitive deployments (Red Hat OpenShift, FedRAMP/IL5 environments, restricted PSA namespaces) configure worker pods through the Helm chart instead of patching the supervisor image. Also unblocks operators who need worker pods to: - Carry custom annotations (e.g. service mesh sidecar opt-out, audit tags) - Run under specific UIDs / capabilities / seccomp profiles - Use a non-default ServiceAccount (e.g. for IRSA / Workload Identity) - Inherit a batch of env vars from a Secret via envFrom Includes envUtil helper + tests for JSON parsing of the structured envs. The supervisor.yaml Helm template emits these env vars from values when set; schema added under supervisor.config.kubernetes.* in values.yaml. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
Hi @ConProgramming, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughThis PR extends Kubernetes worker pod configuration by introducing reusable JSON environment variable parsing schemas, adding new supervisor environment variables for worker service accounts, pod annotations, and security contexts, integrating these configurations into the KubernetesWorkloadManager to conditionally apply settings to pod specs, and exposing the new options through Helm chart values and templates. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Parameterizes worker pod metadata, securityContext, ServiceAccount, and envFrom-Secret via five new optional env vars on the supervisor process, plus matching Helm values. Lets operators configure compliance-required pod settings (annotations, runAsNonRoot, capabilities.drop, seccompProfile, etc.) without patching the supervisor image.
Discovered while rebasing our trigger.dev fork for a FedRAMP environment — Red Hat OpenShift's restricted SCC + pod-security admission policy reject worker pods that don't carry these settings.
Changes
KUBERNETES_WORKER_POD_ANNOTATIONS,_POD_SECURITY_CONTEXT,_CONTAINER_SECURITY_CONTEXT,_SERVICE_ACCOUNT,_ENV_FROM_SECRET(all optional, JSON-encoded for structured ones)envUtil.tshelper for JSON parsing + Zod validation, with testsworkloadManager/kubernetes.tsapplies parsed values to V1Pod specsupervisor.yamlemits the env vars when corresponding values are set; newsupervisor.config.kubernetes.workerPod*keys invalues.yamlTest plan
Notes
Made with Cursor
Made with Cursor