kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack
https://cluster-api-openstack.sigs.k8s.io/
Apache License 2.0
275 stars 253 forks source link

"log.SetLogger(...) was never called" warning in controller tests #2018

Closed mdbooth closed 1 month ago

mdbooth commented 2 months ago

/kind bug

We frequently (always?) see this scary warning in CI out of the -test job:

[controller-runtime] log.SetLogger(...) was never called; logs will not be displayed.
Detected at:
    >  goroutine 466 [running]:
    >  runtime/debug.Stack()
    >   /usr/local/go/src/runtime/debug/stack.go:24 +0x5e
    >  sigs.k8s.io/controller-runtime/pkg/log.eventuallyFulfillRoot()
    >   /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.3/pkg/log/log.go:60 +0xcd
    >  sigs.k8s.io/controller-runtime/pkg/log.(*delegatingLogSink).WithValues(0xc00028b780, {0x0, 0x0, 0x0})
    >   /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.3/pkg/log/deleg.go:168 +0x49
    >  github.com/go-logr/logr.Logger.WithValues(...)
    >   /root/go/pkg/mod/github.com/go-logr/logr@v1.3.0/logr.go:336
    >  sigs.k8s.io/controller-runtime/pkg/log.FromContext({0x2163438?, 0x327cfc0?}, {0x0?, 0x0?, 0x0?})
    >   /root/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.16.3/pkg/log/log.go:98 +0xf7
    >  sigs.k8s.io/cluster-api-provider-openstack/controllers.(*OpenStackClusterReconciler).Reconcile(0xc0008a25a0, {0x2163438, 0x327cfc0}, {{{0xc0006f10c0?, 0x0?}, {0xc0006f10b6?, 0x0?}}})
    >   /home/prow/go/src/sigs.k8s.io/cluster-api-provider-openstack/controllers/openstackcluster_controller.go:75 +0xae
    >  sigs.k8s.io/cluster-api-provider-openstack/controllers.init.func1.4()
    >   /home/prow/go/src/sigs.k8s.io/cluster-api-provider-openstack/controllers/openstackcluster_controller_test.go:178 +0x217
    >  github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3({0xc00057cfb0?, 0x91cee8?})
    >   /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.15.0/internal/node.go:463 +0x13
    >  github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3()
    >   /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.15.0/internal/suite.go:889 +0x8d
    >  created by github.com/onsi/ginkgo/v2/internal.(*Suite).runNode in goroutine 6
    >   /root/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.15.0/internal/suite.go:876 +0xdb0
kashifest commented 1 month ago

@mdbooth can I assign this to myself, I might have a working version here for capm3 https://github.com/metal3-io/cluster-api-provider-metal3/pull/1658/

mdbooth commented 1 month ago

@mdbooth can I assign this to myself, I might have a working version here for capm3 metal3-io/cluster-api-provider-metal3#1658

Be my guest! I was noodling something in #2019 but it didn't seem to work. I'll close it.

kashifest commented 1 month ago

/assign

EmilienM commented 1 month ago

Thanks @kashifest for your contributions, they are very appreciated!

kashifest commented 1 month ago

Actually this should have been fixed already by https://github.com/kubernetes-sigs/cluster-api-provider-openstack/pull/1754 , I think this is good to close, @EmilienM @mdbooth can you verify if this issue is still visible or not before we close this ?

mdbooth commented 1 month ago

Actually this should have been fixed already by #1754 , I think this is good to close, @EmilienM @mdbooth can you verify if this issue is still visible or not before we close this ?

I don't think so because the dates don't line up. That said, I can't reproduce this now and I don't see it in any recent CI output. Spooky 👻

I think I'll just close it. Sorry if you spent much time on this!

kashifest commented 1 month ago

No worries, it could be that you saw it in some release branch test where the fix was not cherry-picked.