kubernetes-sigs / controller-runtime

Repo for the controller-runtime subproject of kubebuilder (sig-apimachinery)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a way to grab the controller name out of the reconcile context

jonathan-innis opened this issue · comments

There are cases where I'd like to pull the controller name that was passed through Named() out of the reconcile context. Not having it present in the context means that I have to create a separate call that injects it myself across all controllers I write, which feels redundant when controller-runtime already has this information.

What do we think about controller-runtime supporting the same method as pulling out the reconcile id, but for the controller name? This is useful when we are making calls from the controller to external endpoints and we'd like to know which "client" made the call to that external thing.

The difference to the reconcile ID is that the controller name doesn't change for each invocation, so you can just store it on the reconciler.