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

Issue 154: BK Operator should support multiple ledger PVCs, multiple journal PVCs and multiple index PVCs for 1 bookie #155

Conversation

CraneShiEMC
Copy link
Contributor

@CraneShiEMC CraneShiEMC commented Jun 24, 2021

Change log description

BK Operator should support multiple ledger PVCs, multiple journal PVCs and multiple index PVCs for 1 bookie.
Now, if we set flag option multiVolumesSetPerBookieEnabled to true and we provide multiple ledger directories in ledgerDirectories options, for example, ledgerDirectories: "/bk/ledgers/l0,/bk/ledgers/l1,/bk/ledgers/l2,/bk/ledgers/l3", for each ledger directory such as /bk/ledgers/l0, bk operator will create 1 PVC with VolumeMount mount to this ledger directory. So does journalDirectories and indexDirectories options.

By default, i.e. we don't set flag option multiVolumesSetPerBookieEnabled or we set this option to false, the bookkeeper operator will still have original behavior, i.e. 1 PVC with multiple volume mounts for multiple directories will be used.

Purpose of the change

Fixes #154

What the code does

Now, if we set flag option multiVolumesSetPerBookieEnabled to true and provide multiple ledger directories in ledgerDirectories options, for example, ledgerDirectories: "/bk/ledgers/l0,/bk/ledgers/l1,/bk/ledgers/l2,/bk/ledgers/l3", for each ledger directory such as /bk/ledgers/l0, bk operator will create 1 PVC with VolumeMount mount to this ledger directory. So does journalDirectories and indexDirectories options.

By default, i.e. we don't set flag option multiVolumesSetPerBookieEnabled or we set this option to false, the bookkeeper operator will still have original behavior, i.e. 1 PVC with multiple volume mounts for multiple directories will be used.

How to verify it

Provide multiple directories for ledgerDirectories, journalDirectories or indexDirectories options and set flag option multiVolumesSetPerBookieEnabled to true while deploying bookies. Then, verify whether multiple PVCs for ledgers, journals or indices has been bound to each bookie as expected, one PVC mount to one directory.

In our ObjectScale deployment with Pravega, bookie's multiple ledger PVCs, journal PVCs, index PVCs has been created and mount to multiple directories as expected. Also bookie has functioned normally and the IO can be balanced between multiple PVCs.

In addition, we have verified the negative test cases without multiVolumesSetPerBookieEnabled set and the bookie has original behavior as expected.

@codecov-commenter
Copy link

Codecov Report

Merging #155 (90fbf8a) into master (a0f1a00) will increase coverage by 0.57%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
+ Coverage   81.42%   82.00%   +0.57%     
==========================================
  Files           9        9              
  Lines        1588     1639      +51     
==========================================
+ Hits         1293     1344      +51     
  Misses        229      229              
  Partials       66       66              
Impacted Files Coverage Δ
pkg/controller/bookkeepercluster/bookie.go 97.47% <100.00%> (+0.38%) ⬆️
...pis/bookkeeper/v1alpha1/bookkeepercluster_types.go 85.66% <0.00%> (ø)
.../apis/bookkeeper/v1alpha1/zz_generated.deepcopy.go 97.52% <0.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0f1a00...90fbf8a. Read the comment docs.

@CraneShiEMC CraneShiEMC requested a review from anishakj July 7, 2021 10:48
var multiVolumesSetPerBookieEnabled bool
var ok bool

if _, ok = bk.Spec.Options["ledgerDirectories"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 407-428 might not be required, if we are making multivolume support to false . Could you please verify that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 407-428 might not be required, if we are making multivolume support to false . Could you please verify that?

OK. I will optimize this part according to your suggestion.

Copy link
Contributor

@anishakj anishakj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unit tests for the new code paths

Copy link
Contributor

@SrishT SrishT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CraneShiEMC the changes look good.
I would however request you to increase code coverage and add documentation to explain how this option multiVolumesSetPerBookieEnabled should be configured to get the desired behaviour. Also please rebase your code (that would fix the end to end tests as well)
Could u also add a separate PR in the charts repo, inside the bookkeeper charts, wherein the option multiVolumesSetPerBookieEnabled has also been added inside the bookkeeper options field with its default value (false) ?

@CraneShiEMC
Copy link
Contributor Author

@CraneShiEMC the changes look good.
I would however request you to increase code coverage and add documentation to explain how this option multiVolumesSetPerBookieEnabled should be configured to get the desired behaviour. Also please rebase your code (that would fix the end to end tests as well)
Could u also add a separate PR in the charts repo, inside the bookkeeper charts, wherein the option multiVolumesSetPerBookieEnabled has also been added inside the bookkeeper options field with its default value (false) ?

OK! I will change the code according to your comments

@jkhalack
Copy link

jkhalack commented Nov 9, 2021

Please, add a validation that multiVolumesSetPerBookieEnabled option is not changed on BK-cluster update.
The best place to do it would be at the same time we are checking that ledger/journal directory paths have not changed: https://github.com/pravega/bookkeeper-operator/blob/master/pkg/apis/bookkeeper/v1alpha1/bookkeepercluster_types.go#L763-L779

@anishakj anishakj closed this Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BK Operator should support multiple ledger PVCs, multiple journal PVCs and multiple index PVCs for 1 bookie
5 participants