kubernetes-sigs/cluster-api-provider-aws

Refactor reconciler function signatures in controllers

Open

#3,316 建立於 2022年3月16日

在 GitHub 查看
 (17 留言) (0 反應) (1 負責人)Go (689 fork)auto 404
help wantedkind/refactorlifecycle/staleneeds-triagepriority/backlog

倉庫指標

Star
 (723 star)
PR 合併指標
 (PR 指標待抓取)

描述

/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

貢獻者指南