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

Handle nsfilter/fromsource filter from a common func #532

Merged
merged 4 commits into from Aug 24, 2022
Merged

Handle nsfilter/fromsource filter from a common func #532

merged 4 commits into from Aug 24, 2022

Conversation

seswarrajan
Copy link
Contributor

Signed-off-by: Eswar Rajan Subramanian eswar@accuknox.com

Signed-off-by: Eswar Rajan Subramanian <eswar@accuknox.com>
seswarrajan and others added 2 commits August 24, 2022 10:41
Signed-off-by: Eswar Rajan Subramanian <eswar@accuknox.com>
@seswarrajan
Copy link
Contributor Author

@nyrahul @wazir-ahmed
This PR handles ignoring of logs with namespace filter in discovery-engine where Hubble collects/receives logs.

Signed-off-by: Eswar Rajan Subramanian <eswar@accuknox.com>
@seswarrajan seswarrajan merged commit 24ed1cf into accuknox:dev Aug 24, 2022
Comment on lines +870 to +877
if IgnoreLogFromRelayWithNamespace(nsFilter, nsNotFilter, flow.Destination.Namespace) {
continue
}

if IgnoreLogFromRelayWithNamespace(nsFilter, nsNotFilter, flow.Source.Namespace) {
continue
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seswarrajan @nyrahul
Sorry for reporting this late. In case of network policy, we should not filter the flows (as soon as we receive it). We should only filter the "policy" (after we convert the flows to a policy).

The reason for this is.. Consider the following example.

1. Flow | default/frontend --> kube-system/kube-dns
2. Flow | default/frontend --> default/checkout

Without any filtering logic, this would create four policies.

1. namespace: default, spec: frontend --(egress)--> kube-dns @ port: udp/53
2. namespace: kube-system, spec: kube-dns <--(ingress)-- frontend @ port udp/53
3. namespace: default, spec: frontend --(egress)--> checkout @ port: tcp/7070
4. namespace: default, spec: checkout <--(ingress)-- frontend @ port tcp/7070

In the namespace filters, even if user says !kube-system, we should create policy-1 because it a policy for pod in default namespace. Without applying policy-1, if we only apply policy-3, then that will break frontend-pod because it will fail to resolve DNS to any service in the cluster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update @wazir-ahmed But I need to ignore those logs for observability. I will see how it can be handled in observability engine instead of cilium hubble log collection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants