iver-wharf / wharf-helm

Deploy Wharf to Kubernetes using Helm
MIT License
0 stars 0 forks source link

values.yaml JSON schema #9

Open applejag opened 3 years ago

applejag commented 3 years ago

Based on conversation from https://github.com/iver-wharf/wharf-helm/pull/6#issuecomment-849538631

Helm v3 has support for JSON schemas for its values.yaml. If we add this, we both get extra bit of validation, and for those who use a text editor with the YAML language server from Red Hat then they also get intellisense when editing.

Sometimes, a chart maintainer might want to define a structure on their values. This can be done by defining a schema in the values.schema.json file. /.../

This schema will be applied to the values to validate it. Validation occurs when any of the following commands are invoked:

  • helm install
  • helm upgrade
  • helm lint
  • helm template

https://helm.sh/docs/topics/charts/#schema-files

So in our values.yaml we have the following:

$schema: https://raw.githubusercontent.com/iver-wharf/wharf-helm/wharf-helm-v1.0.0/charts/wharf-helm/values.schema.json

nameOverride: ""
fullnameOverride: ""

global:
  url: wharf.example.org
  ## Used in RabbitMQ & Jenkins to multiplex jobs and messages on the same
  ## instances while keeping track of their origin.
  instanceId: dev
  ## This flag is forwarded to the frontend where it can be used to show
  ## slightly different styling depending on if it's for production or not.
  isProduction: false

web:
  ## Defaults to 1
  replicaCount: 1
# ...and the rest of the YAML file

We might want to autogenerate it though, preferrably by using the same info that helm-docs take use of, as this would otherwise require us to maintain two separate files.

applejag commented 3 years ago

Or maybe have the values.yaml generated from the schema... That way we can be smarter with the types, such as for the .Values.provders.X...