Skip to content

Refactor: Replace deprecated GetEventRecorderFor with GetEventRecorder #1997

@archups

Description

@archups

The GetEventRecorderFor method has been deprecated in controller-runtime 0.23.x. According to staticcheck (SA1019), this uses the old Kubernetes events API and is slated for removal in a future release.

Once the below rule is dropped from .golangci.yml

      - path: (.+)\.go$
        text: 'SA1019: mgr.GetEventRecorderFor is deprecated'

pull-machine-controller-lint prow job execution will fail with following lint error.

level=info msg="[runner] linters took 55.291047538s with stages: goanalysis_metalinter: 55.284381479s"
pkg/controller/machine/controller.go:190:37: SA1019: mgr.GetEventRecorderFor is deprecated: this uses the old events API and will be removed in a future release. Please use GetEventRecorder instead. (staticcheck)
		recorder:                         mgr.GetEventRecorderFor(ControllerName),
		                                  ^
pkg/controller/machinedeployment/controller.go:68:13: SA1019: mgr.GetEventRecorderFor is deprecated: this uses the old events API and will be removed in a future release. Please use GetEventRecorder instead. (staticcheck)
		recorder: mgr.GetEventRecorderFor(controllerName),
		          ^
pkg/controller/machineset/controller.go:77:13: SA1019: mgr.GetEventRecorderFor is deprecated: this uses the old events API and will be removed in a future release. Please use GetEventRecorder instead. (staticcheck)
		recorder: mgr.GetEventRecorderFor(controllerName),
		          ^
3 issues:
* staticcheck: 3

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