Deploy k8s-schemas web page with OpenAPI JSON docs for kubeconform #97
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Deploy a web page inside the Kubernetes cluster that serves all available Kubernetes CRD schemas as OpenAPI JSON, so that
kubeconformcan reference them for validation of custom resources.Background
Currently,
kubeconformonly knows about built-in Kubernetes resource schemas. To validate CRDs from Helm charts, operators, and controllers installed in the cluster, we need to extract and serve their OpenAPI/JSON schemas dynamically.Approach
Based on proven patterns from other homelabs:
CRD Extraction — Use the k8s-crd-extractor container image (
ghcr.io/bjw-s-labs/k8s-crd-extractor) which:kubectl get crds)openAPIV3Schemato JSON via the datreeio/openapi2jsonschema.py script~/.datree/crdSchemas/Serving the schemas — Use a lightweight HTTP server (e.g. wrangler deploy or similar static file server) to serve the generated schemas directory as a web-accessible endpoint.
Schema location — Serve at a path like
/schemas/that can be referenced by kubeconform's-schema-locationflag, e.g.:Reference Implementations
Proposed Implementation
A Flux HelmRelease (or similar GitOps-deployed workload) that:
k8s-crd-extractoras a periodic CronJob (e.g. hourly) to regenerate schemasghcr.io/bjw-s-labs/wrangler deploy --assets)schemas.<domain>)get/list/watchoncustomresourcedefinitionsandapiservicesAcceptance Criteria
-schema-locationhttps://sholdee.github.io/crd-schema-publisher/ seems like a great implementation of what I was hoping for as a single project rather than a bunch of scripts hacked together