-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Auto generate README.md, Chart.yaml, values.schema.json and values.yaml using tem & helm-jsonschema-gen #4209
Conversation
Hi @inteon. Thanks for your PR. I'm waiting for a jetstack or cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
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 @inteon
tem
seems really cool. Useful to be able to apply Helm style templating generally, plus the added parsing of comments.
I haven't reviewed the code though.
I've got some general questions about this approach:
- If we agree that we can improve the installation experience by creating a Helm JSON schema, which will help prevent users from setting invalid values. Then the json schema file seems like the natural place to add value descriptions (rather than in comments in the Yaml). And json schema supports
examples
anddefaults
annotations too which would make those things much easier to extract and avoid parsing the comment strings. https://json-schema.org/understanding-json-schema/reference/generic.html#annotations - And I had a vague idea that the JSON schema file might serve as the basis for generating command line flags that reflect the available values, e.g.
kubectl cert-manager install --cainjector.enabled=false --controller.resources.requests.memory=200Mi
. - Or it could be used to generate an overview of the available values in
kubectl cert-manager install --help
. - The generated README file in this branch creates a table which scrolls horizontally, way beyond the page margin, which makes it very difficult to read: https://github.com/jetstack/cert-manager/blob/2026972af9a74d62dd0adcce99b9c90e0cf43534/deploy/charts/cert-manager/README.md#configurationThe original table has wrapped cell content: https://github.com/jetstack/cert-manager/blob/master/deploy/charts/cert-manager/README.template.md#configuration
- I dislike the complicated template logic in
README.template.md
which is used to create the table of values. I find it difficult to interpret. Isn't there a markdown generator which can take a slice of structs and turn it into a table? - If
tem
is used, can it not be downloaded as a binary rather than adding its Go dependencies to those of cert-manager, which are already too sprawling.
Please pick holes these arguments if you disagree.
408b988
to
e9ed842
Compare
|
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 for downloading the binaries and making the darwin binaries available.
I'm still in favour of using the jsonschema
as the source of all this information...I think it could even be used to generate the values.yaml
file.
ArtifactHub does a pretty nice job of presenting the schema: https://artifacthub.io/packages/helm/bitnami/redis?modal=values-schema
Which makes me think we could even drop the table of values from the README.
Let's discuss it tomorrow.
I'm just going to leave this here: https://github.com/coveooss/json-schema-for-humans/blob/master/docs/examples/examples_md_default/Configuration.md |
67c55bf
to
964a255
Compare
blocked on #4556 |
e887d08
to
eb492cd
Compare
f6fa3fc
to
3100f34
Compare
blocked on improvements to the dependencies. (I'm working on |
Issues go stale after 90d of inactivity. |
Issues go stale after 90d of inactivity. |
/remove-lifecycle stale |
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
3100f34
to
d00da3c
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: inteon, wallrj The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@inteon: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
will pick this up later in another PR |
What this PR does / why we need it:
Alternative implementation for solving #4199.
It uses a tool called
tem
, that I created.tem
combines the functionality of kubepack.dev/chart-doc-gen and github.com/gomatic/renderizer/v2.It also allows us to create custom table layouts.
tem
does not ONLY work for Helm, it can be used for any situation where templating using YAML as input is useful.UPDATE: as requested by @wallrj, now the
values.schema.json
file is also auto-generated.This is done using another custom tool https://github.com/amurant/helm-jsonschema-gen, that uses go code and
translates it to a JSON schema definition.
Which issue this PR fixes
fixes #4010
fixes #2891
Release note: