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 491: Handling config key name changes #492

Merged
merged 4 commits into from
Jan 13, 2021

Conversation

SrishT
Copy link
Contributor

@SrishT SrishT commented Jan 3, 2021

Signed-off-by: SrishT [email protected]

Change log description

Pravega webhook fails upgrade even when just the name of the configuration keys is modified as per the new naming convention (ref. pravega/pravega#4713)

Purpose of the change

Fixes #491

How to verify it

Upgrade pravega from version 0.7.0 to 0.8.0 and along with it also modify the name of the pravega option name from controller.containerCount to controller.container.count without modifying its value. The upgrade should be allowed and you should not see the following error message

cannot patch "nautilus" with kind PravegaCluster: admission webhook "pravegawebhook.pravega.io" denied the request: controller.container.count should not be changed

@codecov-io
Copy link

codecov-io commented Jan 3, 2021

Codecov Report

Merging #492 (63715bf) into master (70a0fc3) will decrease coverage by 0.87%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #492      +/-   ##
==========================================
- Coverage   72.49%   71.62%   -0.88%     
==========================================
  Files          15       15              
  Lines        3370     3411      +41     
==========================================
  Hits         2443     2443              
- Misses        824      865      +41     
  Partials      103      103              
Impacted Files Coverage Δ
pkg/apis/pravega/v1beta1/pravegacluster_types.go 25.36% <0.00%> (-1.47%) ⬇️

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 70a0fc3...63715bf. Read the comment docs.

@SrishT SrishT marked this pull request as ready for review January 5, 2021 16:59
@SrishT SrishT requested review from anishakj and Prabhaker24 January 5, 2021 16:59
@@ -1065,8 +1069,10 @@ func (p *PravegaCluster) validateConfigMap() error {
}
if val, ok := p.Spec.Pravega.Options["bookkeeper.ledger.path"]; ok {
checkstring := fmt.Sprintf("-Dbookkeeper.ledger.path=%v", val)
eq := strings.Contains(configmap.Data["JAVA_OPTS"], checkstring)
if !eq {
eq_new := strings.Contains(configmap.Data["JAVA_OPTS"], checkstring)
Copy link
Contributor

Choose a reason for hiding this comment

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

In place of contains let's check if the configmap.Data["JAVA_OPTS"] is equal to the checkstring or not to avoid any false positives.
Please change this at all other places too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We cannot use the equals check here since this particular option is just one of the options within the list of java options for pravega.

Copy link
Contributor

Choose a reason for hiding this comment

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

what I meant is let's think of a logic where we should check if specific option field value is equal to the changed value or not.
for eg think of a case where a user tries to change ledger path from ledgers/temp1 to ledgers this will pass our check even though the ledger path is changed.

@@ -1065,8 +1069,10 @@ func (p *PravegaCluster) validateConfigMap() error {
}
if val, ok := p.Spec.Pravega.Options["bookkeeper.ledger.path"]; ok {
checkstring := fmt.Sprintf("-Dbookkeeper.ledger.path=%v", val)
eq := strings.Contains(configmap.Data["JAVA_OPTS"], checkstring)
if !eq {
eq_new := strings.Contains(configmap.Data["JAVA_OPTS"], checkstring)
Copy link
Contributor

Choose a reason for hiding this comment

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

what I meant is let's think of a logic where we should check if specific option field value is equal to the changed value or not.
for eg think of a case where a user tries to change ledger path from ledgers/temp1 to ledgers this will pass our check even though the ledger path is changed.

Copy link
Contributor

@Prabhaker24 Prabhaker24 left a comment

Choose a reason for hiding this comment

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

LGTM

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 e6dc8e3 into master Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants