Summary
Recent controller-runtime releases deprecate the old events API: manager.GetEventRecorderFor (returns k8s.io/client-go/tools/record.EventRecorder) is deprecated in favor of GetEventRecorder (returns k8s.io/client-go/tools/events.EventRecorder), and apimachinery's scheme.Builder is deprecated as well.
Once the operator is on a controller-runtime version that carries these deprecations, staticcheck flags every use as SA1019.
We should migrate off both rather than sit on the deprecated APIs indefinitely.
Affected code
cmd/operator/main.go - the Recorder wiring for the auth, tls, and core reconcilers all call mgr.GetEventRecorderFor(...).
api/v1/groupversion_info.go - SchemeBuilder = &scheme.Builder{...}.
- Every reconciler that holds a
Recorder record.EventRecorder field and calls r.Recorder.Event(obj, eventtype, reason, message) (auth, tls, routing, core).
Why it is not a one-line swap
GetEventRecorder returns the new events.EventRecorder, whose surface differs from the old record.EventRecorder:
- old:
Event(object runtime.Object, eventtype, reason, message string)
- new:
Eventf(regarding, related runtime.Object, eventtype, reason, action, note string, args ...interface{})
So the migration is not just renaming the constructor - it changes the Recorder field types on every reconciler and rewrites all event-emission call sites to the new signature (including the "emit only on reason transition" pattern the reconcilers use today). scheme.Builder needs its own small follow-up per the apimachinery guidance.
Current state
The SA1019 warnings for these specific sites are excluded in .golangci.yml (scoped to cmd/operator/main.go and api/v1/groupversion_info.go) so lint stays green in the meantime. This issue tracks doing the actual migration and removing that exclusion.
Definition of done
Summary
Recent controller-runtime releases deprecate the old events API:
manager.GetEventRecorderFor(returnsk8s.io/client-go/tools/record.EventRecorder) is deprecated in favor ofGetEventRecorder(returnsk8s.io/client-go/tools/events.EventRecorder), andapimachinery'sscheme.Builderis deprecated as well.Once the operator is on a controller-runtime version that carries these deprecations,
staticcheckflags every use as SA1019.We should migrate off both rather than sit on the deprecated APIs indefinitely.
Affected code
cmd/operator/main.go- theRecorderwiring for the auth, tls, and core reconcilers all callmgr.GetEventRecorderFor(...).api/v1/groupversion_info.go-SchemeBuilder = &scheme.Builder{...}.Recorder record.EventRecorderfield and callsr.Recorder.Event(obj, eventtype, reason, message)(auth, tls, routing, core).Why it is not a one-line swap
GetEventRecorderreturns the newevents.EventRecorder, whose surface differs from the oldrecord.EventRecorder:Event(object runtime.Object, eventtype, reason, message string)Eventf(regarding, related runtime.Object, eventtype, reason, action, note string, args ...interface{})So the migration is not just renaming the constructor - it changes the
Recorderfield types on every reconciler and rewrites all event-emission call sites to the new signature (including the "emit only on reason transition" pattern the reconcilers use today).scheme.Builderneeds its own small follow-up per the apimachinery guidance.Current state
The
SA1019warnings for these specific sites are excluded in.golangci.yml(scoped tocmd/operator/main.goandapi/v1/groupversion_info.go) so lint stays green in the meantime. This issue tracks doing the actual migration and removing that exclusion.Definition of done
events.EventRecorder(GetEventRecorder) with call sites updated toEventf, preserving current event semantics (reasons, transition-gating).scheme.Builderusage inapi/v1/groupversion_info.gomigrated per the apimachinery replacement.SA1019exclusion in.golangci.ymlis removed andmake lintis clean without it.