-
Notifications
You must be signed in to change notification settings - Fork 462
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 make gardener-debug
as a skaffold-based debugging experience
#7755
Add make gardener-debug
as a skaffold-based debugging experience
#7755
Conversation
/assign |
/assign |
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.
Nice work! I left some early feedback, but I need some more time to try it out
make gardener-debug | ||
``` | ||
|
||
This is using skaffold debugging features. In the Gardener case, Go debugging using [Delve](https://github.com/go-delve/delve) is the most relevant use case. |
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.
Maybe it's worth mentioning that the Cloud Code
integration features even deeper integration with IDEs than running make gardener-debug
and attaching manually.
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 is a google cloud specific feature, isn't it? That's at least what the docs say. We don't use Google Services in make gardener-up
etc, so I would not mention it explicitly here. The information is just one click away anyway, because there is a link to https://skaffold.dev/docs/workflows/debug/
👍
This means that when a goroutine of gardenlet is paused on a breakpoint, all the other goroutines are paused. This is different to e.g. debugging the JVM where individual threads can be paused. Hence, when the whole gardenlet process is paused, it can not renew its lease and can not respond to the liveness and readiness probes. So when debugging the gardenlet, one should temporarily turn off the leader election e.g. by adding
to The VS Code extension https://marketplace.visualstudio.com/items?itemName=golang.Go is sufficient to attach to the debuggee. I used the following launch configuration with the remote-local-setup, where the caveat was that the path of the go files as the compiler saw them (the paths are added to the binary) need to be mapped to the paths in the workspace.
For the VS Code debugging features, I recommend reading https://github.com/golang/vscode-go/wiki/debugging. cc @shafeeqes, thank you for the support! |
@istvanballok I added some of your caveats. |
Just for the record, the issues I faced are reproducible (and confirmed by @oliver-goetz) when stepping through a function during debugging. The liveness probes tend to fail well before reaching the 10 minute timeout with 500 HTTP status code or TCP connection errors and the kubelet restarts the gardenlet process after a few minutes of debugging in the default configuration. I think it is related to the fact that when the Go program is paused on a breakpoint, all the goroutines are paused. When it is resumed to proceed to the next line, all the go routines are resumed, and then paused again. This can then lead to issues on the other unrelated goroutines that are involved in the liveness probe handling. So if you face issues, it is recommended to disable the probes by editing the deployment that was created by skaffold debug, as it is described in the last sentence of the documentation in this PR. |
/cc @briantopping |
Note that during a debugging session with @rickardsjp we noticed that the gardenlet process panicked with /lgtm One more trick: skaffold configures dlv to start the process and not wait for the debugger to be attached. This is fine for the regular case, but it is not configurable on the skaffold level. If we need to debug something on startup, we can remove the Note: it is clearly out of scope for this PR, but long term it would be great to also support debugging the components that are not deployed by skaffold, but rather by the gardenlet, e.g. the gardener-resource-manager. |
LGTM label has been added. Git tree hash: cf8051a039d9a88580fe9300e695c0f717d90291
|
77dddfc
to
8bf2e4f
Compare
8bf2e4f
to
2887075
Compare
@oliver-goetz #7284 was the proposal I had to fix this three months ago. I'm not sure if it's related to how you guys solved 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.
/lgtm
LGTM label has been added. Git tree hash: 3d9174a1fcd70f002e9d13bd4adcd1363b972067
|
/milestone v1.69 |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: oliver-goetz 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 |
…ardener#7755) * Introduce `*-debug` make targets * Update documentation * Address PR review feedback * Address PR review feedback
How to categorize this PR?
/area dev-productivity
/kind enhancement
What this PR does / why we need it:
Similar to the dev-flow of #7659, developers can now use
make gardener-debug
to start a skaffold-based debugging loop which allows remote debugging of Gardener Core pods using Delve.Specific skaffold modules can be selected by setting
SKAFFOLD_MODULE
to reduce load on laptops.Which issue(s) this PR fixes:
Part of #6016
Special notes for your reviewer:
skaffold debugging documentation
Release note:
Developers can now use `make gardener-debug` to start a skaffold-based debugging loop which allows remote debugging of Gardener Core pods using Delve. See the [documentation](https://github.com/gardener/gardener/blob/master/docs/deployment/getting_started_locally.md#debugging-gardener) for more details.