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

feat(helm): Add schema of values in Helm Chart #18161

Merged
merged 4 commits into from
Jan 25, 2022

Conversation

ad-m
Copy link
Contributor

@ad-m ad-m commented Jan 25, 2022

SUMMARY

I added schema validation for values.yaml as designed in #18127. My goal was to add a basic schema and then gradually expand it. I attempt to use remote schemas wherever possible.

I can see that overwhelmingly required fields may appear now. Removing these requirements requires very careful verification in multiple parameters that the Helm Chart is prepared to render without the parameter, which I intend to do when we work on the rendering tests.

I see that the provided schema can document more (more field descriptions, examples etc.), but I leave it for the next PR to do small steps together.

I think it's better to agree on the structure and notation of the schema and then relax & extend when working with Helm Chart is less fragile (more tests added).

I am aware that installation on air-gapped environments (due to the need to download remote schematics) will be blocked. However, I would also leave that for the next PR to make this PR easier to review.

If I had the permission to create a new branch in the apache/superset repository, I would create this PR against the feature branch, because the primary goal is to get insights on the approach, and the space for development is significant. However, I believe that this code already provides some value and is functional.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

You might change values.yaml and execute helm lint to make sure that linting errors are raised.

For the purpose, I keep in that PR two commits to ensure that CI detect mismatch values.yaml to values.schema.json thanks to .github/workflows/superset-helm-lint.yml. If it turns out otherwise - I will update that PR.

ADDITIONAL INFORMATION

  • Has associated issue: see Testing strategy of Helm Chart #18127
  • Required feature flags: NO
  • Changes UI: NO
  • Includes DB Migration (follow approval process in SIP-59): NO
    • Migration is atomic, supports rollback & is backwards-compatible: N/A
    • Confirm DB migration upgrade and downgrade tested: N/A
    • Runtime estimates and downtime expectations provided: N/A
  • Introduces new feature or API: NO
  • Removes existing feature or API: NO

@wiktor2200 @mvoitko might be interested in that area as involved in development of our Helm Chart.
@mik-laj @potiuk @kaxil may want to share their thoughts based on their involvement in the discussion in #18127.

@ad-m
Copy link
Contributor Author

ad-m commented Jan 25, 2022

@craig-rueda could you take a look as maintainer of Chart?

maintainers:
- name: craig-rueda
email: craig@craigrueda.com
url: https://github.com/craig-rueda

@craig-rueda
Copy link
Member

Thanks for the submission! Can you add a helm lint call in CI as well? Also, I see a few things that were changed in the values.yaml which I think might cause some issues with existing template behavior.

helm/superset/values.yaml Outdated Show resolved Hide resolved
@ad-m
Copy link
Contributor Author

ad-m commented Jan 25, 2022

Thanks for the submission! Can you add a helm lint call in CI as well? Also, I see a few things that were changed in the values.yaml which I think might cause some issues with existing template behavior.

We have already one:

- name: Run chart-testing (lint)
run: ct lint --print-config
env:
CT_CHART_DIRS: helm
CT_LINT_CONF: lintconf.yaml

I confirmed that ct lint values.yaml agains values.schema.json too:

$ CT_CHART_DIRS="helm" ct lint  --print-config
Linting charts...
------------------------------------------------------------------------------------------------------------------------
 Configuration
------------------------------------------------------------------------------------------------------------------------
Remote: origin
TargetBranch: master
Since: HEAD
BuildId: 
LintConf: lintconf.yaml
ChartYamlSchema: /home/adas/.ct/chart_schema.yaml
ValidateMaintainers: true
ValidateChartSchema: true
ValidateYaml: true
AdditionalCommands: []
CheckVersionIncrement: true
ProcessAllCharts: false
Charts: []
ChartRepos: []
ChartDirs: [helm]
ExcludedCharts: []
HelmExtraArgs: 
HelmRepoExtraArgs: []
Debug: false
Upgrade: false
SkipMissingValues: false
Namespace: 
ReleaseLabel: 
ExcludeDeprecated: false
------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------
 Charts to be processed:
------------------------------------------------------------------------------------------------------------------------
 superset => (version: "0.5.5", path: "helm/superset")
------------------------------------------------------------------------------------------------------------------------

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 2 charts
Downloading postgresql from repo https://charts.bitnami.com/bitnami
Downloading redis from repo https://charts.bitnami.com/bitnami
Deleting outdated charts
Linting chart 'superset => (version: "0.5.5", path: "helm/superset")'
Checking chart 'superset => (version: "0.5.5", path: "helm/superset")' for a version bump...
Old chart version: 0.5.4
New chart version: 0.5.5
Chart version ok.
Validating /home/adas/Devel/superset/helm/superset/Chart.yaml...
Validation success! 👍
Validating maintainers...
==> Linting helm/superset
[INFO] Chart.yaml: icon is recommended
[ERROR] values.yaml: - supersetWorker.forceReload: Invalid type. Expected: boolean, given: array

[ERROR] templates/: values don't meet the specifications of the schema(s) in the following chart(s):
superset:
- supersetWorker.forceReload: Invalid type. Expected: boolean, given: array


Error: 1 chart(s) linted, 1 chart(s) failed
------------------------------------------------------------------------------------------------------------------------
 ✖︎ superset => (version: "0.5.5", path: "helm/superset") > Error waiting for process: exit status 1
------------------------------------------------------------------------------------------------------------------------
Error: Error linting charts: Error processing charts
Error linting charts: Error processing charts

I confirmed also that it successfully running on CI, so I wrote in the original pull request description:

For the purpose, I keep in that PR two commits to ensure that CI detect mismatch values.yaml to values.schema.json thanks to .github/workflows/superset-helm-lint.yml. If it turns out otherwise - I will update that PR.

@ad-m ad-m requested a review from craig-rueda January 25, 2022 22:26
@craig-rueda craig-rueda merged commit 6200977 into apache:master Jan 25, 2022
shcoderAlex pushed a commit to casual-precision/superset that referenced this pull request Feb 7, 2022
* Add schema of values in Helm Chart

* chore(helm): bump our Chart version

* Fix schema values in Helm Chart

* fix(helm): fix relax required parameters for postgres & redis password, apply review comments
ofekisr pushed a commit to nielsen-oss/superset that referenced this pull request Feb 8, 2022
* Add schema of values in Helm Chart

* chore(helm): bump our Chart version

* Fix schema values in Helm Chart

* fix(helm): fix relax required parameters for postgres & redis password, apply review comments
bwang221 pushed a commit to casual-precision/superset that referenced this pull request Feb 10, 2022
* Add schema of values in Helm Chart

* chore(helm): bump our Chart version

* Fix schema values in Helm Chart

* fix(helm): fix relax required parameters for postgres & redis password, apply review comments
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants