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

Helm: Kubeapps doesn't consider the default values set from the chart #4803

Closed
dud225 opened this issue May 31, 2022 · 6 comments · Fixed by #5412 or #5623
Closed

Helm: Kubeapps doesn't consider the default values set from the chart #4803

dud225 opened this issue May 31, 2022 · 6 comments · Fixed by #5412 or #5623
Assignees
Labels
component/apis-server Issue related to kubeapps api-server component/ui Issue related to kubeapps UI kind/bug An issue that reports a defect in an existing feature

Comments

@dud225
Copy link
Contributor

dud225 commented May 31, 2022

Describe the bug
When using Kubeapps to manage a Helm deployment that has been previously installed outside of it and for which only a subset of the values were specified (relying on the default values set from the chart for the others), Kubeapps only takes into consideration the values set at installation time.

To Reproduce

  1. Install a Helm release from the command line:
helm --namespace test  install test . --set ingress.tls.enabled=false
  1. Perform an upgrade from Kubeapps
  2. If the chart has a complete schema requiring all the values to be set, Kubeapps complains that the schema validation fails because it doesn't consider the default values set from the chart

Expected behavior
Kubeapps should merge the default values set from the chart with the ones set by the user.

Screenshots
Kubeapps only considers the values set from the user:
Capture d’écran du 2022-05-31 09-43-28

If the chart schema enforces the presence of all the values, then Kubeapps complains that the values aren't valid:
Capture d’écran du 2022-05-31 09-43-46_2

Versions:

  • Version: 2.4.5
  • Kubernetes version: 1.24
  • Package version: Helm version 3.8.0
@dud225 dud225 added the kind/bug An issue that reports a defect in an existing feature label May 31, 2022
@kubeapps-bot kubeapps-bot moved this to 🗂 Backlog in Kubeapps May 31, 2022
@absoludity
Copy link
Contributor

absoludity commented May 31, 2022

From slack: yes,

Kubeapps should not be dependent on the format used for the values.yaml of an initial deploy (ie. we actually present and so submit the full values.yaml file). For example, in this case, if the validation issue is appearing during a subsequent upgrade of the 3rd party release/package in kubeapps, I assume we could (and should) be merging the values.yaml of the release with the previous installation values (I thought we were). Or maybe the issue is earlier? Anyway, if you have a chance, can you please open an issue and clear steps to reproduce, identifying where the problem appears etc. I think that'd be helpful both for discussion as well as helping whoever gets to implement it 🙂 Thanks!

Thanks for the extra information. Yes, I agree - the Kubeapps validation of the user values should take into account the default values that are not set, rather than relying on the (Kubeapps UI only) default values all being set in the deploy explicitly.

@antgamdia antgamdia added this to the Form refactor milestone Jun 1, 2022
@ppbaena ppbaena added next-iteration Issues to be discussed in planning session component/ui Issue related to kubeapps UI labels Jun 6, 2022
@ppbaena ppbaena moved this from 🗂 Backlog to 🗒 Todo in Kubeapps Jun 6, 2022
@ppbaena ppbaena added the component/apis-server Issue related to kubeapps api-server label Jun 6, 2022
@ppbaena ppbaena removed the next-iteration Issues to be discussed in planning session label Jun 6, 2022
@ppbaena ppbaena moved this from 🗒 Todo to 🗂 Backlog in Kubeapps Jul 4, 2022
@ppbaena ppbaena moved this from 🗂 Backlog to 🗒 Todo in Kubeapps Jul 15, 2022
@ppbaena ppbaena moved this from 🗒 Todo to 🗂 Backlog in Kubeapps Aug 29, 2022
Repository owner moved this from 🗂 Backlog to ✅ Done in Kubeapps Oct 5, 2022
@dud225
Copy link
Contributor Author

dud225 commented Oct 18, 2022

I've just upgraded to the latest version:

  • App Version: 2.6.0
  • Package Version: 11.0.1

but I'm still experiencing this issue.

@antgamdia
Copy link
Contributor

Mmm, will check during the next iteration. I thought it got solved :S
Thanks for the update!

@antgamdia antgamdia reopened this Oct 18, 2022
Repository owner moved this from ✅ Done to 🗒 Todo in Kubeapps Oct 18, 2022
@antgamdia antgamdia self-assigned this Oct 18, 2022
@ppbaena ppbaena added the next-iteration Issues to be discussed in planning session label Oct 18, 2022
@antgamdia antgamdia moved this from 🗒 Todo to 🏗 In Progress in Kubeapps Oct 18, 2022
@antgamdia
Copy link
Contributor

I've been trying to reproduce the issue, but I haven't been able to in charts whose schemas do not use any required field.

As you mentioned, "If the chart schema enforces the presence of all the values, then Kubeapps complains that the values aren't valid" I assume the problem happens when hitting the backend. As we are just passing a subset of the values, Helm is going to complain about the values being given (as they lack some of the required ones).

I don't see any quick-win solution here, unfortunately. I mean, now we display both the deployed/pkg default values, you could just revert those changes you want back manually, like:

image

Can you think of any other alternative?

Repository owner moved this from 🏗 In Progress to ✅ Done in Kubeapps Oct 20, 2022
@dud225
Copy link
Contributor Author

dud225 commented Oct 24, 2022

On the charts I maintain I'm used to write an exhaustive schema mentioning all the values and, since a default value will always be provided by the chart, to mark them all as required. The benefit of this policy is to prevent the user from setting invalid Helm values, stemming from a typo for example.

We don't have an exclusive Kubeapps-centric usage for deploying a Helm chart as you seem to have in mind, on some cases the deployment may be sparked off Helm CLI and then managed from Kubeapps.
As a concrete example, the CI that we have implemented deploys on-demand a development version of our product remotely through Helm CLI. In this case our main focus is to tweak the Helm value governing the container image tag, as a consequence the rest of the values aren't set since the default values fits. But after the new version has undergo some tests, some problems may be found and the developer may want to perform minor changes to the deployment from Kubeapps as it is much more convenient.

So I think this issue is quite relevant for people having a restricted Helm schema and mixing Kubeapps and third-party mechanisms. I expect Kubeapps to behave similarly than Helm : it should merge the default values set from the chart with the ones provided by the user and not expect the user to always specify the comprehensive Helm values.

@antgamdia antgamdia added the next-iteration Issues to be discussed in planning session label Oct 24, 2022
@ppbaena ppbaena reopened this Oct 24, 2022
Repository owner moved this from ✅ Done to 🗒 Todo in Kubeapps Oct 24, 2022
@absoludity
Copy link
Contributor

In addition to expecting Kubeapps to behave similar to Helm regarding the validation of values passed during install, we may also want to update Kubeapps to behave similar to Helm regarding the values stored in the release on install:

  • As mentioned above, Helm stores just the values provided by the user with the release,
  • Kubeapps, on the other hand, stores the complete values.yaml regardless of whether the user even set one option.

We may instead want to ensure that Kubeapps passes to Helm just the values set by the user, so it behaves in the same way later (ie. helm assumes values have been set explicitly by user if included, which affects changing values on upgrade). In the past we couldn't do this as it would have meant that the user doesn't see all the other knobs in the values on upgrade (as per the screenshot above where the chart was deployed by Helm first), but that's also solveable I think? Anyway, just food for thought.

@ppbaena ppbaena moved this from 🗒 Todo to 🏗 In Progress in Kubeapps Nov 9, 2022
@absoludity absoludity moved this from 🏗 In Progress to 🔎 In Review in Kubeapps Nov 14, 2022
absoludity added a commit that referenced this issue Nov 22, 2022
Signed-off-by: Michael Nelson <minelson@vmware.com>

<!--
Before you open the request please review the following guidelines and
tips to help it be more easily integrated:

 - Describe the scope of your change - i.e. what the change does.
 - Describe any known limitations with your change.
- Please run any tests or examples that can exercise your modified code.

 Thank you for contributing!
 -->

### Description of the change

<!-- Describe the scope of your change - i.e. what the change does. -->

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

<!-- What benefits will be realized by the code change? -->

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

<!-- Describe any known limitations with your change -->

### Applicable issues

<!-- Enter any applicable Issues here (You can reference an issue using
#) -->

- fixes #4803

### Additional information

<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

I've not yet tested this IRL to ensure it fixes the scenario in the
issue, but will do so tomorrow.

Signed-off-by: Michael Nelson <minelson@vmware.com>
Repository owner moved this from 🔎 In Review to ✅ Done in Kubeapps Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/apis-server Issue related to kubeapps api-server component/ui Issue related to kubeapps UI kind/bug An issue that reports a defect in an existing feature
Projects
Archived in project
4 participants