diff --git a/pkg/internal/controller/controller.go b/pkg/internal/controller/controller.go index 8feed0744f..25575cca7c 100644 --- a/pkg/internal/controller/controller.go +++ b/pkg/internal/controller/controller.go @@ -175,7 +175,16 @@ func (c *Controller[request]) Start(ctx context.Context) error { // caches. errGroup := &errgroup.Group{} for _, watch := range c.startWatches { - log := c.LogConstructor(nil).WithValues("source", watch.String()) + log := c.LogConstructor(nil) + _, ok := watch.(interface { + String() string + }) + + if !ok { + log = log.WithValues("source", fmt.Sprintf("%T", watch)) + } else { + log = log.WithValues("source", fmt.Sprintf("%s", watch)) + } didStartSyncingSource := &atomic.Bool{} errGroup.Go(func() error { // Use a timeout for starting and syncing the source to avoid silently diff --git a/pkg/source/source.go b/pkg/source/source.go index 130dcb3d27..267a6470b8 100644 --- a/pkg/source/source.go +++ b/pkg/source/source.go @@ -56,10 +56,6 @@ type TypedSource[request comparable] interface { // Start is internal and should be called only by the Controller to start the source. // Start must be non-blocking. Start(context.Context, workqueue.TypedRateLimitingInterface[request]) error - - // String enforces the custom source to adhere to the fmt.Stringer interface - // to print when being logged. - String() string } // SyncingSource is a source that needs syncing prior to being usable. The controller