-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Modular daemon and operator #25986
Modular daemon and operator #25986
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
b4d6eb9
to
9059ead
Compare
9059ead
to
311af99
Compare
Force-pushed to resolve a conflict with the main branch. |
0fcd052
to
9c8ce76
Compare
c39b84d
to
13b6d91
Compare
13b6d91
to
089bf83
Compare
@nathanjsweet rebased, could you PTAL? 🙏 Thanks! |
2ea77cf
to
d3fef43
Compare
7895f60
to
0495633
Compare
0495633
to
92d4b89
Compare
Refactor the operator cobra command and hive to avoid globals. This allows an easier use of the operator hive and/or mock operator command in tests like the controlplane ones. Since the operator is built in different variants (one for each supported provider), the commit adds a hook mechanism for the provider-specific code to add custom flags. The controlplane tests rely on the global Viper instance to correctly setup the operator. Thus, controlplane tests are temporarily disable and will be fixed in a subsequent commit. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Refactor the agent cobra command and hive to avoid globals. This allows an easier use of the agent hive and/or mock agent command in tests like the controlplane ones. The debuginfo handler of the agent API has been temporarily commented out since it depends on the removed global instance of Viper. This will be fixed in a subsequent commit. The controlplane tests rely on the global Viper instance to correctly setup the agent. Thus, relevant lines are temporarily commented out and will be fixed in a subsequent commit. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Among the debug information collected, the debuginfo API handler lists all the agent flags and values. Since a global Viper instance is no more available, the agent hive provides a cell to share a read-only copy of all the flags. Doing that it is possible to guarantee the backward compatibility of the handler output format. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
Refactor controlplane tests to separate agent and operator configuration for the test environment. This is needed since there are no more global Viper instances to configure the agent and the operator. The current flow to bootstrap a controlplane test is now: - SetupEnvironment to set the fake datapath and fake k8s clients - StartAgent to bootstrap the agent with the test specific config - StartOperator to bootstrap the operator with the test specific config Each existing controlplane test is updated accordingly. Signed-off-by: Fabio Falzoi <fabio.falzoi@isovalent.com>
92d4b89
to
9c00b80
Compare
/test |
ci-clustermesh hit a known flake, rerunning |
@pippolo84 heads-up, looks like this might have introduced CI breakage in main: https://github.com/cilium/cilium/actions/runs/5483476340 |
ah nevermind, Daniel already spotted that it's #22587 (presumably not rebased on top of this PR?). |
I think so, the reason is that this PR changed the controlplane tests API (specifically, the commit here) to account for the removal of the globals. |
Current implementation of both the agent and the operator uses global instances of both cobra.Command and hive.
This makes the agent and the operator less flexible, especially when composing the application externally (e.g: for testing purposes, like in the controlplane test framework).
This PR removes the usage of globals and allows building the agent and operator command with constructors, passing a reference to an external hive.
The removal of the global Viper instance has consequences in other part of the codebase that are also addressed in this PR:
Notes for the reviewers: review commit by commit might be simpler.