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

STOR-977: Refactor reconcilers #363

Merged
merged 6 commits into from Aug 29, 2022

Conversation

RomanBednar
Copy link
Contributor

@RomanBednar RomanBednar commented Jul 18, 2022

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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 18, 2022
@openshift-ci openshift-ci bot requested review from gnufied and jsafrane July 18, 2022 13:36
@RomanBednar
Copy link
Contributor Author

/retest

@RomanBednar RomanBednar force-pushed the deleter-refactor branch 5 times, most recently from 3281c89 to 8f2af82 Compare August 11, 2022 13:49
@RomanBednar RomanBednar changed the title WIP: Refactor reconcilers Refactor reconcilers Aug 11, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 11, 2022
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.
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 25, 2022

@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.

@RomanBednar RomanBednar changed the title Refactor reconcilers STOR-977: Refactor reconcilers Aug 26, 2022
@gnufied
Copy link
Member

gnufied commented Aug 26, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2022
@gnufied
Copy link
Member

gnufied commented Aug 26, 2022

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 26, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2022
@jsafrane
Copy link
Contributor

This is a minor refactoring, CI should catch regressions
/label docs-approved
/label px-approved

@openshift-ci openshift-ci bot added docs-approved Signifies that Docs has signed off on this PR px-approved Signifies that Product Support has signed off on this PR labels Aug 29, 2022
@jsafrane
Copy link
Contributor

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Aug 29, 2022
@openshift-merge-robot openshift-merge-robot merged commit 2e07245 into openshift:master Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants