kubernetes-sigs/cluster-api-provider-aws
View on GitHubRefactor reconciler function signatures in controllers
Open
#3,316 opened on Mar 16, 2022
help wantedkind/refactorlifecycle/staleneeds-triagepriority/backlog
Repository metrics
- Stars
- (723 stars)
- PR merge metrics
- (PR metrics pending)
Description
/kind refactor
Describe the solution you'd like SInce we have got a lot of input scope parameters to reconcile functions in controllers, it would be good to add an input struct for these functions with all the scopes we are passing in.
Example Current code
func (r *AWSMachineReconciler) reconcileDelete(machineScope *scope.MachineScope, clusterScope cloud.ClusterScoper, ec2Scope scope.EC2Scope, elbScope scope.ELBScope, objectStoreScope scope.S3Scope) (ctrl.Result, error) {
Expectation
type ReconcilerScopes struct {
machineScope *scope.MachineScope
clusterScope cloud.ClusterScoper
ec2Scope scope.EC2Scope
elbScope scope.ELBScope
objectStoreScope scope.S3Scope
}
func (r *AWSMachineReconciler) reconcileDelete(rs ReconcilerScopes) (ctrl.Result, error) {
We should take care of all such instances in controllers. Originally posted by @richardcase in https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/2271#r805753482