kube: annotations for the pods of sessions, from the configuration #95

Merged
mikluko merged 2 commits from pod-annotations into main 2026-11-16 11:05:02 +00:00
Owner

spec-bb1.42, roomcity's part, shape agreed with roomcity-b8: [kube] pod_annotations and [agents.<name>] pod_annotations on the Job's pod template (the agent's win by key), {agent} and {session} replaced in values at the Job's creation (the agent from spec.Agent), keys checked with apimachinery's IsQualifiedName and a stray { refused at load. Nothing telemetry-shaped in it: it is how a pod gets what an operator reads off its annotations (OpenTelemetry's instrumentation.opentelemetry.io/inject-sdk and resource.opentelemetry.io/* for the sandbox, in saraksh/kube next). Tests through kube's fake client and config's parser; the whole suite and lint pass.

spec-bb1.42, roomcity's part, shape agreed with roomcity-b8: `[kube] pod_annotations` and `[agents.<name>] pod_annotations` on the Job's pod template (the agent's win by key), `{agent}` and `{session}` replaced in values at the Job's creation (the agent from `spec.Agent`), keys checked with apimachinery's `IsQualifiedName` and a stray `{` refused at load. Nothing telemetry-shaped in it: it is how a pod gets what an operator reads off its annotations (OpenTelemetry's `instrumentation.opentelemetry.io/inject-sdk` and `resource.opentelemetry.io/*` for the sandbox, in saraksh/kube next). Tests through kube's fake client and config's parser; the whole suite and lint pass.
kube: annotations for the pods of sessions, from the configuration
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 1m3s
205cd6a9a4
[kube] pod_annotations, and an agent's own over it by key, are put on the Job's
pod template, with {agent} and {session} replaced in their values. A key that
Kubernetes would refuse, or a placeholder that is neither, is refused when the
configuration is loaded.

Assisted-By: Claude <noreply@anthropic.com>
Author
Owner

Read at 205cd6a. Green here under -race, internal/kube and internal/config five times with GOMAXPROCS=1. The shape holds: the pod template had no annotations of its own to collide with, the placeholders are filled from the Job's spec and not from anything an agent says, and a mistyped placeholder stops the server at load instead of reaching a pod.

Two changes, both small:

  1. The README. pod_annotations is in no page. "What a session's pod is given" is where it goes: the two tables, the agent's winning by key, {agent} and {session}, and the limit that comes with the check: a value cannot hold a brace of its own, so an annotation whose value is JSON cannot be set this way.

  2. A process agent. [agents.<name>] process = true with pod_annotations loads and the annotations go nowhere, since a process has no pod. secrets on a process is refused at load for that reason; refuse this beside it.

As you see fit: Kubernetes checks an annotation's key after lower-casing it (ValidateAnnotations in apimachinery's pkg/api/validation/objectmeta.go), so Example.org/Name is a key it takes and this refuses. Lower-case before IsQualifiedName, or let the changelog say "stricter".

The changelog will meet #94's ### Added under Unreleased: whichever of the two lands second rebases, with Added above Changed.

Read at 205cd6a. Green here under `-race`, `internal/kube` and `internal/config` five times with `GOMAXPROCS=1`. The shape holds: the pod template had no annotations of its own to collide with, the placeholders are filled from the Job's spec and not from anything an agent says, and a mistyped placeholder stops the server at load instead of reaching a pod. Two changes, both small: 1. **The README.** `pod_annotations` is in no page. "What a session's pod is given" is where it goes: the two tables, the agent's winning by key, `{agent}` and `{session}`, and the limit that comes with the check: a value cannot hold a brace of its own, so an annotation whose value is JSON cannot be set this way. 2. **A process agent.** `[agents.<name>] process = true` with `pod_annotations` loads and the annotations go nowhere, since a process has no pod. `secrets` on a process is refused at load for that reason; refuse this beside it. As you see fit: Kubernetes checks an annotation's key after lower-casing it (`ValidateAnnotations` in apimachinery's `pkg/api/validation/objectmeta.go`), so `Example.org/Name` is a key it takes and this refuses. Lower-case before `IsQualifiedName`, or let the changelog say "stricter". The changelog will meet #94's `### Added` under Unreleased: whichever of the two lands second rebases, with `Added` above `Changed`.
mikluko force-pushed pod-annotations from 205cd6a9a4
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 1m3s
to 0b2526bbc2
Some checks failed
test / changelog (pull_request) Failing after 6s
image / image (pull_request) Successful in 17s
test / go (pull_request) Successful in 1m4s
2026-11-16 10:56:48 +00:00
Compare
mikluko force-pushed pod-annotations from 0b2526bbc2
Some checks failed
test / changelog (pull_request) Failing after 6s
image / image (pull_request) Successful in 17s
test / go (pull_request) Successful in 1m4s
to c968e0e0a0
All checks were successful
test / changelog (pull_request) Successful in 7s
image / image (pull_request) Successful in 22s
test / go (pull_request) Successful in 1m15s
2026-11-16 10:59:03 +00:00
Compare
mikluko force-pushed pod-annotations from c968e0e0a0
All checks were successful
test / changelog (pull_request) Successful in 7s
image / image (pull_request) Successful in 22s
test / go (pull_request) Successful in 1m15s
to f98c2b2ec0
All checks were successful
image / image (pull_request) Successful in 4s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 1m21s
2026-11-16 11:03:29 +00:00
Compare
mikluko deleted branch pod-annotations 2026-11-16 11:05:03 +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!95
No description provided.