Skip to content

curl: override any "-w" options that might exist #11

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This section records common use cases for this kubectl plugin.
### Collecting profiles of Go programs

```
$ kubectl curl "http://{pod}/debug/pprof/profile?debug=1&seconds=10" > ./profile
$ kubectl curl -o profile "http://{pod}/debug/pprof/profile?debug=1&seconds=10"
$ go tool pprof -http :6060 ./profile
```

Expand Down
6 changes: 4 additions & 2 deletions curl.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ func main() {
}

func run(ctx context.Context) error {
cArgs := make([]string, 0)
cArgs := []string{
"--header", "User-Agent: kubectl-curl",
}
flags.ParseAll(os.Args[1:], func(flag *pflag.Flag, value string) error {
if flag.Name == "silent" {
return nil // --silent is added later to all curl arguments so don't add here
Expand Down Expand Up @@ -239,7 +241,7 @@ func run(ctx context.Context) error {
}
}()

log.Printf("waiting for port fowarding to be established")
log.Printf("waiting for port forwarding to be established")
select {
case <-f.Ready:
case <-ctx.Done():
Expand Down