Skip to content

hubble-proxy: add initial skeleton#10545

Merged
tgraf merged 2 commits intomasterfrom
pr/rolinh/hubble-proxy-cmd
Mar 18, 2020
Merged

hubble-proxy: add initial skeleton#10545
tgraf merged 2 commits intomasterfrom
pr/rolinh/hubble-proxy-cmd

Conversation

@rolinh
Copy link
Copy Markdown
Member

@rolinh rolinh commented Mar 11, 2020

This commit adds code to create a binary, hubble-proxy, for the new
hubble proxy. This component is a new component that will be required
for hubble's multi-node feature.

Notably, the introduction of hubble proxy will:

  • Allow sharing the hubble API externally via load balancer or ingress
    rules.
  • Give flexibility in terms of scheduling and resource allocation.
  • Make it easy to discover from Hubble UI (k8s service) or other
    clients such as the hubble CLI.
  • Make it potentially easier to implement API rate limiting to protect
    the cluster.
  • Decouple security from Cilium (CNPs can be applied).

The hubble proxy will talk directly with the hubble API on the cilium
agent running on the same node. This will allow initial hubble peers
discovery but also to monitor for peers joining/leaving the cluster or
to get information about which peer to connect to to get flows based on
the request (typically for long running requests). The hubble proxy will
connect to hubble peers in order to get relevant flows according to the
flow request to process.

Ref: https://github.com/cilium/hubble/issues/89


This change is Reviewable

@rolinh rolinh added kind/feature This introduces new functionality. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. area/hubble labels Mar 11, 2020
@rolinh rolinh requested review from a team, gandro, glibsm and michi-covalent as code owners March 11, 2020 14:06
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 11, 2020

Coverage Status

Coverage increased (+0.02%) to 45.724% when pulling 5c21cee on pr/rolinh/hubble-proxy-cmd into c230009 on master.

@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 11, 2020

test-me-please

Comment thread hubble-proxy/Makefile Outdated
Copy link
Copy Markdown
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

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

IMO it'd be helpful if the commit and PR message provided a one-liner of the intended scope of this component. Even something simple like "hubble-proxy is a new component to safely expose the Hubble API to remote peers".

Please also extend the CODEOWNERS file with a group responsible for owning this module. Feel free to reach out to @aanm or I if you think we need a new team in the cilium organisation to handle reviews and code ownership.

Comment thread hubble-proxy/cmd/completion/completion.go
return fmt.Errorf("too many arguments; expected only the shell type: %s", args)
}

if len(args) == 0 || args[0] == "bash" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I noticed there's some subtle differences between the completion code here and the ones in cmd/root.go, is it reasonable to find a way to share this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, yes it's because when one runs completion with a wrong argument (eg hubble-proxy completion foo), then the copyright header was being written anyway before the error was printed out and it felt weird. I can create a PR to fix this for cilium's cli as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

See #10558

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix. Can we refactor / share this or is that painful for some reason (eg the way the viper context is passed around or something?)

Comment thread hubble-proxy/Makefile Outdated
@joestringer
Copy link
Copy Markdown
Member

Apparently on the CODEOWNERS front, the relevant codeowners were pulled in somehow, even though GitHub also pulled in janitors (which is why I stepped in), and even though I don't see these paths listed either in the existing codeowners file or any changes in this PR to the codeowners file..?

At least right now, GitHub is telling me that I'm a codeowner for all of the files in the review page, which suggests the janitor will be pulled in for any subsequent PRs.

@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 12, 2020

Apparently on the CODEOWNERS front, the relevant codeowners were pulled in somehow, even though GitHub also pulled in janitors (which is why I stepped in), and even though I don't see these paths listed either in the existing codeowners file or any changes in this PR to the codeowners file..?

The relevant codeowners were pulled in because pkg/hubble is touched by this PR. But indeed, I should update the CODEOWNERS for the new hubble-proxy directory.

IMO it'd be helpful if the commit and PR message provided a one-liner of the intended scope of this component. Even something simple like "hubble-proxy is a new component to safely expose the Hubble API to remote peers".

Indeed. I updated the commit message and PR description with more details.

@rolinh rolinh force-pushed the pr/rolinh/hubble-proxy-cmd branch 2 times, most recently from 6baf7f8 to e23c291 Compare March 12, 2020 11:57
@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 12, 2020

Please also extend the CODEOWNERS

Done.

@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 12, 2020

test-me-please

Copy link
Copy Markdown
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

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

The new description is really helpful, thanks!

I have no general objections from janitor perspective, but i'll defer to @cilium/hubble to review and resolve any outstanding questions.

@joestringer joestringer requested a review from a team March 12, 2020 20:03
Comment thread hubble-proxy/cmd/context/context.go Outdated
Comment thread hubble-proxy/cmd/context/context.go Outdated
Comment thread pkg/hubble/proxy/version.go Outdated
@rolinh rolinh force-pushed the pr/rolinh/hubble-proxy-cmd branch 2 times, most recently from bc2b919 to 6978abd Compare March 16, 2020 09:37
@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 16, 2020

test-me-please

EDIT: vm provisioning fail, wil re-run

@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 16, 2020

test-me-please

Comment thread hubble-proxy/Makefile Outdated
@rolinh rolinh force-pushed the pr/rolinh/hubble-proxy-cmd branch from 6978abd to f73f226 Compare March 16, 2020 16:00
@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 16, 2020

test-me-please

@rolinh rolinh requested a review from glibsm March 17, 2020 15:48
Copy link
Copy Markdown
Member

@glibsm glibsm left a comment

Choose a reason for hiding this comment

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

As a skeleton looks good. The remarks are not blocking but are better saved for the upcoming PRs

Comment thread hubble-proxy/Makefile Outdated
Comment thread hubble-proxy/cmd/root.go Outdated
Comment thread hubble-proxy/cmd/root.go
Use: "hubble-proxy",
Short: "hubble-proxy is a proxy server for the hubble API",
Long: "hubble-proxy is a proxy server for the hubble API.",
SilenceUsage: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

By default, usage is always being displayed when a command returns an error, whether that's a user input issue or any other error. It'd be OK to display it when a command is called with invalid arguments but it feels rather odd to display it when it's an internal error such as a connection timeout or else.

Comment thread hubble-proxy/cmd/version/version.go Outdated
@tgraf
Copy link
Copy Markdown
Contributor

tgraf commented Mar 18, 2020

@joestringer @glibsm Reading through the review comments, it wasn't clear to me whether we should merge this now and follow-up or require some of the comments to be addressed now. I assume Robin will look through and address what's obvious, it would be great for both of you to point out what you want to be addressed now vs later after Robin has refreshed the PR.

@rolinh rolinh force-pushed the pr/rolinh/hubble-proxy-cmd branch from f73f226 to 2f5f2d0 Compare March 18, 2020 10:16
rolinh added 2 commits March 18, 2020 12:49
This commit adds code to create a binary, `hubble-proxy`, for the new
hubble proxy. This component is a new component that will be required
for hubble's multi-node feature.

Notably, the introduction of hubble proxy  will:

 - Allow sharing the hubble API externally via load balancer or ingress
   rules.
 - Give flexibility in terms of scheduling and resource allocation.
 - Make it easy to discover from Hubble UI (k8s service) or other
   clients such as the hubble CLI.
 - Make it potentially easier to implement API rate limiting to protect
   the cluster.
 - Decouple security from Cilium (CNPs can be applied).

The hubble proxy will talk directly with the hubble API on the cilium
agent running on the same node. This will allow initial hubble peers
discovery but also to monitor for peers joining/leaving the cluster or
to get information about which peer to connect to to get flows based on
the request (typically for long running requests). The hubble proxy will
connect to hubble peers in order to get relevant flows according to the
flow request to process.

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
@rolinh rolinh force-pushed the pr/rolinh/hubble-proxy-cmd branch from 2f5f2d0 to 5c21cee Compare March 18, 2020 11:49
@rolinh
Copy link
Copy Markdown
Member Author

rolinh commented Mar 18, 2020

test-me-please

@tgraf tgraf merged commit c8fd8e1 into master Mar 18, 2020
@tgraf tgraf deleted the pr/rolinh/hubble-proxy-cmd branch March 18, 2020 15:37
@joestringer
Copy link
Copy Markdown
Member

The specific items I was concerned about are already addressed.

I had a minor longer-term maintenance question on refactoring the basic cmd code here to better share, which I raised because this PR fixed an issue in the Cilium side as well and we just applied the same fix there:
#10545 (comment)

That said, the relevant code doesn't change often so it's not a bit deal to have multiple copies of it in the codebase.

@tgraf tgraf mentioned this pull request May 6, 2020
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature This introduces new functionality. 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.

9 participants