Skip to content
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

cmd/observe: add flag completion for --protocol #727

Merged
merged 1 commit into from
May 24, 2022
Merged
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
16 changes: 16 additions & 0 deletions cmd/observe/flows.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ import (
"gopkg.in/yaml.v2"
)

// see protocol filter in Hubble server code (there is unfortunately no
// list of supported protocols defined anywhere)
var protocols = []string{
// L4
"icmp", "icmpv4", "icmpv6",
"tcp",
"udp",
// L7
"dns",
"http",
"kafka",
}

var verdicts = []string{
flowpb.Verdict_FORWARDED.String(),
flowpb.Verdict_DROPPED.String(),
Expand Down Expand Up @@ -448,6 +461,9 @@ more.`,
observeCmd.RegisterFlagCompletionFunc("verdict", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return verdicts, cobra.ShellCompDirectiveDefault
})
observeCmd.RegisterFlagCompletionFunc("protocol", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return protocols, cobra.ShellCompDirectiveDefault
})
observeCmd.RegisterFlagCompletionFunc("http-status", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
httpStatus := []string{
"100", "101", "102", "103",
Expand Down