apollographql / router

A configurable, high-performance routing runtime for Apollo Federation 🚀
https://www.apollographql.com/docs/router/
Other
810 stars 273 forks source link

Provide Helm chart JSON schema #5547

Open smyrick opened 4 months ago

smyrick commented 4 months ago

Is your feature request related to a problem? Please describe.

The router.yaml has a JSON config schema that can be generated from the Router binary but the helm charts provided by the router team do not have a JSON validation schema

https://www.apollographql.com/docs/router/containerization/kubernetes/#about-the-router-helm-chart

Describe the solution you'd like

Provide the mapping JSON schema for the helm charts

Describe alternatives you've considered

I could use helm validators on my PR jobs to make sure everything works but it would be nice to do this in my IDE or use the JSON schema in my PR to do the validation steps

cyberhck commented 2 months ago

Additionally, it'd be nice to have the entire thing available, not just helm, but including router schema, here's how I'm doing currently:

update-apollo-schema:
    router config schema > /tmp/routercfgschema.json && jq '.definitions = $$input[0].definitions | .properties.router.properties.configuration.properties = $$input[0].properties' ./.schemas/apollo-router.json --slurpfile input /tmp/routercfgschema.json > /tmp/router_new_config.json && mv /tmp/router_new_config.json .schemas/apollo-router.json

If we could find a way to automatically generate helm schema, then we can combine the both and make it available. There are tools that look at your charts and generate schema, but they can't infer a lot, we could update the chart and add some annotations to help with it as well. Thoughts?

Questions

cyberhck commented 2 months ago

I'm willing to annotate the values file for all the fields except the router configuration, since a chart could in theory deploy different version of router, I think the router configuration should be left alone without any schema.