kaijaytu commented on code in PR #569:
URL: https://github.com/apache/yunikorn-site/pull/569#discussion_r3802880997


##########
docs/developer_guide/env_setup.md:
##########
@@ -255,3 +255,108 @@ Or follow these simplified steps:
 
 More documentation can be found
 
[here](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/).
+
+## Debug scheduler in a remote cluster
+
+This section explains how to deploy a debug-enabled scheduler image to a 
remote cluster and attach a debugger from your local machine using 
[Delve](https://github.com/go-delve/delve).
+
+### Prerequisites
+
+- A remote Kubernetes cluster accessible via `kubectl` (see 
[above](#access-remote-kubernetes-cluster))
+- A container registry you can push to (Docker Hub, private registry, etc.)
+- [Delve](https://github.com/go-delve/delve) installed locally:
+  ```shell script
+  go install github.com/go-delve/delve/cmd/dlv@latest
+  ```
+
+### Build a debug image
+
+Compile the scheduler with optimizations and inlining disabled so that the 
debugger can map breakpoints correctly:
+
+```shell script
+cd yunikorn-k8shim
+CGO_ENABLED=0 go build -gcflags="all=-N -l" -o _output/shim ./pkg/cmd/shim

Review Comment:
   Good catch, I will add a brief explanation for each flag:
   
   - CGO_ENABLED=0: produce a statically linked binary so it can run inside the 
minimal debug image without extra libc dependencies.
   - -gcflags="all=-N -l": applied to all packages; -N disables optimizations 
and -l disables inlining, so Delve can map source lines to instructions and 
breakpoints hit reliably.
   - -o _output/shim: output path that matches the COPY _output/shim /scheduler 
line in the Dockerfile below.
   
   Will push the update together with the other review fixes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to