feat(ci): add CRD schema generation for kubeconform validation

Add scripts to extract OpenAPI v3 schemas from CRD definitions in all
kustomize overlays and write JSON schema files to ci/crd-schemas/ for
kubeconform validation. This allows kubeconform to validate CRD instances
(Elasticsearch, Kibana, CNPG Cluster, VictoriaMetrics, etc.) instead of
skipping or erroring on them.

- ci/generate-crd-schemas.py: extracts schemas from CRD YAML on stdin
- ci/generate-crd-schemas.sh: iterates overlays, pipes to Python script
- ci/validate-apps.sh, ci/validate-clusters.sh: add local schema-location fallback
- Makefile: add generate-schemas target
- ci/crd-schemas/: 67 generated schemas (cert-manager, cnpg, elastic, victoriametrics, argocd, gateway)
- .pre-commit-config.yaml: raise large-file limit to 2 MB for generated schemas

Run `make generate-schemas` to regenerate after CRD version changes.
This commit is contained in:
2026-05-30 23:09:34 +10:00
parent 1b781e0885
commit d21d9a92d3
73 changed files with 87982 additions and 1 deletions
@@ -0,0 +1,46 @@
{
"$schema": "http://json-schema.org/schema#",
"description": "FailoverQuorum contains the information about the current failover\nquorum status of a PG cluster. It is updated by the instance manager\nof the primary node and reset to zero by the operator to trigger\nan update.",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"type": "object"
},
"status": {
"description": "Most recently observed status of the failover quorum.",
"properties": {
"method": {
"description": "Contains the latest reported Method value.",
"type": "string"
},
"primary": {
"description": "Primary is the name of the primary instance that updated\nthis object the latest time.",
"type": "string"
},
"standbyNames": {
"description": "StandbyNames is the list of potentially synchronous\ninstance names.",
"items": {
"type": "string"
},
"type": "array"
},
"standbyNumber": {
"description": "StandbyNumber is the number of synchronous standbys that transactions\nneed to wait for replies from.",
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"metadata"
],
"type": "object"
}