Proposal of Debugging documentation improvement
Description
This proposal enhances the current documentation by specifying missing details, such as the omission of the kops keyword in the dlv command and the syntax for passing environment variables. It also includes a sample VS Code configuration to streamline setup and accelerate onboarding. Please review and suggest any edits. If everything looks good, feel free to assign the issue to me so I can proceed with submitting a PR. Thank you!
CURRENT documentation
Proposed changes
Debugging
To enable interactive debugging, the kOps binary needs to be specially compiled to include debugging symbols.
Add DEBUGGING=true to the make invocation to set the compile flags appropriately.
For example, DEBUGGING=true make will produce a kOps binary that can be interactively debugged.
Interactive Debugging with Delve in Headless Mode
Delve is a debugger for Go programs. You can use it either directly via CLI or integrate it with an IDE like VS Code.
To run kOps under Delve in headless mode:
dlv --listen=:2345 --headless=true --api-version=2 exec ${GOPATH}/bin/kops -- <kops-arguments>
Note: Replace <kops-arguments> with the actual arguments you would normally pass to kOps CLI. Omit the kops keyword itself.
Example with Environment Variables
To pass environment variables along with Delve, prepend them to the command:
S3_REGION=eu-south-1 \
S3_ENDPOINT=https://s3.eu-south-1.provider.com \
S3_ACCESS_KEY_ID=xxxxxxxxxxxxxxx \
S3_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy \
dlv --listen=:2345 --headless=true --api-version=2 exec ${GOPATH}/bin/kops -- <kops-arguments>
Configuring Delve in VS Code environment
To use Delve in VS Code, create a .vscode/launch.json file with the following configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Delve (kOps)",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 2345,
"host": "127.0.0.1",
"apiVersion": 2,
"showLog": true,
"trace": "verbose"
}
]
}
Also, update your VS Code settings.json to specify your Delve binary path:
"go.delveConfig": {
"dlvPath": "/Users/username/go/bin/dlv"
}
Run the command dlv --listen=:2345 --headless=true --a ... and then you can launch the debugger by selecting the "Attach to Delve (kOps)" configuration in the Run and Debug view.
Hi @Paolo-Beci what you've proposed sounds reasonable, feel free to open a PR 👍🏻
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
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-sigs/prow repository.