Skip to content

Add an option to disable L3/L4 network policy correlation of flows#37986

Merged
joestringer merged 2 commits intocilium:mainfrom
mereta:pr/l3l4-netpol-enrich-flag
Mar 24, 2025
Merged

Add an option to disable L3/L4 network policy correlation of flows#37986
joestringer merged 2 commits intocilium:mainfrom
mereta:pr/l3l4-netpol-enrich-flag

Conversation

@mereta
Copy link
Copy Markdown
Contributor

@mereta mereta commented Mar 4, 2025

Adding a config option to disable L3/L4 network policy correlation of Hubble flows.
This is enabled by default, only setting the flag to 'false' will cause a change in behavior.
the new flag can be set as such:
--set hubble.networkpolicycorrelation.enabled=false
or set in values.yaml :
.Values.hubble.networkpolicycorrelation.enabled

Fixes: #37528

Add an option to disable L3/L4 network policy correlation of Hubble flows

Manual verification in a cluster:

  • build feature images & update the cluster
  • edit config map cilium-config to add:
    • hubble-network-policy-correlation-enabled: "false"
  • or helm upgrade with --set hubble.networkpolicycorrelation.enabled=false
  • restart cilium & hubble-relay pods
  • use node-shell to the cilium pod
    • navigate to var/run/cilium/hubble
    • check flows in events.log
    • When flag is enabled the flow object will contain : "egress_allowed_by"/ "ingress_allowed_by" property with an array of evaluated policies.
    • When the flag is disabled the flow object will not contain the above properties

@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper maintainer-s-little-helper bot added dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Mar 4, 2025
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Mar 4, 2025
@maintainer-s-little-helper
Copy link
Copy Markdown

@mereta mereta force-pushed the pr/l3l4-netpol-enrich-flag branch from 3f79446 to ae35264 Compare March 4, 2025 15:14
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Mar 4, 2025
@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Mar 4, 2025
@mereta mereta force-pushed the pr/l3l4-netpol-enrich-flag branch from 4bb9c90 to e9f6753 Compare March 4, 2025 15:20
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Mar 4, 2025
@maintainer-s-little-helper
Copy link
Copy Markdown

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Mar 4, 2025
@mereta mereta force-pushed the pr/l3l4-netpol-enrich-flag branch from ed6eac4 to f0eeedf Compare March 4, 2025 15:36
@maintainer-s-little-helper
Copy link
Copy Markdown

@mereta mereta force-pushed the pr/l3l4-netpol-enrich-flag branch from f0eeedf to b9940e2 Compare March 4, 2025 15:36
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Mar 4, 2025
Copy link
Copy Markdown
Contributor

@anubhabMajumdar anubhabMajumdar left a comment

Choose a reason for hiding this comment

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

Can you add details about manual verification in a cluster? Thanks!

@mereta mereta marked this pull request as ready for review March 5, 2025 15:26
@mereta mereta requested review from a team as code owners March 5, 2025 15:26
@mereta mereta requested review from kaworu, squeed and youngnick March 5, 2025 15:26
@joestringer
Copy link
Copy Markdown
Member

Thanks for the PR! Small mechanical suggestion just to help reviewers: Could you rebase + squash all the commits back into the top one? We often review commit-by-commit in the Cilium project and we don't admit merge commits into the tree (to ensure every commit compiles and simplify bisecting bugs in future).

@joestringer joestringer added the release-note/minor This PR changes functionality that users may find relevant to operating Cilium. label Mar 5, 2025
@mereta
Copy link
Copy Markdown
Contributor Author

mereta commented Mar 12, 2025

Thanks for the quick update @mereta 👍

Again, a couple of non-blocking changes request. If you do update the Redact() log line, then please rename it to WithReact() on the way (both in a separate commit) 🙏

Thanks for the comments. Updated the PR in a separate commit :)

Copy link
Copy Markdown
Member

@kaworu kaworu left a comment

Choose a reason for hiding this comment

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

Almost there, I think this call has been missed in the renaming of WithRedact() so the build should fail.

On the way s/perser/parser/ in the second commit title, and prefix both commit titles with hubble: 🙏

@maintainer-s-little-helper
Copy link
Copy Markdown

1 similar comment
@maintainer-s-little-helper
Copy link
Copy Markdown

@mereta
Copy link
Copy Markdown
Contributor Author

mereta commented Mar 12, 2025

Almost there, I think this call has been missed in the renaming of WithRedact() so the build should fail.

On the way s/perser/parser/ in the second commit title, and prefix both commit titles with hubble: 🙏

I need to remember to 'save all' 😅 Updated the commits now.

Copy link
Copy Markdown
Contributor

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

👍 from sig-k8s

Copy link
Copy Markdown
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

In terms of implementation, this looks good to me. I would recommend rewording the user exposed flag a bit though.

Copy link
Copy Markdown
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@mereta
Copy link
Copy Markdown
Contributor Author

mereta commented Mar 13, 2025

Almost there, I think this call has been missed in the renaming of WithRedact() so the build should fail.

On the way s/perser/parser/ in the second commit title, and prefix both commit titles with hubble: 🙏

@kaworu I made the changes in a separate commit now. Could you check :)

Copy link
Copy Markdown
Member

@kaworu kaworu left a comment

Choose a reason for hiding this comment

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

Thanks @mereta the patch LGTM now! 🎉

@kaworu
Copy link
Copy Markdown
Member

kaworu commented Mar 17, 2025

/test

@gandro
Copy link
Copy Markdown
Member

gandro commented Mar 19, 2025

Re-running tests. Please avoid from rebasing unless strictly needed, as it invalidates CI results. We can restart tests without having to rebase.

@gandro
Copy link
Copy Markdown
Member

gandro commented Mar 19, 2025

/test

@mereta
Copy link
Copy Markdown
Contributor Author

mereta commented Mar 19, 2025

Re-running tests. Please avoid from rebasing unless strictly needed, as it invalidates CI results. We can restart tests without having to rebase.

Gotcha. Is there anything I need to do now?

@joestringer
Copy link
Copy Markdown
Member

The smoke tests are marked as a "Required" job to merge and there is a failure there that looks related to your PR: https://github.com/cilium/cilium/actions/runs/13951380856/job/39052000550?pr=37986#step:3:119

I would also suggest rebasing against the tip of main as I see one of the other jobs failed due to a temporary breakage earlier today.

Copy link
Copy Markdown
Contributor

@squeed squeed left a comment

Choose a reason for hiding this comment

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

For consistency's sake, we call this "policy correlation" rather than enrichment. Can you adjust the variable and flag naming accordingly?

@mereta
Copy link
Copy Markdown
Contributor Author

mereta commented Mar 21, 2025

For consistency's sake, we call this "policy correlation" rather than enrichment. Can you adjust the variable and flag naming accordingly?

Hey! Thanks for the review! I have updated the naming throughout :)

@squeed
Copy link
Copy Markdown
Contributor

squeed commented Mar 24, 2025

Looks good (though it needs a rebase). When things look good, comment with /test to launch the full test suite.

@mereta
Copy link
Copy Markdown
Contributor Author

mereta commented Mar 24, 2025

Looks good (though it needs a rebase). When things look good, comment with /test to launch the full test suite.

Rebased. Will start full test suite when images build successfully. Thanks @squeed! ☘️

@mereta
Copy link
Copy Markdown
Contributor Author

mereta commented Mar 24, 2025

/test

2 similar comments
@dylandreimerink
Copy link
Copy Markdown
Member

/test

@anubhabMajumdar
Copy link
Copy Markdown
Contributor

/test

@rectified95
Copy link
Copy Markdown
Contributor

/ci-gateway-api

@joestringer
Copy link
Copy Markdown
Member

Merged thanks! @mereta I see that the test framework did not respond to your request to run the tests. Only organization members can do this, and we do this to protect the infrastructure against abuse from the wider GitHub community. If you continue to contribute to Cilium, you might consider becoming an organization member to gain this privilege. For now we'd be happy to help you by triggering the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/hubble Impacts hubble server or relay kind/community-contribution This was a contribution made by a community member. kind/performance There is a performance impact of this. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CFP: Enable/disable L3/L4 policy enrichment in hubble flows via flag or configmap option

9 participants