-
Notifications
You must be signed in to change notification settings - Fork 430
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 AzureMachineReconciler to inject AzuremachineService as dependency #1053
Conversation
Hi @shysank. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
apidiff:
|
/retest |
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'm not clear that the azureMachineServiceFactory
will be set anywhere besides tests. If the ability to inject an azureMachineServiceFactory
for testing purposes, perhaps, that can be done simply by having a test within the same package as this struct and set the struct field directly.
813203a
to
b202333
Compare
b202333
to
655e949
Compare
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.
lgtm
@CecileRobertMichon wdyt?
controllers/interfaces.go
Outdated
import "context" | ||
|
||
// Reconciler provides operations for a reconciliation service | ||
type Reconciler interface { |
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.
this looks very similar to https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/master/cloud/interfaces.go#L28, I wonder if we should consider combining them.
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.
Should we just make azuremachineService
also be of type azure.Service
? As in it still does reconcile
and delete
like other cloud/services except that it is kind of a composite service which orchestrates other individual services?
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.
If I recall, @shysank made azuremachineService a azure.Service initially. I advised against that because I didn't want anyone to infer the azuremachineService was actually a cloud service, one of the services that lives ./cloud/services
.
I think the Service
interface is really an abstract concept that overflows the bounds of ./cloud/services
. It is a description of the reconcile behavior, reconcile to state or delete.
@CecileRobertMichon do you remember talking about how a reconciler could be a composition of reconiling services? I think this is that pattern is surfacing. azuremachineService
is a reconciling service composed of a collection of reconciling services, in some order of operations.
Perhaps, we just use azure.Service
for now, and look to lift the interface from the azure
package into a more generic package in a refactor.
Sorry if I've going into the bike shed on this one, but I just want to ensure we are making abstractions at the right levels.
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.
Perhaps, we just use azure.Service for now, and look to lift the interface from the azure package into a more generic package in a refactor.
SGTM. When I say combine them, I mostly meant the cloud/services should be a composition of reconcilers. I think the interface should live outside cloud/ as well.
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.
@devigned @CecileRobertMichon For now, I've made azureMachineReconciler
to use azure.service
. Filed an issue to move azure.Service
outside of cloud/
, PTAL.
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.
Overall PR lgtm, I like this second iteration a lot better. Thanks @shysank!
655e949
to
4dba704
Compare
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.
/lgtm
/test pull-cluster-api-provider-azure-e2e |
4dba704
to
dcc68d6
Compare
@shysank: 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. |
@CecileRobertMichon Just noticed that I missed to use |
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.
/lgtm
/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 type of PR is this?
/kind cleanup
What this PR does / why we need it:
Refactors AzureMachineReconciler to inject AzuremachineService as dependency
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes#1047 (partially)
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: