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-464:Added support for JvmOption customization #462

Merged
merged 9 commits into from
Oct 20, 2020

Conversation

Prabhaker24
Copy link
Contributor

@Prabhaker24 Prabhaker24 commented Oct 12, 2020

Signed-off-by: prabhaker24 [email protected]

Change log description

This pr will enable the user to modify both controller and sgmentstore JVMOptions as well as options during runtime

Purpose of the change

Fixes #464

What the code does

The code looks for any change in the jvm option or option in either of controller or segmentstore and if there is a change i.e user has changed any of the jvmOptions or options or has added a new value, in that case, we update the configmap and restart each pod one by one.
I am doing validation as well and is done by the method validateConfigMap() which ensures user doesn't change any of the following values:-

  1. controller.containerCount
  2. controller.container.count
  3. pravegaservice.containerCount
  4. pravegaservice.container.count
  5. bookkeeper.bkLedgerPath
  6. bookkeeper.ledger.path
  7. controller.retention.bucketCount
  8. controller.retention.bucket.count
  9. controller.watermarking.bucketCount
  10. controller.watermarking.bucket.count
  11. pravegaservice.dataLogImplementation
  12. pravegaservice.dataLog.impl.name
  13. pravegaservice.storageImplementation
  14. pravegaservice.storage.impl.name
  15. storageextra.storageNoOpMode
  16. storageextra.noOp.mode.enable

How to verify it

  1. Deploy Pravega cluster and update segmentstore JVM Option we should see that segmentstore configmap should get updated and each pod should restart sequentially.
  2. Deploy Pravega cluster and update controller JVM Option we should see that controller configmap should get updated and each pod should restart sequentially.
  3. Deploy Pravega cluster and update Option we should see that controller and segmentstore configmap should get updated and each of the controller and ss pod should restart sequentially.
  4. Try changing any of the above 16 values that the user is not supposed to change and the operator should error saying that the parameter is not supposed to be changed.

@Prabhaker24 Prabhaker24 marked this pull request as ready for review October 12, 2020 13:39
@codecov-io
Copy link

codecov-io commented Oct 12, 2020

Codecov Report

Merging #462 into master will decrease coverage by 2.69%.
The diff coverage is 17.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #462      +/-   ##
==========================================
- Coverage   75.29%   72.60%   -2.70%     
==========================================
  Files          15       15              
  Lines        3068     3285     +217     
==========================================
+ Hits         2310     2385      +75     
- Misses        669      803     +134     
- Partials       89       97       +8     
Impacted Files Coverage Δ
pkg/apis/pravega/v1beta1/pravegacluster_types.go 26.20% <5.71%> (+3.46%) ⬆️
...roller/pravegacluster/pravegacluster_controller.go 50.45% <22.95%> (-10.46%) ⬇️
pkg/controller/pravega/pravega_controller.go 100.00% <100.00%> (ø)
pkg/controller/pravega/pravega_segmentstore.go 100.00% <100.00%> (ø)
pkg/util/pravegacluster.go 97.03% <100.00%> (+0.09%) ⬆️

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 569dfb3...4a2632c. Read the comment docs.

err = r.client.Create(context.TODO(), configMap)
if err != nil && !errors.IsAlreadyExists(err) {
return err
err = r.client.Get(context.TODO(), types.NamespacedName{Name: configMap.Name, Namespace: p.Namespace}, currentConfigMap)
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not seem like a good place and a good way to check for updates to config map.
Please follow the logic used in zookeeper -operator:
https://github.com/pravega/zookeeper-operator/blob/master/pkg/controller/zookeepercluster/zookeepercluster_controller.go#L150

In p-operator we're checking very specific things in the reconcile loop, instead of checking for updates to each component and that is complicating the flow of code way too much...
Lets refactor and change it to the way it is done in ZK operator...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -329,6 +351,29 @@ func (r *ReconcilePravegaCluster) deployController(p *pravegav1beta1.PravegaClus
if err != nil && !errors.IsAlreadyExists(err) {
return err
}
if !eq {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment adding too many ifs... complicates the flow of code.. I think its time to refactor the reconcile loop...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Prabhaker24 Prabhaker24 changed the title issue-316:Added support for JvmOption customization issue-464:Added support for JvmOption customization Oct 16, 2020
Signed-off-by: prabhaker24 <[email protected]>
Copy link
Contributor

@pbelgundi pbelgundi left a comment

Choose a reason for hiding this comment

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

LGTM. Just make sure we add enough tests to cover this.

prabhaker24 added 2 commits October 19, 2020 15:58
Signed-off-by: prabhaker24 <[email protected]>
err = pravega_e2eutil.UpdatePravegaCluster(t, f, ctx, pravega)
g.Expect(err).NotTo(HaveOccurred())

//checking if the upgrade of options was successfull
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix the typo successful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Signed-off-by: prabhaker24 <[email protected]>
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.

LGTM

@anishakj anishakj merged commit 1c5f0ce into master Oct 20, 2020
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.

Pravega Spec parameters for options and jvm options are not updatable at runtime
4 participants