Skip to content

Migrate to new K8s events API #938

Closed as duplicate
Closed as duplicate

Description

@erikgb

When upgrading to crossplane-runtime 2.2.0 in one of our providers, we noticed new linter violations. Example:

internal/controller/config/config.go:43:52: SA1019: mgr.GetEventRecorderFor is deprecated: this uses the old events API and will be removed in a future release. Please use GetEventRecorder instead. (staticcheck)
                providerconfig.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))

This seems to happen because controller-runtime has started migration to the new K8s events API: events.k8s.io.

The only workaround available right now appears to suppress the lint error. It would be nice if crossplane-runtime provided a migration path to the new K8s events API

Activity

  1. jbw976 commented on Mar 2, 2026

    @jbw976
    Member

    Thanks for pointing this out @erikgb! I think this is something @adamwg ran into during the v2.2 release, see crossplane/crossplane#7150. We are doing a nolint for these right now as well 😣

    We have tracking issues for two of flavors of these changes from controller-runtime we have no linted:

    So I think we have this issue covered already with crossplane/crossplane#7152 - I'll close as dupe and feel free to help contribute a fix PR! Thank you! 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions