Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatekeeper-controller logs do not display #3342

Open
pikehuang opened this issue Mar 29, 2024 · 0 comments
Open

gatekeeper-controller logs do not display #3342

pikehuang opened this issue Mar 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pikehuang
Copy link

What steps did you take and what happened:
[A clear and concise description of what the bug is.]
this is the gatekeeper pod info, as shown belown, the pod has restart 6 times
cls-dyp4pnhh-gatekeeper-75995db9bc-q2gkq 2/2 Running 6 57d

when I head for the gatekeepr log, they are:

C:\Users\Administrator>k logs -ncls-dyp4pnhh cls-dyp4pnhh-gatekeeper-75995db9bc-q2gkq -cgatekeeper-controller -p
2024/03/28 16:57:04 maxprocs: Updating GOMAXPROCS=1: using minimum allowed GOMAXPROCS
[controller-runtime] log.SetLogger(...) was never called, logs will not be displayed:
goroutine 1 [running, locked to thread]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x5e
sigs.k8s.io/controller-runtime/pkg/log.eventuallyFulfillRoot()
/go/src/github.com/open-policy-agent/gatekeeper/vendor/sigs.k8s.io/controller-runtime/pkg/log/log.go:59 +0xcd
sigs.k8s.io/controller-runtime/pkg/log.(*delegatingLogSink).WithName(0xc0001dbe80, {0x24f8def, 0x13})
/go/src/github.com/open-policy-agent/gatekeeper/vendor/sigs.k8s.io/controller-runtime/pkg/log/deleg.go:147 +0x45
github.com/go-logr/logr.Logger.WithName({{0x2ad47f0, 0xc0001dbe80}, 0x0}, {0x24f8def?, 0x3fb3760?})
/go/src/github.com/open-policy-agent/gatekeeper/vendor/github.com/go-logr/logr/logr.go:336 +0x3d
github.com/open-policy-agent/gatekeeper/v3/pkg/metrics/exporters/opencensus.init()
/go/src/github.com/open-policy-agent/gatekeeper/pkg/metrics/exporters/opencensus/opencensus.go:16 +0x34
I0328 16:59:17.894234 1 regorewriter.go:212] checking {template}

as we can see, the log contains error: " log.SetLogger(...) was never called, logs will not be displayed"

the pod args setting:

  • args:
    • --port=8443
    • --v=5
    • --logtostderr
    • --operation=webhook
    • --disable-cert-rotation=true
    • --enable-external-data=true
    • --disable-opa-builtin={http.send}
    • --tls-min-version=1.0
    • --external-data-provider-response-cache-ttl=0

What did you expect to happen:
I wish when pod restart, the logs show clear reason, especially the "log.SetLogger(...) was" won't happen again.

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
I read the source code, In Main function, ctrl.SetLogger has set the logger. so I don't know why this error happens.
logger := crzap.New(opts...)
ctrl.SetLogger(logger)
klog.SetLogger(logger)

Environment:
Linux

  • Gatekeeper version: 3.14
  • Kubernetes version: (use kubectl version): 1.18
@pikehuang pikehuang added the bug Something isn't working label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant