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

[VC-35738] Hide the client-go reflector warning logs #624

Closed
wants to merge 1 commit into from

Conversation

wallrj
Copy link
Member

@wallrj wallrj commented Nov 19, 2024

The aim of this PR is to filter out the warnings logged in client-go/tools/cache/reflector.go when a resource group version is not installed in the Kubernetes API server.
An example of such a warning, with --logging-format=json :

{"caller":"cache/reflector.go:561", "msg":"k8s.io/client-go@v0.31.1/tools/cache/reflector.go:243: failed to list cas-issuer.jetstack.io/v1beta1, Resource=googlecasissuers: the server could not find the requested resource", "ts":1.7320377905120225E12, "v":0}

ℹ️ When --logging-format=json the warning is actually logged as an info message, on stdout.
By default --logging-format=text in which case the warning is logged with a W prefix on stderr.

Hiding the warnings is achieved by creating a filtering logr.LogSink and assigning that to the default klog logger.

However it does not seem possible to maintain the correct file and line numbers when wrapping the logger this way.
I discussed this with the klog authors and they confirm that there are probably bugs in the way the klog functions unwrap the stack:

In that thread on Slack, I learned from the klog authors that there is an in progress PR which will remove this distracting warning message:

So I will close this PR.

Signed-off-by: Richard Wall <richard.wall@venafi.com>
@wallrj
Copy link
Member Author

wallrj commented Nov 20, 2024

I learned from the klog authors that there is an in progress PR which will remove this distracting warning message:

So I will close this PR.

@wallrj wallrj closed this Nov 20, 2024
@wallrj wallrj changed the title WIP: [VC-35738] Hide the client-go reflector warning logs [VC-35738] Hide the client-go reflector warning logs Nov 20, 2024
@wallrj wallrj deleted the VC-33564-suppress-reflector-logs branch November 20, 2024 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant