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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Helm values reported on Update form (#3621) #3898

Merged
merged 5 commits into from
Dec 9, 2021

Conversation

castelblanque
Copy link
Collaborator

Signed-off-by: Rafa Castelblanque rcastelblanq@vmware.com

Description of the change

This PR tackles issue #3621 with one of the possible approaches.
Problem is caused by the way Kubeapps serializes/deserializes the modified values.
Just by having a question mark ? in a value without quotes makes the process to fail.

  • Values are initially correctly stored by Kubeapps and Helm
  • At the moment of retrieval for update is where the problem occurs here.
  • yaml module removes double quotes when performing doc.toString()

Possible workarounds

  1. Setting up yaml module to double quote any modified node in yaml with YAML.scalarOptions.str.defaultType = Type.QUOTE_DOUBLE; . However, this is a global setting and double quotes both key and value (see this PR tests). I don't think this is a nice and clean solution 馃槃 , as every everyt modified node shows double quoted.
  2. Trying with js-yaml module instead of yaml. -> It doesn't work due to Yaml comments being erased
  3. Trying to upgrade yaml module to major version "2.x" could make it. This major release contains differentiated settings for double quoting keys or values. But after trying the upgrade, dashboard breaks. This could be the most effective solution, as we could double quote only values and not keys. It requires a major upgrade to the module that could bring unforeseen effects in other parts of the app.

Workaround 1 is included in this PR.

Benefits

This PR is just for discussion by now. No real benefit so far.

Possible drawbacks

To be discussed.

Applicable issues

Additional information

Rafa Castelblanque added 2 commits December 3, 2021 15:24
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
@absoludity
Copy link
Contributor

Remember to set it to ready for review once you're ready (I'll assume if a PR is draft that you don't yet want people to review it, unless explicitly asked).

@castelblanque
Copy link
Collaborator Author

castelblanque commented Dec 7, 2021

The implemented approach in this PR is not the best one, but the quickest.
Let's have it merged if you agree after I fix some failing tests, and I'll create another task to upgrade major version of YAML library and improve this.
With that version in place, we can get rid of double quotes on modified Yaml field names.

@absoludity
Copy link
Contributor

absoludity commented Dec 7, 2021

The implemented approach in this PR is not the better one, but the quickest. Let's have it merged if you agree after I fix some failing tests, and I'll create another task to upgrade major version of YAML library and improve this. With that version in place, we can get rid of double quotes on modified Yaml field names.

Yep, happy to take a look... all I meant with my comment above was that you've got the PR in a Draft state, which usually means you don't want people to look at it yet.

Note that the dashboard tests are failing with a related error, so it's not clear to me yet whether that means the change here isn't working or is but tests haven't been updated (they seem to be for tests that you've explicitly updated).

Copy link
Contributor

@absoludity absoludity left a comment

Choose a reason for hiding this comment

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

Once the tests are passing, +1 . At first I thought that the failing tests were related to the test changes you made here, but I see that the test changes here are just to ensure the result for comparison can contain double-quotes... great. So the failing tests are just other examples where values come back double-quoted (and I assume just need updating to match).

Rafa Castelblanque added 3 commits December 9, 2021 13:26
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
Signed-off-by: Rafa Castelblanque <rcastelblanq@vmware.com>
@castelblanque castelblanque marked this pull request as ready for review December 9, 2021 13:48
@castelblanque castelblanque merged commit 2d128cc into master Dec 9, 2021
@castelblanque castelblanque deleted the 3621-Wrong-Helm-values-update branch December 9, 2021 15:04
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.

UI: Helm values not correctly reported
2 participants