CRD schemas
On this page
Charts that deploy custom resources, such as a ServiceMonitor or a Certificate, need schemas
that are not part of Kubernetes. helm-schema reads them from a CRD catalog,
datreeio/CRDs-catalog, fetched when first needed and
cached on disk.
For a resource with an API group, the lookup goes, in order, to:
- your local overrides in
--crd-override-dir, which always win; - the CRD catalog;
- the Kubernetes schemas, for built-in kinds.
Strict and loose version lookup#
helm-schema ./mychart --crd-version-lookup loosestrict, the default: only the exact group, kind and version the chart uses are read. Another version is never used in its place: the schema ofv1alpha1is not the schema ofv1.loose: resolves the same way, and also looks through the local cache for other versions of the same group and kind. When the requested version is missing but others are cached, it reportsCrdVersionAvailableAtOtherVersions, for information only.
--strict-crd-version is a short form of --crd-version-lookup strict.
Mirrors and caching#
--crd-catalog-mirror adds another source of CRD schemas. It repeats, and works in both lookup
modes:
helm-schema ./mychart --crd-catalog-mirror https://schemas.example.com/crdsEach mirror is cached in its own directory, so its files never take the place of the default catalog’s. Two more flags control the cache:
--crd-catalog-cache-dir: the cache directory for CRD schemas, separate from the Kubernetes one; see Caching.--crd-cache-record-source: writes a<schema>.json.metafile beside each cached schema with the address it came from and when, to find out which mirror answered.
Local overrides#
--crd-override-dir is a directory of schemas you keep yourself, read before the catalog and the
Kubernetes schemas:
helm-schema ./mychart --crd-override-dir ./schema-overridesEach file is <group>/<kind>_<version>.json, such as
monitoring.coreos.com/servicemonitor_v1.json. Despite the crd- in its name, the directory takes
a schema for any resource with a group: a CRD you patched, or a built-in resource whose schema you
want to replace, to add constraints, keep an older schema, or work around an upstream bug.
- It is never cleared. Unlike the caches, it is your content, so point it only at a directory you control.
- An unreadable file stops the lookup. When an override exists but cannot be read,
helm-schemareportsLocalOverrideUnreadableand does not fall back to the catalog, since that would put a different schema in place of the one you chose.
Note
--crd-catalog-dir was removed. Use --crd-override-dir for schemas you keep, and
--crd-catalog-cache-dir for the cache. The old flag fails with a message that names both.