Connect workspaces to an environment with a session

A session is the only link between workspaces and an environment. A workspace in a session resolves the environment's services by bare name, exactly as the services resolve each other. Joining and lea

A session is the only link between workspaces and an environment. A workspace in a session resolves the environment's services by bare name, exactly as the services resolve each other. Joining and leaving take effect on a running workspace without a restart. Sandboxes and benches connect the same way: a sandbox is created with a session, and a bench belongs to exactly one session.

API
curl -sS -X POST https://dev.kloudlite.io/v1/sessions \  -H "Authorization: Bearer $KL_TOKEN" -H 'content-type: application/json' \  -d '{"name": "debug-api", "team": "acme", "environment": "env-2b8c…"}'curl -sS -X POST https://dev.kloudlite.io/v1/sessions/$SESSION/workspaces \  -H "Authorization: Bearer $KL_TOKEN" -H 'content-type: application/json' \  -d '{"workspace": "'$WS'"}'

Then, inside the workspace:

bash
psql postgres://postgres:dev@db:5432/postgrescurl http://api:8080/health

Rules

  • One session per workspace. Any session in team T may connect to any environment of team T.
  • Membership is managed from outside the workspace. Inside it, kl env list and kl env current only show the connection.
  • Leave with DELETE /v1/sessions/{id}/workspaces/{workspace}; ending the session (DELETE /v1/sessions/{id}) disconnects every member.

Idle

Idle belongs to the session. It stays active while any member is in use or you hold it (POST /v1/sessions/{id}/hold; a laptop tunnel does this for you). After the idle time with no use, the session's members stop and its environment stops when no awake session is on it. Using the session again wakes everything. A workspace in no session keeps its own idle clock.

Next step

Take over one of the environment's services so its traffic lands in the workspace: Intercepts.