-
Notifications
You must be signed in to change notification settings - Fork 64
More cloud logging options #927
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #927 +/- ##
==========================================
+ Coverage 52.17% 53.00% +0.82%
==========================================
Files 33 33
Lines 4556 4632 +76
==========================================
+ Hits 2377 2455 +78
+ Misses 1986 1981 -5
- Partials 193 196 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
opts := zap.Options{ | ||
Development: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Development
flag is equivalent to debug-level + console format. I think it simplest to simply remove this line in favor of being explciit in Helm, quickstart, and launch.json.
klog.SetLogger(logger) | ||
ctrllog.SetLogger(logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By configuring the klog backend to use Zap, one avoids having plain log output intermixed with json output. We see the good effects with these two lines:
{"level":"info","ts":"2025-05-23T20:08:41.512Z","msg":"attempting to acquire leader lease pulumi-kubernetes-operator/operator.pulumi.com..."}
{"level":"info","ts":"2025-05-23T20:08:41.516Z","msg":"successfully acquired lease pulumi-kubernetes-operator/operator.pulumi.com"}
Proposed changes
This PR tweaks the operator's logging code to write to stdout rather than to stderr, and to support structured json output.
See "Best practices":
The Helm chart now supports the following logging options:
When running the operator in your IDE, the "development mode" is enabled (i.e. debug-level, console format).
Examples
Console Format
JSON Format
Related issues (optional)
Closes #912