-
Notifications
You must be signed in to change notification settings - Fork 593
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
Add configuration dumps for 2.x #1589
Conversation
Codecov Report
@@ Coverage Diff @@
## next #1589 +/- ##
==========================================
+ Coverage 45.64% 46.22% +0.58%
==========================================
Files 71 71
Lines 6662 6736 +74
==========================================
+ Hits 3041 3114 +73
+ Misses 3258 3254 -4
- Partials 363 368 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
9de274a
to
a83094e
Compare
ce9f164
to
0b491a7
Compare
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.
Overall 👍
I do however have some blocking comments that I feel need resolution before we merge this. Please feel free to get ahold of me in Slack/Zoom if you desire faster turnaround to get this unblocked and we can talk though it.
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.
Really looking for unit test case of the change also.
We have existing units for the sanitizers, which is only part I think we can easily unit test. Did you have anything in mind for additional unit test strategies? Added 307c4011 to test beyond just "does the controller not crash with the flag on", but I don't know if we can really unit test the interface in any meaningful way. |
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.
lgtm.
Add revised --dump-config handling to 2.x. Config dumps are now exposed at /debug/config/successful and /debug/config/failed endpoints on the diagnostic server. --dump-config is now a boolean, with an accompanying boolean --dump-sensitive-config to include sensitive information.
- Rename diagConfig variable. - Add explanatory comment. - Correct inverted boolean check.
- Log errors when diag buffer overflows. - Move defers before failure returns.
Co-authored-by: Shane Utt <shaneutt@linux.com>
9bf236e
to
431d692
Compare
@rainest I proactively rebased this against As a note, if you want to redo the commits I would recommend doing a |
Right, that much makes sense--I was confused why my initial attempt to add a lock didn't avoid that. Some difference in 0e1b00b appears to resolve that, either using an RWMutex instead (doesn't seem like it should matter, but more correct for what this does, and doesn't prevent concurrent read requests) or making the mutex part of the server struct instead of spawning it in Listen() and passing it into the functions (seems like this would be more likely to break something, but thinking about the specifics is confusing, so 🤷 ). |
@@ -18,6 +19,7 @@ type Server struct { | |||
Logger logr.Logger | |||
ProfilingEnabled bool | |||
ConfigDumps util.ConfigDumpDiagnostic | |||
ConfigLock sync.RWMutex |
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.
Where the object is instantiated ? I mean ConfigLock = sync.RWMutex{}
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.
Instantiating a Server implicitly instantiates an empty one. Similar to the example in https://tour.golang.org/concurrency/9. Golangisms 🤷
What this PR does / why we need it:
Adds
--dump-config
to 2.x. Expose successful and failed configurations via a new endpoint on the diagnostics server.Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #1308Special notes for your reviewer:
This intentionally introduces breaking changes from 1.x:
--dump-sensitive-config
flag for redaction, rather than a single flag that accepts various string modes.PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR