Skip to content

feat(hubble): decouple the payloadparser from hubble control plane.#38368

Merged
dylandreimerink merged 1 commit intocilium:mainfrom
ritwikranjan:feat/decouple-hubble-1
Mar 31, 2025
Merged

feat(hubble): decouple the payloadparser from hubble control plane.#38368
dylandreimerink merged 1 commit intocilium:mainfrom
ritwikranjan:feat/decouple-hubble-1

Conversation

@ritwikranjan
Copy link
Copy Markdown
Contributor

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible.
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Are you a user of Cilium? Please add yourself to the Users doc
  • Thanks for contributing!

This pull request introduces important changes to integrate a payload parser for Hubble. Currently, the parser (or Decoder) is tightly coupled with the launch code for Hubble, making it impossible to run Hubble without the Cilium dataplane. While we expose Hubble as a cell, we do not explicitly expose the parser as a dependency.

In this update, I have extracted the parser initiation and exposed it as a cell. This change allows Hubble to operate as a standalone component, fully decoupled from the Cilium dataplane.

Integration of Payload Parser

  • Added parser.Cell to the imports and setup in daemon/cmd/cells.go to integrate the new payload parser for Hubble. [1] [2]
  • Introduced a new payloadParser field in hubbleParams and hubbleIntegration structs, and updated the relevant functions to utilize this new field in pkg/hubble/cell/cell.go and pkg/hubble/cell/hubbleintegration.go. [1] [2] [3] [4] [5] [6]

These changes streamline the Hubble integration and improve the maintainability of the codebase.

This change decouples the payload parser from the Hubble control plane, allowing Hubble to work as a standalone component without the Cilium dataplane.

@ritwikranjan ritwikranjan requested review from a team as code owners March 20, 2025 14:20
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Mar 20, 2025
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Mar 20, 2025
@ritwikranjan ritwikranjan force-pushed the feat/decouple-hubble-1 branch from 2b13044 to 00ce49a Compare March 20, 2025 16:07
@kaworu kaworu added kind/cleanup This includes no functional changes. area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. sig/hubble area/hubble Impacts hubble server or relay labels Mar 21, 2025
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.

Hi @ritwikranjan 👋 and thank you for the PR!

Patch LGTM, my only request is to add a description to the commit message (e.g. by copying the PR's description) so the commit history has enough context about the motivation behind the patch and one doesn't need to trace back to GitHub 🙏

@kaworu kaworu added release-note/misc This PR makes changes that have no direct user impact. and removed area/misc Impacts miscellaneous areas of the code not otherwise owned by another area. labels Mar 21, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Mar 21, 2025
@kaworu kaworu added the dont-merge/blocked Another PR must be merged before this one. label Mar 21, 2025
@kaworu
Copy link
Copy Markdown
Member

kaworu commented Mar 21, 2025

Added the dont-merge/blocked label, because of the upcoming conflicts with the following PR:

Since this one is newer and pure refactoring I think the conflicts will be easier to resolve if we merge #37986 first.

@ritwikranjan
Copy link
Copy Markdown
Contributor Author

Sounds good to me, I will wait for it to be merged and then rebase my changes with updated commit msg.

Copy link
Copy Markdown
Member

@pippolo84 pippolo84 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Left a comment inline suggesting a different organization of the Hubble cells.

@ritwikranjan ritwikranjan force-pushed the feat/decouple-hubble-1 branch from 00ce49a to 968dee1 Compare March 21, 2025 14:19
Copy link
Copy Markdown
Member

@pippolo84 pippolo84 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 (just one minot nit left inline)

@mereta
Copy link
Copy Markdown
Contributor

mereta commented Mar 24, 2025

Added the dont-merge/blocked label, because of the upcoming conflicts with the following PR:

Since this one is newer and pure refactoring I think the conflicts will be easier to resolve if we merge #37986 first.

This is now merged!

@kaworu kaworu added dont-merge/needs-rebase This PR needs to be rebased because it has merge conflicts. and removed dont-merge/blocked Another PR must be merged before this one. labels Mar 25, 2025
@kaworu
Copy link
Copy Markdown
Member

kaworu commented Mar 26, 2025

@ritwikranjan
Copy link
Copy Markdown
Contributor Author

Conformance Runtime Runtime Test (privileged) and Integration Tests first time seeing this, could be related to the PR

They did fail again. I am trying to figure out the issue, will ping again if I find something, in the mean time it would be great help if you can give your thoughts the potential issue.

@kaworu
Copy link
Copy Markdown
Member

kaworu commented Mar 26, 2025

@ritwikranjan
Failing test:

  • // TestAgentCell verifies that the Agent hive can be instantiated with
    // default configuration and thus the Agent hive can be inspected with
    // the hive commands and documentation can be generated from it.
    func TestAgentCell(t *testing.T) {

    Now the full test error message is:
    cells_test.go:46: found unexpected goroutines:
        [Goroutine 11 in state select, with github.com/cilium/cilium/pkg/controller.(*controller).runController on top of the stack:
        github.com/cilium/cilium/pkg/controller.(*controller).runController(0xc000df6a00, {{{0x5127a7a, 0xa}}, {0x0, 0x0}, 0x5368e10, 0x0, 0x53663f0, 0x37e11d600, 0x0, ...})
        	/host/pkg/controller/controller.go:319 +0x939
        created by github.com/cilium/cilium/pkg/controller.(*Manager).createControllerLocked in goroutine 6
        	/host/pkg/controller/manager.go:116 +0x438
        ]

So the initial inspection hint at an unexpected goroutine launched on Hive instantiation. The PR introduces:

parser.New(params.Log, g, g, g, params.Ipcache, g, link.NewLinkCache(), params.CGroupManager, params.Config.SkipUnknownCGroupIDs, parserOpts...)

in newPayloadParser — i.e. at instantiation — which was previously in (*hubbleIntegration) launch() (part of the hubble job lifecycle). Going down link.NewLinkCache():

The cleanest way to address this would be to refactor linkcache into a Cell with proper lifecycle cc @mhofstetter

@ritwikranjan ritwikranjan force-pushed the feat/decouple-hubble-1 branch from 705b654 to 0dbd221 Compare March 27, 2025 14:11
@ritwikranjan ritwikranjan requested a review from a team as a code owner March 27, 2025 14:11
@ritwikranjan ritwikranjan force-pushed the feat/decouple-hubble-1 branch from 0dbd221 to 6a91e5a Compare March 27, 2025 14:25
@ritwikranjan
Copy link
Copy Markdown
Contributor Author

@kaworu I have done some refactoring with link cache, can you retry the tests? Also think I need another review from datapath sig.

@kaworu kaworu self-requested a review March 28, 2025 09:07
@ritwikranjan ritwikranjan force-pushed the feat/decouple-hubble-1 branch from 6a91e5a to 8e395e6 Compare March 28, 2025 16:59
This pull request introduces important changes to integrate a payload parser for Hubble. Currently, the parser (or Decoder) is tightly coupled with the launch code for Hubble, making it impossible to run Hubble without the Cilium dataplane. While we expose Hubble as a cell, we do not explicitly expose the parser as a dependency.

In this update, I have extracted the parser initiation and exposed it as a cell. This change allows Hubble to operate as a standalone component, fully decoupled from the Cilium dataplane.

Signed-off-by: Ritwik Ranjan <[email protected]>
@ritwikranjan ritwikranjan force-pushed the feat/decouple-hubble-1 branch from 8e395e6 to fb13c3d Compare March 28, 2025 22:33
@devodev
Copy link
Copy Markdown
Contributor

devodev commented Mar 28, 2025

/test

@ritwikranjan
Copy link
Copy Markdown
Contributor Author

Hey @kaworu @gentoo-root can you also take a look as well and merge the changes if all looks okay?

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.

Thank you @ritwikranjan patch LGTM! 🎉

Copy link
Copy Markdown
Contributor

@gentoo-root gentoo-root left a comment

Choose a reason for hiding this comment

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

One minor comment, otherwise looks good to me.

@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Mar 31, 2025
@ritwikranjan
Copy link
Copy Markdown
Contributor Author

@kaworu is it okay to merge the PR?

@dylandreimerink dylandreimerink added this pull request to the merge queue Mar 31, 2025
Merged via the queue into cilium:main with commit 5df6f52 Mar 31, 2025
69 checks passed
@tklauser
Copy link
Copy Markdown
Member

It looks like this change made the --hubble-network-policy-correlation-enabled flag ineffective, i.e. network policy correlation can no longer be disabled. I've opened #39142 to fix this.

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/cleanup This includes no functional changes. kind/community-contribution This was a contribution made by a community member. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants