Why it matters
Operators rely on Kubernetes Events on Instance objects to understand why a workload failed to schedule when project quota is exhausted or unavailable. That quota-failure observability was added in #118 and is now part of how operators self-diagnose.
The event emission is currently wired through controller-runtime's deprecated GetEventRecorderFor(...) / record.EventRecorder API. That API is slated for removal in a future controller-runtime release. Staying on it is a latent break risk: a routine dependency bump could break event emission or the build outright, silently degrading the quota observability operators depend on. It also leaves a //nolint:staticcheck suppression in the tree.
Migrating to the supported events API keeps the platform on maintained interfaces so quota-failure visibility keeps working through dependency upgrades, and removes the lint suppression.
Background
To keep #118 scoped, the full migration was deferred and a documented //nolint:staticcheck was placed on the recorder wiring in internal/controller/instance_controller.go (~line 963 in the merged form):
//nolint:staticcheck // GetEventRecorder (new events API) has an incompatible Eventf
// signature; migrating is out of scope here and would touch all emit sites.
// GetEventRecorderFor remains correct; migration is deferred.
r.recorder = mgr.GetLocalManager().GetEventRecorderFor("instance-controller")
Scope / what's needed
- Switch
mgr.GetLocalManager().GetEventRecorderFor("instance-controller") → mgr.GetLocalManager().GetEventRecorder(), which returns an events.EventRecorder from k8s.io/client-go/tools/events.
- Change the
InstanceReconciler.recorder struct field type from record.EventRecorder to events.EventRecorder.
- Migrate every
r.recorder.Event(obj, eventtype, reason, message) emit site (multiple sites for the various quota-failure conditions) to the new signature:
Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...any).
- Replace
record.FakeRecorder / record.NewFakeRecorder(...) in the controller tests with the events-API fake.
- Remove the
//nolint:staticcheck suppression.
Acceptance criteria
Origin
Deferred from #118.
Why it matters
Operators rely on Kubernetes Events on
Instanceobjects to understand why a workload failed to schedule when project quota is exhausted or unavailable. That quota-failure observability was added in #118 and is now part of how operators self-diagnose.The event emission is currently wired through controller-runtime's deprecated
GetEventRecorderFor(...)/record.EventRecorderAPI. That API is slated for removal in a future controller-runtime release. Staying on it is a latent break risk: a routine dependency bump could break event emission or the build outright, silently degrading the quota observability operators depend on. It also leaves a//nolint:staticchecksuppression in the tree.Migrating to the supported events API keeps the platform on maintained interfaces so quota-failure visibility keeps working through dependency upgrades, and removes the lint suppression.
Background
To keep #118 scoped, the full migration was deferred and a documented
//nolint:staticcheckwas placed on the recorder wiring ininternal/controller/instance_controller.go(~line 963 in the merged form):Scope / what's needed
mgr.GetLocalManager().GetEventRecorderFor("instance-controller")→mgr.GetLocalManager().GetEventRecorder(), which returns anevents.EventRecorderfromk8s.io/client-go/tools/events.InstanceReconciler.recorderstruct field type fromrecord.EventRecordertoevents.EventRecorder.r.recorder.Event(obj, eventtype, reason, message)emit site (multiple sites for the various quota-failure conditions) to the new signature:Eventf(regarding runtime.Object, related runtime.Object, eventtype, reason, action, note string, args ...any).record.FakeRecorder/record.NewFakeRecorder(...)in the controller tests with the events-API fake.//nolint:staticchecksuppression.Acceptance criteria
//nolint:staticcheckon the recorder wiring is removed.make lintis green.Instanceobjects for all quota-failure conditions that fix(quota): Enforce and harden project quota for edge-cell Instances #118 covered.Origin
Deferred from #118.