cluster-api-provider-aws
cluster-api-provider-aws copied to clipboard
Refactor reconciler function signatures in controllers
/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
/triage accepted /priority backlog /help
@richardcase: This request has been marked as needing help from a contributor.
Guidelines
Please ensure that the issue body includes answers to the following questions:
- Why are we solving this issue?
- To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
- Does this issue have zero to low barrier of entry?
- How can the assignee reach out to you for help?
For more details on the requirements of such an issue, please see here and ensure that they are met.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.
In response to this:
/triage accepted /priority backlog /help
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.
/assign
@LucaLanziani - it's probably worth synching with @Ankitasw as she is doing some refactoring in a similar area with #3345
@richardcase I think this refactor should not collide with what I am doing in #3345, is it correct? Yeah but since we will have two PRs raised, we might get merge conflicts.
I was looking yesterday at the code and I've seen that in the tests the reconcideDelete method is called using multiple cluster scopes instead of passing the different scopes.
I didn't have time to go into details on why that is but I was thinking that it might look confusing when passing in a struct if the struct looks something like this:
type ReconcilerScopes struct {
machineScope *scope.MachineScope
clusterScope cloud.ClusterScoper
ec2Scope scope.EC2Scope
elbScope scope.ELBScope
objectStoreScope scope.S3Scope
}
rs := ReconcilerScopes{
machineScope: ms,
clusterScope: cs,
ec2Scope: cs,
elbScope: cs,
objectStoreScope: cs,
}
@richardcase I think this refactor should not collide with what I am doing in #3345, is it correct? Yeah but since we will have two PRs raised, we might get merge conflicts.
What you are telling me is that I should move faster and try to get my PR in before yours ;P
@richardcase I think this refactor should not collide with what I am doing in #3345, is it correct? Yeah but since we will have two PRs raised, we might get merge conflicts.
What you are telling me is that I should move faster and try to get my PR in before yours ;P
:rofl: I only mentioned it for awareness because you are working on the same controllers.
I didn't have time to go into details on why that is but I was thinking that it might look confusing when passing in a struct if the struct looks something like this:
Personally i think we are getting to the point where passing a struct is preferable to the large number of arguments, it would be a bit cleaner. We could call it something like:
type reconcileDeleteInput struct {
}
Or something like that.
Personally i think we are getting to the point where passing a struct is preferable to the large number of arguments, it would be a bit cleaner. We could call it something like:
type reconcileDeleteInput struct { }Or something like that.
I just realized that I linked the wrong line on the test, I'm ok to change the name of the structure, I was more referring to the fact that we are assigning the same cs to ec2Scope, elbScope, objectStoreScope
/lifecycle active
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.
This bot triages PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the PR is closed
You can:
- Mark this PR as fresh with
/remove-lifecycle stale - Close this PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
This issue has not been updated in over 1 year, and should be re-triaged.
You can:
- Confirm that this issue is still relevant with
/triage accepted(org members only) - Close this issue with
/close
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/
/remove-triage accepted