-
Notifications
You must be signed in to change notification settings - Fork 242
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
Add experimental-field-mask flags #1101
Add experimental-field-mask flags #1101
Conversation
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.
We can skip splitting inside getFlowsRequest
if we switch to a StringSliceVar
flag instead.
d3b8d41
to
2e43cdf
Compare
@chancez I'm hesitant to tag an experimental feature as |
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.
CI is unhappy about the observe help output test, please update cmd/observe_help.txt accordingly.
go run ./main.go observe --help > cmd/observe_help.txt
git add -p cmd/observe_help.txt
(avoid staging the hunk about the --config
flag, keeping the %s
template).
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 for the test fix @AwesomePatrol, one more thing:
Using the experimental flag (e.g. hubble observe --experimental-field-mask verdict
) works well in combination with --output json
, less so with other output formats:
% ./hubble observe --last 1 --experimental-field-mask verdict --output compact
N/A: (unknown) <> (unknown) UNKNOWN FORWARDED ()
N/A: (unknown) <> (unknown) UNKNOWN FORWARDED ()
% ./hubble observe --last 1 --experimental-field-mask verdict --output dict
TIMESTAMP: N/A
SOURCE:
DESTINATION:
TYPE: UNKNOWN
VERDICT: FORWARDED
SUMMARY:
------------
TIMESTAMP: N/A
SOURCE:
DESTINATION:
TYPE: UNKNOWN
VERDICT: FORWARDED
SUMMARY:
% ./hubble observe --last 1 --experimental-field-mask verdict --output tab
TIMESTAMP SOURCE DESTINATION TYPE VERDICT SUMMARY
N/A UNKNOWN FORWARDED
N/A UNKNOWN FORWARDED
% ./hubble observe --last 1 --experimental-field-mask verdict --output json
{"flow":{"verdict":"FORWARDED"}}
{"flow":{"verdict":"FORWARDED"}}
I think we should
- disallow
--experimental-field-mask
when the output format is not JSON. - For compact and dict/tab consider hardcoding a mask requesting only the fields used by the output format (see WriteProtoFlow).
I added another flag I also added a test to verify that all fields needed by output formats are part of the default field mask (which currently captures a bit more data than necessary). |
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 for the quick update @AwesomePatrol 🎉
Couple of nitpicking comments, other than that LGTM.
Follow-up to change in cilium exposing new experimental field in requests: cilium/cilium#23198 Usage example: hubble observe --experimental-field-mask time,verdict Signed-off-by: Aleksander Mistewicz <amistewicz@google.com>
It is gated behind experimental-use-default-field-masks command line flag (defaults to false). It also prints an error in all cases when attempting to use a custom field mask with non-json output format. Signed-off-by: Aleksander Mistewicz <amistewicz@google.com>
Signed-off-by: Aleksander Mistewicz <amistewicz@google.com>
034f42e
to
6cd37a6
Compare
Follow-up to change in cilium exposing a new experimental field in
GetFlowsRequest
s: cilium/cilium#23198Usage example with custom field mask and JSON output format:
Usage example with default field mask and default output format:
Example of providing invalid fieldmask:
Example of providing custom field mask for non-JSON output format: