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
cli: Add "cilium bpf proxy list" command #2504
Conversation
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
test-me-please |
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.
Can you add an example of the output in the commit message? 10 lines would be good.
Proxy Destination
--------------------------------
[f00d::a69:0:0:981b]:53208 (6) => 10000 f00d::a69:0:0:f236:80
[f00d::a69:0:0:981b]:58082 (6) => 10003 f00d::a69:0:0:f236:80
[f00d::a69:0:0:981b]:58056 (6) => 10000 f00d::a69:0:0:f236:80
[fc00::10ca:1]:40288 (6) => 10003 f00d::a69:0:0:dc06:80
[f00d::a69:0:0:981b]:58116 (6) => 10000 f00d::a69:0:0:f236:80
[f00d::a69:0:0:981b]:53756 (6) => 10000 f00d::a69:0:0:dc06:80
[f00d::a69:0:0:981b]:58730 (6) => 10000 f00d::a69:0:0:f236:80
[f00d::a69:0:0:981b]:58714 (6) => 10000 f00d::a69:0:0:f236:80
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.
Looks good to me, just one comment for the output of long lines - would be good to see the use of tabwriter. Thanks!
cilium/cmd/bpf_proxy_list.go
Outdated
return | ||
} | ||
|
||
title := fmt.Sprintf("%-20s %-s", "Proxy", "Destination") |
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.
Some of the other CLI tools use tabwriter, and I think it's a good way to ensure that the columns being outputted line up. For example, with IPv6 it's easy for addresses to exceed 20 characters.
Would you mind updating this to do the same? Here's an example:
cilium/cilium/cmd/bpf_policy_list.go
Line 82 in b2f9223
w := tabwriter.NewWriter(os.Stdout, 5, 0, 3, ' ', 0) |
cilium/cilium/cmd/bpf_policy_list.go
Line 115 in b2f9223
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t\n", labelsIDTitle, portTitle, actionTitle, bytesTitle, packetsTitle) |
cilium/cilium/cmd/bpf_policy_list.go
Line 134 in b2f9223
fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%d\t\n", lbl, port, act.String(), stat.Bytes, stat.Packets) |
test-me-please |
Can one of the admins verify this patch? |
test-me-please |
b64e8b9
to
bbe4596
Compare
@joestringer done |
test-me-please |
bbe4596
to
7309445
Compare
Can one of the admins verify this patch? |
@scanf I've just added an example in the commit message |
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.
One minor nitpick, can be fixed while rebasing. Rest LGTM, thanks.
cilium/cmd/bpf_proxy_list.go
Outdated
"github.com/cilium/cilium/common" | ||
"github.com/cilium/cilium/pkg/bpf" | ||
"github.com/cilium/cilium/pkg/proxy" | ||
) |
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.
The order is supposed to be std, cilium and then 3rd party. So import cobra should be moved further down.
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.
done
test-me-please |
The command which dumps proxy BPF maps for debugging purposes. Example (with Cilium, Envoy and Kubernetes): $ kubectl create -f examples/kubernetes-grpc/cc-door-app.yaml deployment "cc-door-mgr" created service "cc-door-server" created pod "terminal-87" created $ kubectl create -f examples/kubernetes-grpc/cc-door-ingress-security.yaml $ sudo cilium bpf proxy list PROXY DESTINATION 10.0.118.183:39808 (6) => 10000 10.0.202.84:50051 10.0.118.183:39794 (6) => 10000 10.0.202.84:50051 10.0.118.183:39822 (6) => 10000 10.0.202.84:50051 Fixes cilium#2277 Signed-off-by: Michal Rostecki <mrostecki@suse.com>
7309445
to
cc77a7b
Compare
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.
looks great! Thanks for doing this!
test-me-please |
The command which dumps proxy BPF maps for debugging purposes.
Example (with Cilium, Envoy and Kubernetes):
Fixes #2277
Signed-off-by: Michal Rostecki mrostecki@suse.com