-
Notifications
You must be signed in to change notification settings - Fork 255
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
Make --namespace
flag more intuitive and allow both --namespace
and --pod
flag
#1279
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.
Overall LGTM. The tests seem thorough and make sense to me, which is the biggest part IMO.
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.
Awesome work @glrf 🎉 Left a couple of comments but overall LGTM!
7462354
to
d4e8731
Compare
Removing the ready-to-merge label, as @kaworu's review is still pending. |
d4e8731
to
55e17a4
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 @glrf patch LGTM but the commit message still reference the namespace label change that was dropped
- We also treate
--label k8s:io.kubernetes.pod.namespace=foo
as a
namespace flag
1003570
to
0005970
Compare
Instead of treating the `--namespace` flag as an alias for filtering for any pod in the namespace, we now treat the `--namespace` flag as a modifier for the `--pod` and `--service` flag. This means `hubble observe --namespace foo --pod bar` will filter for flows from or to pod `bar` in namespace `foo`, instead of filtering for flows to or from pod `bar` in the namespace `default` and `foo` (which never resulted in any flows) There are a few edgecases: * If we provide multiple namespace and/or pods/services we build the crossproduct of the provided values. * If we don't provide any pod or service flags, i.e. `hubble observe -n foo`, we use the old behaviour of filtering for any pods in that namespace. * We don't allow mixing `--namespace` and `--to-pod` or similar as it isn't clear what should happen in that case. Signed-off-by: Fabian Fischer <[email protected]>
c0b2a2e
to
6bb1479
Compare
We catch some common mistakes when querying for namespaces. * We return an error if the pod and service flags request different namespaces, as this will never yield any flows. * We return an error if the namespace and the pod and/or service flags request flow from different namespace, as it is not clear what for example `hubble observe -n foo --pod bar/buzz --pod blub` should do. Signed-off-by: Fabian Fischer <[email protected]>
6bb1479
to
071b371
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.
🚀
This PR essentially implements @kaworu's proposal in #359 (comment) .
This means instead of treating the
--namespace
flag as an alias for filtering for any pod in the namespace, we now treat the--namespace
flag as a modifier for the--pod
and--service
flag. We also try to catch namespace inconsistencies in flags and fail early.There where a few edgecases that were not considered in the initial proposal:
If we provide multiple namespace and/or pods/services we build the crossproduct of the provided values.
For example
hubble observe -n foo -n bar --pod buzz
will return any flows from or to pods in namespacefoo
orbar
namedbuzz
If we don't provide any pod or service flags, i.e.
hubble observe -n foo
, we use the old behaviour of filtering for any pods in that namespace.We don't allow mixing
--namespace
and--to-pod
or similar as it isn't clear what should happen in that case.We return an error if the namespace and the pod and/or service flags request flows from different namespace, as it is not clear what for example
hubble observe -n foo --pod bar/buzz --pod blub
should do.This PR also doesn't implement the proposed
--all-namespaces
flag, as it requires server side changes. Will add this separately.This technically introduces a breaking change. We no longer allow using both
--namespace
and--from-service
or--to-service
.Before this change
hubble observe --namespace foo --to-service buzz/bar
showed flows flows that either start at a pod in namespacefoo
and go to servicebar
in namespacebuzz
, or come from anywhere and go to servicebuzz/bar
and a pod in namespacefoo
(which does not show any flows as long asfoo != buzz
)If you want to replicate the old behavior you can use
hubble observe --pod foo/ --to-service buzz/bar
closes #359