Keep the values of a session's environment out of the Job's spec (a Secret for each session) #52

Closed
mikluko wants to merge 2 commits from server-secret into server-env
Owner

Item 2 of specs-18's request, as the owner chose it ("A"): no value of gc's environment, nor ROOMCITY_TOKEN, is written into a Job's spec. Stacked on #50 (base server-env); after #50 merges, retarget to main, no conflict expected.

  • The server makes a Secret for each session, named like its Job, before the Job: every variable gc gave the agent (less what #50 leaves out) and the server's own ROOMCITY_*. The pod reads it with envFrom; the container's own env is PATH and the paths of mounted files (path_env, ROOMCITY_SECRET_*), which win over the Secret's. The Job owns the Secret (owner reference, set once the Job has its UID), so deleting the Job, as stop, a failed start and kill-object do, removes it; Delete and DeleteObject also delete it by name.
  • No fall back: a server whose Role lacks the right gets the server may not make Secrets in the namespace ... (its Role: create, get, update and delete on secrets) as the start's error, and no Job is made. A start that finds the session's Job already there neither overwrites nor removes its Secret.
  • Tests (fake cluster): no value of the environment, no token, nowhere in the marshalled Job; the Secret holds them all and the container reads it; PATH is the pod's; owner reference and removal with the Job; DeleteObject; Forbidden gives the error and no Job; a Job that cannot be made leaves no Secret.
  • The explicit hold-back of GC_DOLT_PASSWORD stays, my judgement: it is no longer in a spec, but bd in the pod reads its credentials from the file BEADS_CREDENTIALS_FILE names (the Secret of roomcity.toml), so a second copy in the session's Secret serves nothing.
  • README: "What a session's pod is given": what the Secret holds, and who can read it (whoever may read Secrets of the namespace, not whoever reads Jobs).

Lands with the image that needs it: saraksh/kube's Role (roomcity-5e) gets create, get, update, delete on secrets in the namespace, no list. Of those, this code uses create, update and delete; get is granted as the owner said and not used.

Assisted-By: Claude noreply@anthropic.com

Item 2 of specs-18's request, as the owner chose it ("A"): no value of gc's environment, nor `ROOMCITY_TOKEN`, is written into a Job's spec. **Stacked on #50** (base `server-env`); after #50 merges, retarget to `main`, no conflict expected. - The server makes a Secret for each session, named like its Job, before the Job: every variable gc gave the agent (less what #50 leaves out) and the server's own `ROOMCITY_*`. The pod reads it with `envFrom`; the container's own `env` is `PATH` and the paths of mounted files (`path_env`, `ROOMCITY_SECRET_*`), which win over the Secret's. The Job owns the Secret (owner reference, set once the Job has its UID), so deleting the Job, as `stop`, a failed start and `kill-object` do, removes it; `Delete` and `DeleteObject` also delete it by name. - No fall back: a server whose Role lacks the right gets `the server may not make Secrets in the namespace ... (its Role: create, get, update and delete on secrets)` as the start's error, and no Job is made. A start that finds the session's Job already there neither overwrites nor removes its Secret. - Tests (fake cluster): no value of the environment, no token, nowhere in the marshalled Job; the Secret holds them all and the container reads it; PATH is the pod's; owner reference and removal with the Job; `DeleteObject`; Forbidden gives the error and no Job; a Job that cannot be made leaves no Secret. - The explicit hold-back of `GC_DOLT_PASSWORD` stays, my judgement: it is no longer in a spec, but bd in the pod reads its credentials from the file `BEADS_CREDENTIALS_FILE` names (the Secret of `roomcity.toml`), so a second copy in the session's Secret serves nothing. - README: "What a session's pod is given": what the Secret holds, and who can read it (whoever may read Secrets of the namespace, not whoever reads Jobs). **Lands with the image that needs it**: saraksh/kube's Role (roomcity-5e) gets `create`, `get`, `update`, `delete` on `secrets` in the namespace, no `list`. Of those, this code uses create, update and delete; `get` is granted as the owner said and not used. Assisted-By: Claude <noreply@anthropic.com>
Keep the values of a session's environment out of the Job's spec
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 15s
test / go (pull_request) Successful in 1m19s
b0bd860468
The owner chose, of two ways, a Secret for each session: the server makes
it before the Job, with every variable gc gave the agent and the server's
own (ROOMCITY_TOKEN among them), the pod reads it with envFrom, and the
Job owns it, so that deleting the Job, as stop does, removes it. The spec,
which whoever may read Jobs can read, holds PATH and the paths of the
mounted files, nothing else. A server that lacks the right to make Secrets
fails the start and says which rights its Role needs; it does not fall
back to a plain environment.

A start that finds the session's Job there neither overwrites nor removes
its Secret. GC_DOLT_PASSWORD stays held back by name: bd in the pod reads
its credentials from the file BEADS_CREDENTIALS_FILE names, so a copy in a
second place has no use.

Assisted-By: Claude <noreply@anthropic.com>
mikluko force-pushed server-secret from b0bd860468
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 15s
test / go (pull_request) Successful in 1m19s
to f6505a84b0
All checks were successful
image / image (pull_request) Successful in 16s
test / changelog (pull_request) Successful in 7s
test / go (pull_request) Successful in 56s
2026-11-16 07:45:36 +00:00
Compare
mikluko force-pushed server-secret from f6505a84b0
All checks were successful
image / image (pull_request) Successful in 16s
test / changelog (pull_request) Successful in 7s
test / go (pull_request) Successful in 56s
to 36fbc8226c
All checks were successful
image / image (pull_request) Successful in 4s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 1m15s
2026-11-16 07:46:49 +00:00
Compare
mikluko closed this pull request 2026-11-16 07:47:00 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!52
No description provided.