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

Adopt a Reconcile/Delete pattern for exported methods #110

Closed
justaugustus opened this issue Mar 4, 2019 · 18 comments
Closed

Adopt a Reconcile/Delete pattern for exported methods #110

justaugustus opened this issue Mar 4, 2019 · 18 comments
Assignees
Labels
kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Milestone

Comments

@justaugustus
Copy link
Member

justaugustus commented Mar 4, 2019

Describe the solution you'd like
The goals are two-fold here:

  1. Adopt a consistent pattern/interface for retrieving/modifying/deleting Cluster/Machine/Azure resources
  2. Minimize calls to Azure by storing more information in Cluster & Machine objects

For each actuator reconciler, we currently have Reconcile and Delete methods which operate over the lower-level Azure resources.

Instead of handling implementation details in the top-level reconciler, we should scope them to the resources that they're operating over. As an example, a SubnetSpec should instead be generated/manipulated by a subnet reconciler:

subnetSpec := &subnets.Spec{
Name: azure.GenerateControlPlaneSubnetName(s.scope.Cluster.Name),
CIDR: azure.DefaultControlPlaneSubnetCIDR,
VnetName: azure.GenerateVnetName(s.scope.Cluster.Name),
SecurityGroupName: azure.GenerateControlPlaneSecurityGroupName(s.scope.Cluster.Name),
}

As a concrete reference, see the ReconcileNetwork() method for Cluster API Provider AWS.

A secondary problem is that in our current actuator reconciler model, we make a variety of Create/Update calls to the Azure API, in instances where a Get would suffice. This means we're attempting to modify a majority of the Azure resources we create on every round-trip of a reconciler.

Finally, we do not fully utilize the defined types in the capz API, instead accepting an ambiguous spec and returning a loosely-defined interface, instead of a concrete type.

This means that we are required to query Azure for cluster/machine information, instead of being able to reference the ClusterSpec, ClusterStatus, MachineSpec, and MachineStatus directly, which should be our sources of truth.


As a solution, we can:

  • Redefine the Service interface to present only Reconcile and Delete methods
  • Add a temporary interface (GetterService) to represent packages that don't adhere to the Reconcile/Delete model
  • Refactor packages to adhere to Reconcile/Delete model, which will convert and store Azure resource information in the relevant Spec or Status
  • Redefine package-level CreateOrUpdate/Gets as unexported methods (only to be used by the package-level Reconcile/Delete)
  • Remove references to unexported methods from the top-level reconcilers
  • Remove the temporary GetterService interface

The work to accomplish this has begun in #174.

ref: #92
/kind feature

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Mar 4, 2019
@justaugustus
Copy link
Member Author

/milestone v1alpha1
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added this to the v1alpha1 milestone Mar 6, 2019
@k8s-ci-robot k8s-ci-robot added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Mar 6, 2019
@justaugustus
Copy link
Member Author

/assign
/remove-help
/priority important-soon
/remove-priority important-longterm

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Apr 10, 2019
@justaugustus justaugustus changed the title Minimize calls to Azure by storing more information in Cluster & Machine objects Adopt a Reconcile()/Delete() pattern for exported methods Apr 10, 2019
@justaugustus justaugustus changed the title Adopt a Reconcile()/Delete() pattern for exported methods Adopt a Reconcile/Delete pattern for exported methods Apr 10, 2019
@justaugustus
Copy link
Member Author

/kind design

@k8s-ci-robot k8s-ci-robot added the kind/design Categorizes issue or PR as related to design. label Apr 10, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 9, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 8, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

@justaugustus
Copy link
Member Author

/reopen
/remove-lifecycle rotten

@juan-lee
Copy link
Contributor

Have we considered implementing our services as CRDs? @justaugustus

@justaugustus justaugustus modified the milestones: v0.3, next Nov 7, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 5, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 6, 2020
@rbitia
Copy link
Contributor

rbitia commented Mar 20, 2020

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Mar 20, 2020
@justaugustus justaugustus modified the milestones: next, v0.5 Mar 30, 2020
@CecileRobertMichon
Copy link
Contributor

@juan-lee see #416 😃

@CecileRobertMichon
Copy link
Contributor

@justaugustus is it okay if I help out with this?

@CecileRobertMichon
Copy link
Contributor

/assign

@CecileRobertMichon
Copy link
Contributor

/close

in favor of #757

@k8s-ci-robot
Copy link
Contributor

@CecileRobertMichon: Closing this issue.

In response to this:

/close

in favor of #757

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

No branches or pull requests

6 participants