-
Notifications
You must be signed in to change notification settings - Fork 169
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
feat: Add support for Hubble control plane in Retina agent #432
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
fix import replace usage of manifest to add legacy replace usage of manifest to add legacy remove unused file update legacy manifest reference fix directories update path to use single folders add new make targets update images and tag references
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
This adds some rudimentary error wrapping with fmt.Errorf, then renames a few errors to match the errXXX convention. Finally, addNode has been augmented to return an error and the callsite modified to handle that error.
Both of these two had no good migration path documented, so these have both been disabled with a TODO added to address them.
This is the correct capitalization for abbreviations in Go.
This switch statement has a default clause that will effectively ignore the cases that we don't care about, so this linter isn't providing value here.
A linter pointed out that these assertion values were reversed. The expected value should be first.
The cells don't really have any meaningful logic, since they're quasi-declarative. Given this, it's not really clear how you would even meaningfully wrap errors returned here. Consequently, we just disable the lint.
"opts" was unused, so a linter complained. It's replaced with "_" instead.
If a value reads 3 * time.Minute, it's obvious that it's 3 minutes. Constantizing this value just makes it less readable.
The linter complained about these two in particular.
This linter suggests an ordering of imports that is contrary to the following logical ordering we've discussed as a team: import ( // stdlib // module-local imports // third-party dependencies ) In particular, it mixes up the module-local imports and the third-party dependencies. Consequently, this PR disables it for the repo.
One instance of this is just inherently long... partly due to a linter disablement. The other one is a long function signature, which is still a problem. At least it's broken out onto multiple lines so it's a little easier to deal with, but tbh I'm not crazy about doing that with function / method signatures in Go.
The linter identified two instances of this. One of them makes sense to leave since we don't have an easy way to make a granular commit to get just that commented-out code back.
Calling os.Exit directly should be done with great care, since it doesn't allow deferred functions to run. The linter spotted this here. The solution is to change the cobra command to accept an error return and return an error instead.
This function returns an error that is provably always nil, so there's no need to return it, handle it, etc.
The instances that it found here were all obvious usages from looking at the context. The numbers were not magic in any way.
Generally these are fine, with how errors are typically used.
This feels a little silly, but I can see that for a large number of constants it's probably worthwhile. Fixing.
Two instances of unwrapped errors were found by the linter. This makes sure that they are wrapped.
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
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.
Looks awesome. I mainly had nitpicks about dashboards and deleting unused bits
Signed-off-by: Anubhab Majumdar <[email protected]>
cmd/hubble/subcmd_linux.go
Outdated
|
||
func Cmd(agentHive *hive.Hive) *cobra.Command { | ||
hubbleCmd := &cobra.Command{ | ||
Use: "hubble-control-plane", |
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.
thoughts about this being a verb then maybe noun? and maybe a flag on the parent process? seems easier to deprecate flags later than subcommands
ex retina --use-hubble-control-plane
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.
It cannot be a flag, it's very different than current control plane and requires all new flags and setup. IMO, a new sub command makes sense. And because it's. sub-command, I kept it a noun.
deploy/hubble/manifests/controller/helm/retina/templates/operator/deployment.yaml
Show resolved
Hide resolved
Signed-off-by: Anubhab Majumdar <[email protected]>
Signed-off-by: Anubhab Majumdar <[email protected]>
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.
🛰️
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.
It looks like the UT files are missing in deploy/hubble/grafana/ (can copy from deploy/legacy/grafana/)
@@ -527,4 +527,4 @@ quick-deploy-hubble: | |||
|
|||
.PHONY: simplify-dashboards | |||
simplify-dashboards: | |||
cd deploy/legacy/grafana/dashboards/ && go test . -tags=dashboard,simplifydashboard -v | |||
go test -tags=dashboard,simplifydashboard -v ./deploy/... |
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.
The test logic actually modifies JSON files in the current directory. Could we cd into both directories?
Description
This PR adds support for Hubble control plane in Retina agent. This is being done in the most backward compatible way possible.
I am adding a new subcommand called
hubble-control-plane
which will start Hubble instead of existing control plane.Changes made
controller/main.go
now is just the starting point of the commandretina/cmd
now housesrootCmd
(starts retina as is) andhubble
(starts Hubble control plane)Hubble
cli in agent imagedeploy/legacy
doc
init
to add a step that creates Cilium dirs (This will happen for current control plane as well, but it consumes no resources, just creates an empty directory)pkg
contains business logic required to run Hubble (node reconciler, Hubble control plane, IPCache, etc.)test/e2e
to support change to deployment directory (deploy
->deploy/legacy
)Related Issue
#418
Checklist
git commit -S -s ...
). See this documentation on signing commits.Screenshots (if applicable) or Testing Completed
Retina with Hubble
Retina
Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.