-
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
💎 Refactor public IP service to get Spec from scope #716
💎 Refactor public IP service to get Spec from scope #716
Conversation
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.
I like the approach in general 👍 but was a little confused about a couple of things when I tried to follow the code flow
Basically, |
@CecileRobertMichon makes sense, I get it now 👍 |
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.
I like the inversion of control from the call site of the reconcile function to the reconciler being dependent on the data in the scope. It feels like this is more in the spirt of a reconciliation loop.
sorry for all the conflicts :( |
No worries!! I knew what I was getting into 😄 |
726dc9f
to
5df99f2
Compare
@alexeldeib would love your thoughts on this approach when you have a second. I think this achieves what we discussed in #627:
|
366efb4
to
5f72de3
Compare
62501c4
to
7e1c44c
Compare
7e1c44c
to
a89eb3c
Compare
@CecileRobertMichon: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
/lgtm |
/lgtm definitely happy with inverting control and slimming down scope per service 👍 |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it: Following up from #713, this is a proof of concept with the Public IPs service to stop using a mix of spec + scope in services as input for Reconcile() and Delete().
Before:
https://github.com/CecileRobertMichon/cluster-api-provider-azure/blob/06d0321be5fefd840ea1742b9c16a7ce72b98378/cloud/interfaces.go#L34-L37
After:
https://github.com/CecileRobertMichon/cluster-api-provider-azure/blob/06d0321be5fefd840ea1742b9c16a7ce72b98378/cloud/interfaces.go#L27-L30
Instead of taking cluster scope or machine scope types as input, each service will have its own scope interface that explicitly defines what information getters the service needs that the passed in scope (either AzureCluster or AzureMachine) needs to implement: https://github.com/CecileRobertMichon/cluster-api-provider-azure/blob/06d0321be5fefd840ea1742b9c16a7ce72b98378/cloud/services/publicips/service.go#L22-L25
This only changes the Pubic IP service while keep all other services intact (renamed the interface to
OldService
). The idea is to facilitate review and focus on the concept rather than on each service's details. Once I get reviewer consensus, I will proceed to refactor all the other services by opening a PR for each one. This following PRs will be smaller as this one does most of the heavy lifting in machine scope and cluster scope./hold
/cc @devigned @alexeldeib @justaugustus @nader-ziada
Would love to get your thoughts on this approach.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Partially addresses #110 , #627 and #609
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
TODOs:
Release note: