Skip to content

Executor

The checked-in Kubernetes executor has two entrypoint modes, but only its long-lived server mode currently executes workflows.

Source:

  • apps/backend/kubernetes/executor/src/main.rs
  • packages/executor/
ModeSelectionStatus
HTTP serverEXECUTOR_SERVER_MODE=trueImplemented and used by the Helm executor pool
One-job processDefault when the variable is absent or falsePlaceholder; logs an error and exits with status 1

The Helm chart’s executorPool Deployment sets EXECUTOR_SERVER_MODE=true and exposes the executor through a ClusterIP Service. The API normally uses:

EXECUTION_BACKEND=http
EXECUTOR_URL=http://flow-like-executor-pool:8080

The actual Service name includes the Helm release/fullname prefix.

Server mode provides:

EndpointPurpose
POST /executeExecute and return a final JSON response
POST /execute/streamStream newline-delimited JSON events
POST /execute/sseStream Server-Sent Events
GET /healthExecutor health
GET /metricsPrometheus metrics

The application port defaults to 8080. A second metrics listener defaults to 9090 and exposes /metrics as well.

EXECUTOR_SERVER_MODE=true
PORT=8080
METRICS_PORT=9090

Executor behavior is configured by:

VariableDefaultPurpose
EXECUTOR_BATCH_INTERVAL_MS1000Callback event batching interval
EXECUTOR_MAX_BATCH_SIZE100Events per callback batch
EXECUTOR_CALLBACK_TIMEOUT_MS5000Callback request timeout
EXECUTOR_CALLBACK_RETRIES3Callback retry count
EXECUTOR_TIMEOUT_SECS3600Workflow execution timeout

The shared executor contract is ExecutionRequest in packages/executor/src/types.rs. It includes the application and board, payload, scoped credentials, execution JWT, callback information, board version, and optional WASM package references.

The API builds this request. Operators should not hand-construct it from a few environment variables: the credentials and JWT are part of the trust boundary.

During a run, the executor:

  1. verifies the execution JWT;
  2. constructs request-scoped Flow-Like state from the supplied credentials;
  3. loads and prepares the requested board;
  4. overlays verified WASM package artifacts when present;
  5. executes the board;
  6. returns or streams events and reports callbacks as required.

The warm pool caches prepared board data, but request-specific state and logic are stripped before cache insertion and reattached per run.

run_job_once in apps/backend/kubernetes/executor/src/main.rs currently contains only an implementation outline. It does not read RUN_ID, APP_ID, BOARD_ID, FLOW_LIKE_CREDENTIALS, FLOW_LIKE_JWT, FLOW_LIKE_CALLBACK_URL, or PAYLOAD, even though the API’s Kubernetes dispatcher places those values in created Jobs.

The process deliberately exits with status 1 and directs operators to use the executor pool.

Run the implemented server mode:

Terminal window
cd apps/backend/kubernetes/executor
EXECUTOR_SERVER_MODE=true cargo run

Then check:

Terminal window
curl http://localhost:8080/health
curl http://localhost:9090/metrics

An /execute test additionally requires a valid ExecutionRequest, signed JWT, and reachable backing services. The normal API dispatch path is the safest way to exercise that contract.