What are values "contracts" and why should you avoid exposing raw Kubernetes structures everywhere?
AdvancedConceptValues & Precedence
Answer
values.yaml is the chart's API. Passing raw blocks (resources, affinity, securityContext) through with toYaml is fine because they are well-known Kubernetes types. But if every field is a raw passthrough, the chart offers no guardrails and every consumer duplicates boilerplate.
Good charts offer opinionated, validated fields for the common path (api.port, api.replicas, ingress.host), raw passthrough for escape hatches (extraEnv, extraVolumes, podSpecOverrides), and a schema covering both.
More on Values & Precedence
What is the precedence order of values in Helm?BeginnerHow are lists merged across values files?IntermediateWhat is the difference between `--set` and `--set-string`?BeginnerHow do you set nested keys, list items and keys containing dots with `--set`?IntermediateWhat are `--set-file`, `--set-json` and `--set-literal` for?IntermediateHow do you remove a default value set in a chart's `values.yaml`?Intermediate