-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 run local in debug #1422
Add run local in debug #1422
Conversation
Hi @mathianasj. Thanks for your PR. I'm waiting for a operator-framework or openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Looks like there are some unit tests I need to resolve. I will work on those and update. |
/ok-to-test |
Also this flag needs a mention in the Added section of the CHANGELOG. |
Thanks, I will try to get those updated today or tomorrow. |
415480e
to
2986021
Compare
@hasbro17 I completed adding the args to the debug command, updated the changelog, and tests are now passing. Let me know if you see anything else. |
@mathianasj Overall looks good. I am unsure how useful delve is if we are using a standard compiled go binary due to optimizations. Delve's docs say that you should add This should be pretty easy to add since we have a |
@AlexNPavel I updated to include the debug symbols if debug flag is specified |
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
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.
I think this is well implemented and looks pretty good, with just one comment about the flag/variable name. 👍
Having said that, I'm a little uneasy about these kinds of feature additions into the SDK. This could just as easily be implemented by a user in their own Makefile
.
We've recently added support for customizing CGO_ENABLED
and go's -ldflags
options, and it seems like the flag set could balloon as more edge cases need to be handled.
I wonder if we (and ultimately users) would be better off if we kept the SDK simple for the straightforward use cases and and documented ways for users with complex or uncommon use cases to customize their builds with Makefiles?
Kubebuilder defers basically all non-scaffolding tasks to a generated Makefile, giving users all the flexibility (and responsibility) to tune and change as they see fit. I'm not saying we should swing that far the other direction, but I think we should discuss where the line should be drawn.
Thoughts @hasbro17 @AlexNPavel @shawn-hurley @estroz @lilic @theishshah?
@joelanford updated flag and associated documentation |
@joelanford I agree. There have been quite a few additions to commands over time that we'll have to maintain as long as they're in the project. Adding more non-global or niche-use-case flags is unsustainable. We should have a discussion about how to add these features to commands while keeping the CLI slim. |
Any updates on this, I noticed at least one other was looking for functionality such as this |
64d3ded
to
2b17e61
Compare
IMO, operator-sdk needs this feature as long as it wraps building, testing and running of operators. I needed this as soon as I started debugging my first operator and wrote something similar: https://github.com/syedriko/operator-sdk/tree/up_local_dlv before @AlexNPavel pointed me to this PR. I too agree that going forward this wrapping approach can quickly become unsustainable. May be the way to go is to deprecate the build, olm-catalog, print-deps, run, scrorecard, test and up commands, implement them as make targets and until they are removed from the operator-sdk executable entirely, implement them as invocations of |
@joelanford In the future, we should modify this to allow more customization from the users, but I think we should add this functionality to the SDK for now as there are multiple users asking for this functionality, and we can discuss ways to have a more customizable design later. |
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.
@AlexNPavel It does seem like there's growing interest in this, so I'm okay with merging this feature and sorting out how to handle these kinds of things later.
@mathianasj Can you also add a line to the README's Prerequisites section? Something like:
* Optional: [`delve`](https://github.com/go-delve/delve/tree/master/Documentation/installation) version 1.2.0+ (for `up local --enable-delve`).
LGTM once these are addressed.
@joelanford updated changes you requested, I also do agree that the sdk should be limited to developer resources, and that the cli in the way it currently is designed requires adding functionality such as this. I would be happy to be involved in discussions for future development and changes. I know that the customer I am currently working with has numerous planned operators and I could get their input also. |
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
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 after nit.
Co-Authored-By: Haseeb Tariq <hasbro17@gmail.com>
Updated |
@mathianasj Thanks for adding this in. |
Yay! Thanks for merging this, guys! |
Description of the change:
Add a debug flag for operator-sdk up local, which wraps the built binary into the dlv command to attach a remote debugger
Motivation for the change:
To simplify the process to attach a debugger when developing an operator locally