-
Notifications
You must be signed in to change notification settings - Fork 431
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
Clean up ./cloud/services #1001
Comments
/help |
@CecileRobertMichon: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign |
@shysank please don't hesitate to ping me if you have any questions. Might be best to refactor one service in a PR before refactoring all at the same time. |
any thoughts on how to replace code like cluster-api-provider-azure/exp/controllers/azuremangedcontrolplane_reconciler.go Lines 219 to 263 in e92bba9
notably, I don't see many other reconcilers which write data back into the CRD? |
that blurb is long -- referencing |
I see:
|
Ahh... the code for I would focus on a service not used by the |
I was thinking about how to refactor them in line with the same pattern (or if we should avoid that?) seems like the above solution would be one approach |
We should refactor them. I've been remiss in not getting to them. |
@devigned I'm trying to refactor
|
Great questions, @shysank.
@CecileRobertMichon & @nader-ziada wdyt about this? |
what is the reason to return an interface? its usually not a best practice and I worry we might be complicating things by adding extra abstractions |
I guess my main concern was to avoid code like this |
I was recommending an interface since at some point in the future, we will likely replace the cloud code to use Azure Service Operator to reconcile Azure resources rather than the cloud services directly. As long as Reconcile and Delete are the only funcs exported, I'm 💯 behind return in a struct rather than an interface. |
Just a thought, I'm noticing several places where exporting Reconcile/Delete and handing that off to another implementer is not really sufficient. There are several places where the services write back into crds, several of which have bugs or awkward ergonomics right now. I would not expect ASO or another project to implement some of these things as part of reconcile a resource, since they are CAPI/CAPZ specific. examples:
other random opportunities for cleanup:
|
we still need to refactor the other services /reopen |
@nader-ziada: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@shysank are you planning on working on the other services as well? |
@nader-ziada Yeah, I'll take on the rest. Just caught up on some pending work in capi prs. Will start working on this once that is done. |
/assign |
/kind cleanup
Describe the solution you'd like
A while back, the code used to interact with Azure under
./cloud/services
was interfaced to allow some separation of concern between the controller / scopes and the types from the Azure SDK. With the advent of theazure.Service
interface, Azure SDK / client code doesn't leak into the controllers. In fact, there should not longer be dependencies on the code that directly interacts with Azure. We should use this as an opportunity to crystallize this design goal of refactoring toazure.Service
by cleaning up the service internals.Current structure:
Proposed structure:
The only thing exported from the new structure is the
Service
struct and theScope
interface for each service. This will ensure that the encapsulation will not be violated and guide future contributors.The text was updated successfully, but these errors were encountered: