Diagnostics
On this page
Whatever helm-schema cannot resolve, it reports as a diagnostic on standard error instead of
guessing. The schema goes to standard output or the --output file, so diagnostics never end up in
it.
Format#
--diag-format picks one of two forms:
text, the default: one line per diagnostic, starting withwarning:for a problem orinfo:for a note.json: one JSON object per line, with its variant in atypefield.
A run offline with an empty cache:
$ helm-schema ./mychart --offline --k8s-schema-cache-dir ./empty \
-o values.schema.json
warning: no upstream Kubernetes JSON schema found for Deployment (apps/v1) in v1.35.0
warning: no upstream Kubernetes JSON schema found for Service (v1) in v1.35.0With --diag-format json, the first of them is this line, shown here with its fields spread out:
{
"type": "MissingSchema",
"kind": "Deployment",
"api_version": "apps/v1",
"k8s_versions_tried": ["v1.35.0"],
"tried_filenames": ["deployment-apps-v1.json"],
"available_in_cache_versions": [],
"suggested_k8s_version": null,
"hint": null
}Once the command line is parsed, every line on standard error is such an object. A command line that cannot be parsed prints a plain usage error and exits with a non-zero status before any JSON line.
Variants#
Lookups of Kubernetes and CRD schemas:
| Variant | When |
|---|---|
MissingSchema | No source has the resource’s schema. Lists the Kubernetes versions and file names tried, and cached versions that have it. |
ResolvedFromFallbackVersion | A version other than the primary had the schema, through fallback. |
InferredApiVersion | An apiVersion was inferred for a resource whose template does not state it (needs --api-version-guess). |
AmbiguousApiVersion | Several apiVersions are possible, so none is used. |
CrdVersionNotFound | The CRD at the chart’s exact version was found nowhere. |
CrdVersionAvailableAtOtherVersions | The CRD is cached at other versions (--crd-version-lookup loose). For information; another version is never used. |
LocalOverrideUnreadable | A file in --crd-override-dir exists but cannot be read. The lookup stops there. |
The cache:
| Variant | When |
|---|---|
CacheLayoutInvalidated | A cache was written in an older layout; it was cleared and fills again. |
CacheLayoutForwardIncompatible | A cache was written by a newer helm-schema, which this one leaves untouched. |
CacheWriteSkipped | A schema was not cached because its file name would not work on every platform; it was still used. |
The schema:
| Variant | When |
|---|---|
InputChannelNumericRangeAmbiguity | A template ranges over a number, which works from --set but not from a values file; the schema cannot tell them apart. |
DiscoveredConfigWeakensEmission | helm-schema.yaml turns checks off; see Configuration. |
SchemaCompactedForHelm | The readable schema was over Helm’s 5 MiB limit, so it was written as compact JSON with short names. |
SchemaExceedsHelmFileLimit | The written schema is over Helm’s 5 MiB limit, and Helm will refuse the chart. See Output. |
What to do#
Most diagnostics are about typing, not about a fault in the chart: a MissingSchema for a rare CRD
only leaves its fields loosely typed. By variant:
MissingSchemaorCrdVersionNotFound: add a CRD catalog mirror, fill the cache online, or put the schema in--crd-override-dir.AmbiguousApiVersion: state theapiVersionin the template if you can; otherwise the resource stays untyped, rather than typed wrongly.ResolvedFromFallbackVersion: expected for a chart that uses a removed API.CacheLayoutForwardIncompatible: upgradehelm-schema, or point it at another cache directory; see Caching.InputChannelNumericRangeAmbiguity: also run CI values files throughhelm template -f; see Troubleshooting.
In CI#
With diagnostics on standard error and the schema in a file, both can be kept:
helm-schema ./mychart --diag-format json \
--output values.schema.json \
2> diagnostics.jsonlFail the build on the variants that matter to you by their type; Continuous
integration has an example.