helm-schema

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 with warning: for a problem or info: for a note.
  • json: one JSON object per line, with its variant in a type field.

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.0

With --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:

VariantWhen
MissingSchemaNo source has the resource’s schema. Lists the Kubernetes versions and file names tried, and cached versions that have it.
ResolvedFromFallbackVersionA version other than the primary had the schema, through fallback.
InferredApiVersionAn apiVersion was inferred for a resource whose template does not state it (needs --api-version-guess).
AmbiguousApiVersionSeveral apiVersions are possible, so none is used.
CrdVersionNotFoundThe CRD at the chart’s exact version was found nowhere.
CrdVersionAvailableAtOtherVersionsThe CRD is cached at other versions (--crd-version-lookup loose). For information; another version is never used.
LocalOverrideUnreadableA file in --crd-override-dir exists but cannot be read. The lookup stops there.

The cache:

VariantWhen
CacheLayoutInvalidatedA cache was written in an older layout; it was cleared and fills again.
CacheLayoutForwardIncompatibleA cache was written by a newer helm-schema, which this one leaves untouched.
CacheWriteSkippedA schema was not cached because its file name would not work on every platform; it was still used.

The schema:

VariantWhen
InputChannelNumericRangeAmbiguityA template ranges over a number, which works from --set but not from a values file; the schema cannot tell them apart.
DiscoveredConfigWeakensEmissionhelm-schema.yaml turns checks off; see Configuration.
SchemaCompactedForHelmThe readable schema was over Helm’s 5 MiB limit, so it was written as compact JSON with short names.
SchemaExceedsHelmFileLimitThe 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:

  • MissingSchema or CrdVersionNotFound: add a CRD catalog mirror, fill the cache online, or put the schema in --crd-override-dir.
  • AmbiguousApiVersion: state the apiVersion in 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: upgrade helm-schema, or point it at another cache directory; see Caching.
  • InputChannelNumericRangeAmbiguity: also run CI values files through helm 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.jsonl

Fail the build on the variants that matter to you by their type; Continuous integration has an example.

Esc

Type # for headings only ↑↓ move ↵ open Ctrl ↵ new tab Ctrl U/D scroll preview

Keyboard shortcuts

/ ⌘ K Ctrl K
Search
← →
Previous or next page
?
Show these shortcuts