Rendering endpoint see history edit this page

Talks about: , , and

Send a GET to the rendering endpoint with a snippet name and JaaS returns the evaluated Jsonnet as JSON:

curl http://127.0.0.1:8080/jsonnet/example1

The Jsonnet server binds 127.0.0.1:8080 by default (--listen-address, --port). The URL shape is GET /<jsonnet-endpoint-path>/{snippet...}, where {snippet...} is a trailing path segment that may contain slashes. A successful response carries Content-Type: application/json and the rendered document.

The endpoint path

The leading path segment defaults to jsonnet and is set with --jsonnet-endpoint-path. Running with --jsonnet-endpoint-path render moves the endpoint to GET /render/{snippet...}:

./jaas --jsonnet-endpoint-path render --snippet-directory examples/snippets/dashboards
curl http://127.0.0.1:8080/render/example1

Snippet resolution

The {snippet...} segment names which file JaaS evaluates. Resolution checks the --snippet files first, then looks for <name>/main.jsonnet under each --snippet-directory. See Snippets and libraries for how to declare both.

Resolution is sandboxed through Go’s os.Root, which rejects .. traversal and symlinks that escape the configured directory. A crafted URL never reaches a file outside the snippet roots:

curl -i http://127.0.0.1:8080/jsonnet/../etc/passwd
# HTTP/1.1 404 Not Found

Management probes

A second HTTP server — the management server — exposes the Kubernetes lifecycle probes. It binds 127.0.0.1:8081 by default (--management-listen-address, --management-port):

PathMeaning
/liveLiveness. Unconditional 200.
/startStartup. Consults health state; 200 once started, otherwise 503 + JSON.
/readyReadiness. Consults health state; 200 when ready, otherwise 503 + JSON.

A not-ready probe returns a JSON body naming the state:

curl -i http://127.0.0.1:8081/ready
# HTTP/1.1 503 Service Unavailable
# {"status":"not ready"}

Error contract

Every non-2xx response carries a JSON body with Content-Type: application/json so programmatic callers can pick the failure apart:

{
  "error":   "snippet_not_found",
  "message": "snippet \"missing\" not found",
  "snippet": "missing"
}

The error field is a stable identifier — callers match on it, and these strings do not change. The message field carries human-readable detail. The snippet field echoes the requested name when one was parsed, and is omitted otherwise.

errorHTTP statusWhen
method_not_allowed405Anything other than GET on the endpoint.
snippet_not_found404The requested snippet name resolves to no file.
evaluation_timeout504Evaluation exceeded --evaluation-timeout.
evaluation_unavailable503The concurrent-eval cap (--max-concurrent-evals) is full.
evaluation_failed400go-jsonnet returned an error (syntax, missing import, stack-limit exceeded).

For evaluation_failed, message is the raw go-jsonnet diagnostic, including the file and line numbers from the snippet on disk. That diagnostic can name on-disk paths, so treat it as cluster-internal detail.

A client that closes the connection mid-evaluation receives no body and no status line — the handler detects the cancellation and returns without writing anything.

The timeout, stack, and concurrency caps that drive evaluation_timeout and evaluation_unavailable are documented in Evaluation and security . To pass values into a render, see External variables and TLAs .