Expand description
R21 — CRD (CustomResourceDefinition) serving.
Lets operators register new typed kinds at runtime without recompiling. A CRD declares:
spec.groupspec.versions[]— each{name, served, storage, schema.openAPIV3Schema}spec.scope(Namespaced|Cluster)spec.names—{plural, singular, kind, listKind, shortNames[]}
§How it gets served (REUSE, not fork)
A CRD object is stored opaquely via the SAME StoreBackedHandler as any
other kind (the apiextensions.k8s.io/v1.CustomResourceDefinition
catalog row builds it automatically). The CrdController then reacts
to CRD writes by registering a StoreBackedHandler PER SERVED VERSION
into the apiserver’s live RouterState (via the DynamicHandlerSink
trait the apiserver implements) — so every CR instance verb (CRUD / list
/ watch) flows through the existing catch-all + do_* bodies, and the
group + resource auto-appear in discovery (both fold the same live
handler snapshot). There is NO parallel CR codepath.
§Reconcile rule (CrdController)
For each CustomResourceDefinition in the store:
- Parse
specthrough the typedCrdSpecserde border. - For EACH served version,
sink.register_crd(...)under(group, version, plural)+ scope + names + shortNames. - Patch CRD
statustoEstablished=True/NamesAccepted=True.
Removal of a CRD object → sink.unregister_crd(...) for every version
the controller had registered (precise GC via the private
CrdEntry-keyed bookkeeping set). Orphaned CR objects remain in the
store unreachable (no cascade-delete — finalizers are a future brick).
Structs§
- CrdController
- Controller that syncs
apiextensions.k8s.io/v1.CustomResourceDefinitionobjects from the store into the apiserver’s live handler table via aDynamicHandlerSink. Driven by aWatchDriverfiltered to["CustomResourceDefinition"]. - CrdEntry
- One registered CRD-version handler descriptor — the controller’s PRIVATE
bookkeeping of “what I registered” (keyed by
(group, version, plural)) so unregister-on-delete is precise. This REPLACES the oldCrdRegistryrouting surface; routing now lives in the apiserver’sRouterStatevia theDynamicHandlerSink. - CrdHandler
Spec - The typed argument bundle for
DynamicHandlerSink::register_crd— one served CRD version’s full handler shape, carried as ownedStrings (the controller derives them from the typedCrdSpec). - CrdNames
spec.names— how kubectl names the custom resource.- CrdSpec
- The typed
specof aCustomResourceDefinition— the parse border the controller drives. Unknown fields tolerated (nodeny_unknown_fields). - CrdSubresources
spec.versions[].subresources— which subresources a CRD version serves.- CrdVersion
- One entry in
spec.versions[].
Enums§
Traits§
- Dynamic
Handler Sink - Typed sink the apiserver implements so the controller (which must NOT
depend on engenho-apiserver — that would be a dependency cycle, since
apiserver already depends on controllers for admission) can mutate the
live
RouterStatehandler table.
Functions§
- serve_
stored_ crds - Register every served version of every CRD in
storeintosink, and return how many were registered.