-
Notifications
You must be signed in to change notification settings - Fork 296
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
Refactor CAPV controller context #2295
Comments
Sounds perfect. Thank you! |
Just stating the obvious probably. The idea would be basically to use the
|
/assign |
The first PR to pass down context to controller/reconciler are in review #2339. Please feel free to pick up other tasks listed above once it is merged. We can assign this issue to multiple assignees :) Thanks! |
Let's hold this for a bit (hopefully only a few days). I started to unblock the logging work and had to add more context handling across half the repo. Let's get this one in first to avoid duplicate work: #2352 |
Updated the tasks above with the controllers already refactored via #2352 |
Added task:
|
I'll take this one! 😄
|
I can pick |
/assign @Ankitasw |
I'll continue with this one.
|
I would like to help on this one:
|
Thx folks! I've updated the list above accordingly |
I can pick |
/assign @xiujuanx |
/assign @Madhur97 |
/assign @MrDXY |
Absolutely. Let's not start using contextual logging in these PRs. |
I believe first 3 entries: |
@adityabhatia yes, just linked them in case of any confusion. |
#2398 should be merging now too. Afterwards we can do the final steps and verify that we didn't miss a case :-) |
Thanks for taking the next tasks @zhanggbj ! |
Sounds good, thank you! |
/kind feature
Describe the solution you'd like
[A clear and concise description of what you want to happen.]
Currently CAPV has a customized Controller Context which wraps context.Context along with other essential controller-related information as here. This context is propagated across controllers and reconcilers. However, this approach comes with drawbacks:
containedctx
lint, which emphasizes that 'Contexts should not be stored inside a struct type, but instead passed to each function that needs it'.func (r clusterReconciler) reconcileNormal(ctx *context.ClusterContext)
Given the sensitivity of context usage, particularly its impact across controllers, propose a refactoring of the controller context, aiming to split it into golang context and the CAPV controller context. This will be achieved incrementally through the following steps:
Enable the linter
containedctx
and use '//nolint:containedctx' to exclude current findings. Refer to Audit golangci-lint config #2058 . (@zhanggbj 🌱 lint: enable containedctx lint #2297 )rename all "CAPV context's" in a consistent way: e.g. ControllerContext => controllerCtx, also like imported package alias, function signature (@zhanggbj 🌱 Rename controller context and golang context #2309 )
Introduce new ctx context.Context parameters to controller and reconciler and underlying functions, such as functions under /pkg, also fix Unit Test. We can break this down by controllers as outlined below, but let's begin and be open to adjustments as needed.
get rid of our containedctx's exception and removed context.Context from capv customized controller Context (@zhanggbj 🌱 Remove context from capv customized controller context #2431)
check that there are no leftover
context.TODO()
's (indicates we missed something to refactor above) (@zhanggbj 🌱 Remove context from capv customized controller context #2431)Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
Environment:
kubectl version
):/etc/os-release
):The text was updated successfully, but these errors were encountered: