controller-runtime
controller-runtime copied to clipboard
Feature: Allow ManagerOptions to be marshalled
It would be very nice if the ManagerOptions https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/manager/manager.go#L101 was more easily printable. Example use case: logging on startup to be sure of what config is used.
Using fmt.Sprintf("%#v", options) has been my workaround but it's pretty suboptimal (pointers not followed for example)
Currently using json.Marshal gives an error like
json: unsupported type: func(*rest.Config, *http.Client) (meta.RESTMapper, error)
Failing to marshal this field named MapperProvider
I'd be willing to PR this, what I would do is add the struct tag json:"-" on fields that should not be printed / logged (e.g. MapperProvider) and then use the standard json.Marshal to get my human readable string.
Wanted to gauge interest before making a PR