Stage 1: fix two real bugs the kind e2e pass caught, neither envtest could
CI / test (push) Has been cancelled

Ran a full kind end-to-end pass per ROADMAP.md's open item: real kind
cluster, real disposable Postgres, the real terdut-server v0.33.0 image,
the operator built into a real image and deployed as a real Pod (not
`go run` against the cluster -- that was tried first and correctly failed
on cluster DNS not resolving from outside the cluster network, which is
expected, not a bug).

Result: TerdutServer went Ready, the generated credentials Secret held a
real tdsa_-prefixed service-account key, and that key successfully
authenticated and exercised its real intended capability against the
actual server (GET/POST /api/teams -> 200/201) -- confirmed from
terdut-server's own access log, not just our side. Stage 1's actual goal
(ROADMAP.md) is proven, not just asserted.

Two real bugs surfaced that no envtest suite could have caught, since
envtest's client bypasses RBAC entirely:

- .dockerignore's `!**/*.go` doesn't work under podman (the scaffold's
  own comment already named this exact gotcha, buildah/containers#6417,
  and pointed at the fix) -- `docker build` was silently building from an
  empty source tree ("package cmd/main.go is not in std") until this was
  pinned down. Fixed by re-including cmd/api/internal by name, as that
  comment suggested doing if this happened.
- The controller had no RBAC for events.k8s.io (the new events API
  GetEventRecorder uses, unlike the deprecated GetEventRecorderFor) --
  every Event emission failed server-side ("Server rejected event (will
  not retry!)"), silently, since event-recording failure doesn't fail
  reconciliation. Reconciliation itself was never affected, but DESIGN.md
  §12's observability goal (every externally-visible action emits an
  Event) silently wasn't being met in any real deployment. Added
  +kubebuilder:rbac for events.k8s.io/events (create, patch); confirmed
  fixed by restarting the operator and checking `kubectl describe
  terdutserver` actually shows the Event afterward, not just that the log
  line stopped.

Also noted, not fixed here (a different repo's bug): terdut-server's own
GET /api/me 500s for a service-account caller rather than a clean 4xx --
that endpoint assumes a human user in context. Worth a terdut-server
issue, not an operator concern.
This commit is contained in:
Niklas Ye
2026-10-01 10:15:26 +02:00
parent 8064876cb1
commit 1c45b7e80b
3 changed files with 19 additions and 5 deletions
+11 -5
View File
@@ -2,11 +2,17 @@
# Ignore everything by default and re-include only needed files
**
# Re-include Go source files (but not *_test.go)
# If you use Podman, re-include your source directories by name,
# such as !cmd, !api, and !internal.
# See https://github.com/containers/buildah/issues/6417
!**/*.go
# Re-include Go source files (but not *_test.go). This tool chain builds
# with podman (confirmed 2026-10-01: kind/docker here are podman-backed),
# so the generic !**/*.go pattern the scaffold warns about doesn't actually
# work -- buildah/containers#6417, which this comment already predicted --
# and `docker build` here silently built from an empty source tree
# ("package cmd/main.go is not in std") until this was pinned down.
# Re-including directories by name, as the scaffold's own comment suggested
# doing if this happened, is what actually works.
!cmd
!api
!internal
**/*_test.go
# Re-include Go module files