-
Notifications
You must be signed in to change notification settings - Fork 252
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
named reserved identites support for --{,from-,to-}identity
#732
Conversation
Before this patch, the identity flags errors were very verbose: % hubble observe --identity foo invalid argument "foo" for "--identity" flag: invalid security identity: foo: strconv.ParseUint: parsing "foo": invalid syntax This patch shorten the error message to: % hubble observe --identity foo invalid argument "foo" for "--identity" flag: invalid security identity The next commit will introduce support for named special identities, which would render the integer parsing message moot. Signed-off-by: Alexandre Perrin <alex@isovalent.com>
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.
That's a very nice improvement! I have a question below.
Also, what about adding completion support for the reserved/known identities?
51acd7e
to
ccd709f
Compare
@rolinh updated with completion and list valid values on error, please take another look. error message
completion
|
ccd709f
to
846d52d
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.
Thanks!
observeCmd.RegisterFlagCompletionFunc("identity", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { | ||
return reservedIdentitiesNames(), cobra.ShellCompDirectiveDefault | ||
}) | ||
observeCmd.RegisterFlagCompletionFunc("to-identity", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { | ||
return reservedIdentitiesNames(), cobra.ShellCompDirectiveDefault | ||
}) | ||
observeCmd.RegisterFlagCompletionFunc("from-identity", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { | ||
return reservedIdentitiesNames(), cobra.ShellCompDirectiveDefault | ||
}) |
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.
❤️
0697f79
to
4dbf58f
Compare
f7c66cc ("printer: Display security identity in compact output") introduced display of security identities including named reserved identities, e.g. "(host)" instead of the equivalent "(identity:1)". Before this patch, the --identity, --from-identity, and --to-identity flags would only accept numerical values. This patch introduce support for named reserved identites such as "host", "world", etc. Signed-off-by: Alexandre Perrin <alex@isovalent.com>
#717 introduced display of security identity in the (default) compact output, which is awesome. While trying to copy/paste identities from the Hubble CLI output to its
--identity
flag, I found that named reserved identities were not supported.After this patch, we can write
hubble observe --identity world
instead ofhubble observe --label reserved:world
.