-
Notifications
You must be signed in to change notification settings - Fork 96
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
redpanda: generate values.schema.json from go structs #1090
Conversation
Here is the output of the
|
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.
A lot to review, two questions, but not blocking.
chart:redpanda:generate: | ||
cmds: | ||
- go run ./cmd/genpartial/main.go -out charts/redpanda/values_partial.gen.go -struct Values ./charts/redpanda | ||
- go run ./cmd/genvalues/main.go > charts/redpanda/values.schema.json |
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.
going the reverse of what we had, interesting.
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.
How do you mean? Were we generating something from the json schema previously?
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.
exactly. I took an existing tool to take schemas from us and create apis.
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.
What was the output of that and was it ever automated anywhere? The values.schema.json
file as it currently exists is missing a good chunk of fields and it's fairly malformed as well.
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.
No, we never got around to make it automated, ill send you the link so you can see the repo.
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.
453f90a
to
dc6fdf7
Compare
da5c06b
to
5a48c5c
Compare
5a48c5c
to
3ec7ade
Compare
Looks like this is going to be blocked until #1100 get's merged :/ |
3ec7ade
to
ec31bc2
Compare
This commit introduces a set of go structs that are now used to generate the values.schema.json files for the redpanda chart. This is being done to: - Ensure that values.schema.json is always up to date. - Allow correct and ergonomic go code to be written in place of helm templates. - Provide a more tenable way of defining, updating, and shaping the input values of the redpanda chart. Efforts were taken to minimize the diff between the original and now generated jsonschema but there is still a non-trivial diff due to many invalid entries within the original jsonschema. Future commits will slowly remove the hacks and shims once the initial generation hurdle has been cleared. Rather than reviewing a standard diff. It is recommended to instead view the diff output by: `dyff between -i --exclude-regexp '.*annotations|.*labels' (git show origin/main:charts/redpanda/values.schema.json | psub) ./charts/redpanda/values.schema.json` - `dyff` will simplify the overall diff. - `-i` ignores any change in the ordering of keys or elements within an array as neither are relevant in the context of a jsonschema. - `--exclude-regexp '.*annotations|.*labels'` many label and annotation fields did not have typed keys. As the Kubernetes API server would validate that all values are strings, this is now enforced at the schema level. For reviewers thereof, here is an explanation of the larger diffs: `properties.storage.properties.tiered.properties.credentialsSecretRef` was missing a `properties` key in the handwritten schema. `properties.statefulset.properties.sideCars.properties.configWatcher.controllers` was incorrectly nested within `configWatcher` _and_ missing a `properties` key. It's now been hoisted to the correct location within sideCars and formatted correctly. `properties.logging` used the key `parameters` instead of `properties`.
ec31bc2
to
5ade7b2
Compare
Based on PR #1089
This commit introduces a set of go structs that are now used to generate
the values.schema.json files for the redpanda chart.
This is being done to:
templates.
input values of the redpanda chart.
Efforts were taken to minimize the diff between the original and now
generated jsonschema but there is still a non-trivial diff due to many
invalid entries within the original jsonschema.
Future commits will slowly remove the hacks and shims once the initial
generation hurdle has been cleared.
Rather than reviewing a standard diff. It is recommended to instead view
the diff output by:
dyff between -i --exclude-regexp '.*annotations|.*labels' (git show origin/main:charts/redpanda/values.schema.json | psub) ./charts/redpanda/values.schema.json
dyff
will simplify the overall diff.-i
ignores any change in the ordering of keys or elements within anarray as neither are relevant in the context of a jsonschema.
--exclude-regexp '.*annotations|.*labels'
many label and annotationfields did not have typed keys. As the Kubernetes API server would
validate that all values are strings, this is now enforced at the
schema level.
For reviewers thereof, here is an explanation of the larger diffs:
properties.storage.properties.tiered.properties.credentialsSecretRef
was missing a
properties
key in the handwritten schema.properties.statefulset.properties.sideCars.properties.configWatcher.controllers
was incorrectly nested within
configWatcher
and missing aproperties
key. It's now been hoisted to the correct location withinsideCars and formatted correctly.
properties.logging
used the keyparameters
instead ofproperties
.