feat(controller): stamp controller-version provenance onto RunnerPools #41

Merged
rcsheets merged 1 commit from feat/runnerpool-version-provenance into main 2026-06-30 07:19:58 +00:00
Owner

Attach two annotations under the runners.forgejo.brooktrails.org/ namespace
to each reconciled RunnerPool to aid provenance and troubleshooting:

  • created-by-version: the controller version that first reconciled the pool
  • modified-by-version: the controller version that most recently reconciled it

created-by is attributable only on a pool's first-ever reconcile, detected
via finalizer absence (a pool without our finalizer has never been managed by
any version of this operator). It is never backfilled onto a pre-existing
pool, since doing so would falsely claim the upgrading version created it;
such pools simply carry no created-by annotation, which reads as "created
before this tracking existed / by an unknown version".

modified-by is refreshed to the running controller's version whenever it
differs. The helper patches only when a value actually changes, so
steady-state reconciles by a same-version controller incur no extra writes,
and an upgrade refreshes modified-by on the first reconcile.

The build-time version (already injected via -ldflags into cmd/controller) is
wired into the reconciler. Annotations are freeform metadata, so no CRD or
generated-manifest changes are required.

Adds a table-driven test (first use of the controller-runtime fake client in
this package) covering first reconcile, the no-backfill case, version upgrade,
the no-write steady state, and the empty-version no-op. go mod tidy pulls in
one already-in-graph indirect dependency (json-patch.v4) used by the fake
client.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Attach two annotations under the runners.forgejo.brooktrails.org/ namespace to each reconciled RunnerPool to aid provenance and troubleshooting: - created-by-version: the controller version that first reconciled the pool - modified-by-version: the controller version that most recently reconciled it created-by is attributable only on a pool's first-ever reconcile, detected via finalizer absence (a pool without our finalizer has never been managed by any version of this operator). It is never backfilled onto a pre-existing pool, since doing so would falsely claim the upgrading version created it; such pools simply carry no created-by annotation, which reads as "created before this tracking existed / by an unknown version". modified-by is refreshed to the running controller's version whenever it differs. The helper patches only when a value actually changes, so steady-state reconciles by a same-version controller incur no extra writes, and an upgrade refreshes modified-by on the first reconcile. The build-time version (already injected via -ldflags into cmd/controller) is wired into the reconciler. Annotations are freeform metadata, so no CRD or generated-manifest changes are required. Adds a table-driven test (first use of the controller-runtime fake client in this package) covering first reconcile, the no-backfill case, version upgrade, the no-write steady state, and the empty-version no-op. go mod tidy pulls in one already-in-graph indirect dependency (json-patch.v4) used by the fake client. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feat(controller): stamp controller-version provenance onto RunnerPools
All checks were successful
CI (next Go) / next-go (tip) (pull_request) Successful in 4m27s
CI / ci (pull_request) Successful in 2m1s
E2E smoke test / e2e (pull_request) Successful in 3m30s
3d6d861cd1
Attach two annotations under the runners.forgejo.brooktrails.org/ namespace
to each reconciled RunnerPool to aid provenance and troubleshooting:

- created-by-version:  the controller version that first reconciled the pool
- modified-by-version: the controller version that most recently reconciled it

created-by is attributable only on a pool's first-ever reconcile, detected
via finalizer absence (a pool without our finalizer has never been managed by
any version of this operator). It is never backfilled onto a pre-existing
pool, since doing so would falsely claim the upgrading version created it;
such pools simply carry no created-by annotation, which reads as "created
before this tracking existed / by an unknown version".

modified-by is refreshed to the running controller's version whenever it
differs. The helper patches only when a value actually changes, so
steady-state reconciles by a same-version controller incur no extra writes,
and an upgrade refreshes modified-by on the first reconcile.

The build-time version (already injected via -ldflags into cmd/controller) is
wired into the reconciler. Annotations are freeform metadata, so no CRD or
generated-manifest changes are required.

Adds a table-driven test (first use of the controller-runtime fake client in
this package) covering first reconcile, the no-backfill case, version upgrade,
the no-write steady state, and the empty-version no-op. go mod tidy pulls in
one already-in-graph indirect dependency (json-patch.v4) used by the fake
client.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.29.1 | Safety Check | Mistral Small | tracking id r-413531-a6baf8
This is an AI-generated review and may contain mistakes.

Status: Failed


Review failed. Tracking id r-413531-a6baf8 — see logs for details.

Comment @pr-reviewer-bot retry to try again.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.29.1 | Safety Check | Mistral Small | tracking id `r-413531-a6baf8`* *This is an AI-generated review and may contain mistakes.* **Status:** ❌ Failed --- Review failed. Tracking id `r-413531-a6baf8` — see logs for details. Comment `@pr-reviewer-bot retry` to try again.
rcsheets deleted branch feat/runnerpool-version-provenance 2026-06-30 07:19:58 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
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
brooktrails/forgejo-runner-operator!41
No description provided.