feat: add Delve remote debugging support#201
Conversation
✅ Deploy Preview for mcp-lifecycle-operator ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: creydr The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @creydr. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
@creydr these changes look super useful for debugging in cluster, but I'm wondering if maybe it would be simpler to just debug the |
Ah. I didn't see the |
|
/hold |
|
Seems we can also debug it locally (I didn't know that it will pick up the correct kubeconfig). And as we don't have any specific volumes or such, this should be enough and we can close this one here. |
|
@Cali0707 I run into some issues with the local debugging. When I create an MCP server (e.g. like in the example), I run into a reconcile loop, because it can't resolve locally the MCP url for the handshake: #208 should address the endless loop on reconciles, but I still have the issue with the handshake. Did you solve this locally (e.g. with something like telepresence)? |
|
/unhold |
5b2e03d to
71e56b2
Compare
|
/ok-to-test |
|
@creydr can u rebase? |
Adds a debug build target and kustomize overlay to enable remote debugging of the controller running inside a Kubernetes cluster using Delve.
71e56b2 to
bbaff53
Compare
There was a problem hiding this comment.
Pull request overview
Adds an opt-in “debug build + debug deploy” workflow for running the controller under Delve inside a Kubernetes cluster, making it easier to remote-debug the operator without running it locally.
Changes:
- Adds Dockerfile
debug-builder/debugstages (Delve + debug-compiled manager) and names the distroless stageproduction. - Adds
config/manager-debugkustomize overlay to deploy a debug-friendly controller manager configuration. - Adds
docker-build-debug/deploy-debugMake targets and documents the workflow inCONTRIBUTING.md.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Makefile | Adds docker-build-debug and deploy-debug; adjusts docker-build to target the production stage. |
| Dockerfile | Introduces debug build stages and a Delve-based debug runtime stage. |
| CONTRIBUTING.md | Documents how to build/deploy and connect an IDE debugger via port-forward. |
| config/manager-debug/* | Adds a kustomize overlay to disable probes, disable leader election, override entrypoint, and increase memory for debugging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Debug image with Delve | ||
| FROM golang:1.26.3 AS debug | ||
| RUN go install github.com/go-delve/delve/cmd/dlv@latest |
There was a problem hiding this comment.
Good point. I'll check on the buildx issue
|
|
||
| # Debug image with Delve | ||
| FROM golang:1.26.3 AS debug | ||
| RUN go install github.com/go-delve/delve/cmd/dlv@latest |
There was a problem hiding this comment.
As this is only used for development and won't be pushed, we should be fine IMO
| containers: | ||
| - name: manager | ||
| command: null |
There was a problem hiding this comment.
We have some other patches in place too. Regarding potential missing patches: I was able to run the debug image with the current config
Move the production stage after the debug stage so that tools defaulting to the last Dockerfile stage (e.g. docker-buildx) produce the production image. Also add --target production to docker-buildx for explicitness.
|
@aliok can you recheck? |
Summary
debug-builderanddebugstages to the Dockerfile with Delve and debug-compiled binaryconfig/manager-debug/kustomize overlay with minimal patches (remove probes, disable leader election, override entrypoint, increase memory)docker-build-debuganddeploy-debugMakefile targetsHint: This came out, while I was debugging through the operator. I thought this might be helpful for others too.