+The CRD check works document by document. In every changed manifest, a YAML, JSON or `.tpl` file or anything under `templates/` or `crds/`, outside `tests/` and `testdata/`, every document that names `CustomResourceDefinition` is read as YAML, which takes JSON too, and the CRDs among them are compared between the parent and the merge by `metadata.name`, compact JSON and quoted keys included. The change counts only when one was added, removed or edited, so an edit to the DaemonSet beside a CRD in one manifest does not, and neither does a sentence or a `lookup` call that merely names the kind. Nor does rewording the `description` text of a CRD's schema, at any depth: each named CRD is compared as an object with the `description` of every schema under `spec.versions[].schema.openAPIV3Schema` dropped, which tells that keyword from a field called `description`, a printer column's description or one inside a `default`, and as its text without the `description` entries, each the key's line and every line indented under it, so a comment or any other line outside such an entry still counts. A field added to the schema counts, optional or not, and so does every change other than to description text. In a file Helm renders as a template, anything under `templates/` or a `.tpl`, a CRD that holds a template action, `{{`, is compared by its whole text, since what the action renders is not known. Any other file, one a chart inserts with `.Files.Get` or keeps under `crds/` included, is compared as plain text, so braces in a description that quotes a Go template are text. A chart that passes such a file through `tpl`, as the vertical-pod-autoscaler chart does with its `files/crds/`, renders it all the same, and the check does not detect that; no file in the tree today holds a CRD that both parses and carries an action on a description line that way, and the vertical-pod-autoscaler files do not parse, so they are compared whole. A description the text comparison does not find, in a CRD written as JSON, under a quoted key or in flow style, counts as an edit when it changes. A document that declares `kind: CustomResourceDefinition` on a line of its own but cannot be read as an object, a CRD behind a Helm template guard for one, is compared by its text, so the check fails closed on it, and so does a `List` that holds a CRD.
0 commit comments