-
Notifications
You must be signed in to change notification settings - Fork 2.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
Makefile: new target kind-debug to debug cilium operator & agent in kind cluster #23898
Merged
joestringer
merged 14 commits into
cilium:master
from
mhofstetter:pr/mhofstetter/kind-debug-operator
Mar 1, 2023
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f75c455
.nvim: Add cilium operator debug target
mhofstetter def4386
.vscode: Add cilium operator debug target
mhofstetter 41588a8
images: configurable debug port in debug-wrapper.sh
mhofstetter 8d9e9f7
Makefile: add make target kind-debug
mhofstetter 34e6103
Makefile: silence output of creating .dockerignore files
mhofstetter b806fe3
contrib: Expose cilium operator debug port in kind setup
mhofstetter 866d6fe
images: docker target debug for cilium operator
mhofstetter 3d54637
images: optionally continue delve debugger at startup via flag --cont…
mhofstetter 7e3f66b
images: install delve without CGO
mhofstetter 282b639
images: build debug-wrapper binary in cilium builder image
mhofstetter aacf3c3
images: remove debug-wrapper based on bash
mhofstetter 757e024
images: using go binary of debug-wrapper in agent & operator images
mhofstetter 7cdc47b
images: continue delve debugger by default at startup
mhofstetter 16e4759
images: update cilium-{runtime,builder}
mhofstetter File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Copyright Authors of Cilium | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -o xtrace | ||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
|
||
for arch in amd64 arm64 ; do | ||
mkdir -p "/out/linux/${arch}/bin" | ||
GOARCH="${arch}" CGO_ENABLED=0 go build -ldflags "-s -w" -o "/out/linux/${arch}/bin/debug-wrapper" "${SCRIPT_DIR}/debug-wrapper.go" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Authors of Cilium | ||
|
||
package main | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"log" | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
func main() { | ||
bin, err := os.Executable() | ||
if err != nil { | ||
log.Println(err) | ||
os.Exit(1) | ||
} | ||
|
||
debugPort, ok := os.LookupEnv("DEBUG_PORT") | ||
if !ok || debugPort == "" { | ||
debugPort = "2345" | ||
} | ||
|
||
debugContinue := true | ||
if debugHold, ok := os.LookupEnv("DEBUG_HOLD"); ok && debugHold == "true" { | ||
debugContinue = false | ||
} | ||
|
||
args := []string{ | ||
fmt.Sprintf("--listen=:%s", debugPort), | ||
"--headless=true", | ||
fmt.Sprintf("--continue=%t", debugContinue), | ||
"--log=true", | ||
"--log-output=debugger,debuglineerr,gdbwire,lldbout,rpc", | ||
"--accept-multiclient", | ||
"--api-version=2", | ||
"exec", | ||
fmt.Sprintf("%s-bin", bin), | ||
"--", | ||
} | ||
|
||
args = append(args, os.Args[1:]...) | ||
|
||
cmd := exec.Command("/usr/bin/dlv", args...) | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
|
||
if err = cmd.Run(); err != nil { | ||
if exitErr := (&exec.ExitError{}); errors.As(err, &exitErr) { | ||
os.Exit(exitErr.ExitCode()) | ||
} else { | ||
log.Printf("failed to execute dlv: %v", err) | ||
os.Exit(1) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
Super nit:
Only worth addressing in case there are other change requests.