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
✨ envtest utility, defaultable flags #972
✨ envtest utility, defaultable flags #972
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DirectXMan12 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
53c9f33
to
9700a52
Compare
/kind feature |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
This defaults the value of `--zap-devel` to whatever is in the options struct. This allows programs to set a "prefered" default. Since folks would already be passing an empty options struct, this shouldn't affect any existing users (famous last words).
9700a52
to
d756017
Compare
d756017
to
0746e52
Compare
/remove-lifecycle stale |
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.
Mostly nits, everything else lgtm
/milestone v0.7.x |
This adds a standalone example of envtest not being used in testing. It's super useful for interactive testing of controller and webhook behavior, and code I've written in various forms for a one-off at least a dozen times.
0746e52
to
9b650c1
Compare
all fixed up |
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
This adds a small example/utility that lets you run envtest as a standalone binary. I've probably written this code about 20 times in
/tmp/xyz-debug
when debugging controller issues or reproducing apiserver behavior, so I figured it was time to push it somewhere.This also tweaks the way a flag gets initialized in the zap flags so that the value passed to options gets set as the default for
--zap-devel
. This should make that flag behave like the other flags -- if you pass a "default" via the options struct and the user doesn't set the flag, they'll get that default.