-
Notifications
You must be signed in to change notification settings - Fork 706
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
Merge user values with defaults before validation. #5623
Conversation
Signed-off-by: Michael Nelson <minelson@vmware.com>
✅ Deploy Preview for kubeapps-dev canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Nice improvement here. Notwithstanding, I don't think the actual problem is gonna get sorted out.
I'd recall I disabled the schema validation entirely in my dev environment and it was the backend that was complaining about the validation. I mean, the schema being used by helm itself when creating the Helm release.
I wish it was just a frontend validation issue, but I'm not 100% sure of that.
Keep us posted when you test it IRL
Yep, will do - I was just seeing where the problem starts and will follow it through. Thanks. |
The main issue I faced is that the auto-generated html form validation for required fields of the schema tries to force you to enter a value, even if the package has defaults for that value. I switched that off to test, and then it works fine to remove a required field if the package has a default for that field.
You mentioned this once before, but Helm itself does not have an issue when a user does not specify a required field - as long as that field has a default. For example, in my case, I've added an updated Wordpress chart to chart-museum on my dev cluster, but for the examples below, it can all just be done via the CLI (no chart-museum required). The differences with my wordpress chart are (1) that I modified the schema to say:
So all three fields are required, but note in the values all 3 have a default value normally (even if it's an empty string for the password before it's set randomly). And (2), I updated the
But if I provide the blog name, I'm not forced to provide the user name as well (since it has a default):
Once it's set, I can even upgrade without specifying the blog name, since it's already set:
So AIUI,
Or, if I've missed something, maybe show me what you mean by the Helm CLI validation rejecting a required value that has a default? |
Signed-off-by: Michael Nelson <minelson@vmware.com>
Let me know if you're OK with the extra changes @antgamdia (in particular, switching off the html validation for required fields, since it cannot take into account default values), and the explanation above. |
Sorry, I've been traveling with limited internet connection, but yep, I'm totally ok with both the changes and reasoning. Thanks, as always, for the details!
No, no, I did mean this rejection happening when using a value without a default one. Anyway, currently, BAC is not requiring any fields (bitnami/readme-generator-for-helm#38), so this issue shouldn't be happening in a default Kubeapps installation (w/o using your repo w/ your schemas). So, as you proposed, merging default's before validation seems like a good solution. Thanks! |
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson minelson@vmware.com
Description of the change
Updates the
validateValuesSchema
function to additionally use the package default values, when specified, so that user values will be confirmed as valid even if they don't set certain values that are required by the schema but have default values specified by the package.Benefits
Enables the scenario outlined by @dud225 in #4803, where a helm chart is deployed via the Helm CLI, rather than Kubeapps, and so the values set by the user are only those actually set by the user (as opposed to when deployed with Kubeapps where we currently incorrectly send all the default values as user-set values - I may open a separate issue for that, depending on a few things).
Possible drawbacks
Applicable issues
Additional information
I've not yet tested this IRL to ensure it fixes the scenario in the issue, but will do so tomorrow.