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
STOR-977: Refactor reconcilers #363
STOR-977: Refactor reconcilers #363
Conversation
6c9ad3a
to
2db7fd0
Compare
/retest |
3281c89
to
8f2af82
Compare
RuntimeConfig handling is copy pasted in each Reconcile() of deleter, localvolume and localvolumeset controllers. Adding a helper that can be reused in all of them.
RuntimeConfig from sig-storage-local-static-provisioner/pkg/common module contains a mix of values that are static and dynamic. Static values should be set in constructor only and don't change for the entire lifecycle of DeleteReconciler - for example cache, client... Dynamic values could be changed and so they need to be reloaded during reconcile using ReloadRuntimeConfig helper - for example values from config map, node name... Ideally those should be separated but that would require changing the vendored package but still the code can be refactored so the constructor is cleaner and RuntimeConfig is taken out of the constructor. This results in more readable code and better test code since RuntimeConfig is where most fakes are needed for testing.
8f2af82
to
5435f29
Compare
@RomanBednar: all tests passed! Full PR test history. Your PR dashboard. 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. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gnufied, RomanBednar 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 |
This is a minor refactoring, CI should catch regressions |
/label qe-approved |
Introduce a new helper function - ReloadRuntimeConfig() that loads runtime config values needed for reconcile loops at one place. This should help make the code cleaner by removing copy-paste code and scattered runtime config changes.
Also adding proper constructors to reconcilers which should improve readability and ease constructing them with fakes in tests.
cc @openshift/storage