Expand description
CRD validation webhook — typed-shape validation of CR writes.
Performs typed-shape validation on every Put / Patch:
- The kind must be registered (or be in the core “always-allowed” set: Pod / Service / Endpoints / etc.)
- Scope match — Namespaced kinds must have a namespace; Cluster-scoped kinds must NOT.
- Required fields exist (shallow check via the entry’s
schema.required, when present).
§Status: DEFERRED + UNWIRED
This webhook is NOT wired into the runtime admission chain today —
structural-schema validation of CR instances is a DEFERRED surface (per
the CRD-serving scope boundary: CR creates are accepted as opaque JSON
via kubectl apply --validate=false; we never CLAIM validation, so
there is no false-accept of a malformed object). Full JSON Schema Draft 7
validation requires a schema-compiler crate; future R22b lands it as an
optional cargo feature so the substrate stays light.
It carries its own read-only ValidationRegistry snapshot rather than
re-introducing a parallel routing surface — routing now lives ONLY in the
apiserver’s RouterState (driven by CrdController via
crate::DynamicHandlerSink). When validation is wired, the source of
the registered-kinds snapshot will be the controller’s bookkeeping (or a
read view of the router table), NOT a second authoritative registry.
Structs§
- CrdValidation
Webhook - Webhook that gates writes on kind registration + scope match.
- Validation
Registry - Read-only snapshot of registered CRD entries the validation webhook
consults. Keyed by the canonical
{group}/{version}/{kind}string.
Functions§
- crd_
validation_ webhook - Convenience constructor.