hashicorp / consul-k8s

First-class support for Consul Service Mesh on Kubernetes
https://www.consul.io/docs/k8s
Mozilla Public License 2.0
669 stars 322 forks source link

Linting of values.yaml #633

Open brucec5 opened 3 years ago

brucec5 commented 3 years ago

Community Note


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

It would be nice if there was a tool for linting consul-helm values.yaml files for semantic correctness.

Notably, there's a number of fields that let you specify raw Consul configuration (eg. server.extraConfig). If there's a typo or type conversion issue, we won't know until we actually deploy the helm chart and servers restart. If there was a linter for this (and other fields), we'd be able to verify it as part of CI.

Feature Description

It would be useful to be able to point to a list of values.yaml files and have a linter validate that all of the values make semantic sense, especially for options that represent raw consul JSON configuration.

Use Case(s)

This should apply to any Consul K8s use case.

Contributions

david-yu commented 3 years ago

Hi @brucec5 thanks for the feedback. I assume you probably would want to have a Helm plug-in (https://helm.sh/docs/topics/plugins/) that could be invoked by the Helm CLI to do linting for Consul Config and do something similar to consul validate (see https://www.consul.io/commands/validate)?

brucec5 commented 3 years ago

Yeah, that sounds like a good way to approach this.

lkysow commented 3 years ago

There's also support in Helm for JSON schema. Although I don't know if it can recursively validate that strings are valid JSON.