Skip to content
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 most services into Reconcile/Delete pattern #713

Merged

Conversation

CecileRobertMichon
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon commented Jun 15, 2020

What this PR does / why we need it: Remove the exported Get() function from every Service except availability zones, virtual machines, scale sets, and managed clusters (these will be addressed in follow-ups.)

In order to keep the size of this PR manageable and facilitate reviews, I tried to scope this refactor down to only Services that did have Get() calls within the controller/reconciler.

** ⚠️ Important:** This is NOT the north star. This is closer to the end goal:
https://github.com/CecileRobertMichon/cluster-api-provider-azure/compare/reconcile-delete...CecileRobertMichon:public-ips-scope?expand=1#diff-890b2d661da1708cb3d23d43fc548ceeR28
This PR is just an intermediary step to get there.

Future work:

  • Adopt Reconcile/Delete pattern for virtual machines, scale sets and managed clusters
  • remove dependency on Availability Zones Get() within the AzureMachine controller
  • stop using a mix of spec + scope in services as input (WIP here)

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 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:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 15, 2020
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. area/provider/azure Issues or PRs related to azure provider labels Jun 15, 2020
@k8s-ci-robot k8s-ci-robot added sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 15, 2020
type azureMachineService struct {
machineScope *scope.MachineScope
clusterScope *scope.ClusterScope
availabilityZonesSvc azure.GetterService
networkInterfacesSvc azure.Service
virtualMachinesSvc azure.GetterService
disksSvc azure.GetterService
virtualMachinesSvc *virtualmachines.Service
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is temporary to allow removing use of GetterService. In a follow up, virtualMachinesSvc will also become an azure.Service after we remove all Get() calls from the controller (see #110 for more info).

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 15, 2020
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 16, 2020
@CecileRobertMichon CecileRobertMichon changed the title [WIP] 💎 refactor most services into Reconcile/Delete pattern 💎 refactor most services into Reconcile/Delete pattern Jun 16, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 16, 2020
@CecileRobertMichon
Copy link
Contributor Author

/hold for release

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 16, 2020
@CecileRobertMichon
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 16, 2020
@CecileRobertMichon CecileRobertMichon force-pushed the reconcile-delete branch 2 times, most recently from 9454f9e to e8b666c Compare June 17, 2020 17:49
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 17, 2020

@CecileRobertMichon: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-cluster-api-provider-azure-apidiff 304e47d link /test pull-cluster-api-provider-azure-apidiff

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
Copy link
Contributor Author

/assign @devigned @nader-ziada @alexeldeib

Copy link
Contributor

@devigned devigned left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Always good to see more red than green in a refactor. Definitely looking forward to the refactor containing the IPAddress changes.

@nader-ziada
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 17, 2020
@k8s-ci-robot k8s-ci-robot merged commit 790ec1c into kubernetes-sigs:master Jun 17, 2020
@k8s-ci-robot k8s-ci-robot added this to the v0.5 milestone Jun 17, 2020
@CecileRobertMichon CecileRobertMichon deleted the reconcile-delete branch July 9, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants