upbound / provider-vault

A Crossplane provider for HashiCorp Vault
Apache License 2.0
16 stars 9 forks source link

[controller-runtime] log.SetLogger(...) was never called, logs will not be displayed: #33

Open zebesh opened 7 months ago

zebesh commented 7 months ago

What happened?

errors in logs

[controller-runtime] log.SetLogger(...) was never called, logs will not be displayed:
goroutine 3890 [running]:
runtime/debug.Stack()
    runtime/debug/stack.go:24 +0x65
sigs.k8s.io/controller-runtime/pkg/log.eventuallyFulfillRoot()
    sigs.k8s.io/controller-runtime@v0.15.0/pkg/log/log.go:59 +0xbd
sigs.k8s.io/controller-runtime/pkg/log.(*delegatingLogSink).WithValues(0xc000950940, {0xc00090a0c0, 0x4, 0x4})
    sigs.k8s.io/controller-runtime@v0.15.0/pkg/log/deleg.go:168 +0x54
github.com/go-logr/logr.Logger.WithValues(...)
    github.com/go-logr/logr@v1.2.4/logr.go:323
sigs.k8s.io/controller-runtime/pkg/builder.(*Builder).doController.func1(0xc000d4ec20)
    sigs.k8s.io/controller-runtime@v0.15.0/pkg/builder/controller.go:400 +0x2b6
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000952000, {0x26bf640, 0xc000180370}, {0x204ed80?, 0xc000d4ebe0?})
    sigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:305 +0x18b
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000952000, {0x26bf640, 0xc000180370})
    sigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:265 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
    sigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:226 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
    sigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:222 +0x587
oliver-hofmann-cistec-com commented 3 months ago

it would be nice to have more informations exposed than just a stack trace that is not helping at all while debugging

eric-carlsson commented 1 month ago

Encountered the same issue after updating the provider to v1.0.0. This seems to be caused by a breaking change to controller-runtime, see https://github.com/kubernetes-sigs/controller-runtime/issues/2622. To fix this it seems we should pass a no-op logger explicitly.


@oliver-hofmann-cistec-com by updating the DeploymentRuntimeConfig to pass the --debug flag I can get relevant log output (such as error messages returned by the Vault API) .

apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
  name: vault
spec:
  deploymentTemplate:
    spec:
      selector: {}
      template:
        ...
        spec:
          containers:
            - args: ["--debug"]

However, as mentioned by the code comment this produces extremely verbose output by controller-runtime. It would be nice to have an in-between option where we get errors messages returned by terraform without the rest of the debug information.