backube / scribe

Asynchronous data replication for Kubernetes CSI storage
https://scribe-replication.readthedocs.io
GNU Affero General Public License v3.0
69 stars 18 forks source link

Reduce duplication in Job reconcile functions #171

Closed JohnStrunk closed 3 years ago

JohnStrunk commented 3 years ago

Describe what this PR does Reduces some of the code duplication in the various reconcile operations

Is there anything that requires special attention?

Related issues:

160

JohnStrunk commented 3 years ago

I started w/ rsync Job, and will add rclone & restic Jobs next

codecov[bot] commented 3 years ago

Codecov Report

Merging #171 (71f982c) into master (e1e3ef1) will increase coverage by 2.9%. The diff coverage is 34.0%.

@@           Coverage Diff            @@
##           master    #171     +/-   ##
========================================
+ Coverage    41.6%   44.6%   +2.9%     
========================================
  Files           7       8      +1     
  Lines        1847    1683    -164     
========================================
- Hits          770     751     -19     
+ Misses        987     847    -140     
+ Partials       90      85      -5     
Impacted Files Coverage Δ
controllers/job_handler.go 30.4% <30.4%> (ø)
controllers/replicationdestination_controller.go 42.2% <36.0%> (+5.5%) :arrow_up:
controllers/replicationsource_controller.go 39.4% <42.6%> (+4.9%) :arrow_up:
JohnStrunk commented 3 years ago

I've consolidated the 6 Job reconcile functions, and it looks like it removes ~200 loc, greatly reducing duplication. Thoughts from the other @backube/scribemaintainers?

JohnStrunk commented 3 years ago

@sallyom I took your suggestion... WDYT?