Files
unkinben 784c3b5de1 Add JSON schema generation for kubeconform CRD validation (#212)
## Summary
- New `ci/generate-schemas.sh` script that generates JSON schemas from three sources:
  1. Live cluster CRDs via `kubectl get crds`
  2. Offline CRD manifests (ArgoCD v3.3.2, Gateway API v1.5.1)
  3. Kubernetes v1.33.7 swagger spec for native types
- Schemas follow Datree catalog convention (`<group>/<Kind>_<version>.json`)
- `validate-apps.sh` and `validate-clusters.sh` check local schemas first, falling back to remote
- Fixes TLSRoute (and other CRD) schema validation failures in kubeconform

## Sources
- ArgoCD: `artifactapi.../argoproj/argo-cd/refs/tags/v3.3.2/manifests/ha/install.yaml`
- Gateway API: `artifactapi.../kubernetes-sigs/gateway-api/releases/download/v1.5.1/standard-install.yaml`
- Kubernetes: `artifactapi.../kubernetes/kubernetes/refs/tags/v1.33.7/api/openapi-spec/swagger.json`

Reviewed-on: #212
Co-authored-by: Ben Vincent <ben@unkin.net>
Co-committed-by: Ben Vincent <ben@unkin.net>
2026-06-28 17:26:08 +10:00

747 lines
20 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"apiVersion": {
"type": "string"
},
"kind": {
"type": "string"
},
"metadata": {
"type": "object"
},
"spec": {
"properties": {
"activeDeadlineSeconds": {
"format": "int64",
"type": "integer"
},
"backend": {
"properties": {
"azure": {
"properties": {
"accountKeySecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"accountNameSecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"container": {
"type": "string"
},
"path": {
"type": "string"
}
},
"type": "object"
},
"b2": {
"properties": {
"accountIDSecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"accountKeySecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"bucket": {
"type": "string"
},
"path": {
"type": "string"
}
},
"type": "object"
},
"envFrom": {
"items": {
"properties": {
"configMapRef": {
"properties": {
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"prefix": {
"type": "string"
},
"secretRef": {
"properties": {
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
}
},
"type": "object"
},
"type": "array"
},
"gcs": {
"properties": {
"accessTokenSecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"bucket": {
"type": "string"
},
"projectIDSecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
}
},
"type": "object"
},
"local": {
"properties": {
"mountPath": {
"type": "string"
}
},
"type": "object"
},
"repoPasswordSecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"rest": {
"properties": {
"passwordSecretReg": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"url": {
"type": "string"
},
"userSecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
}
},
"type": "object"
},
"s3": {
"properties": {
"accessKeyIDSecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"bucket": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"secretAccessKeySecretRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
}
},
"type": "object"
},
"swift": {
"properties": {
"container": {
"type": "string"
},
"path": {
"type": "string"
}
},
"type": "object"
},
"tlsOptions": {
"properties": {
"caCert": {
"type": "string"
},
"clientCert": {
"type": "string"
},
"clientKey": {
"type": "string"
}
},
"type": "object"
},
"volumeMounts": {
"items": {
"properties": {
"mountPath": {
"type": "string"
},
"mountPropagation": {
"type": "string"
},
"name": {
"type": "string"
},
"readOnly": {
"type": "boolean"
},
"subPath": {
"type": "string"
},
"subPathExpr": {
"type": "string"
}
},
"required": [
"mountPath",
"name"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"failedJobsHistoryLimit": {
"type": "integer"
},
"keepJobs": {
"type": "integer"
},
"podConfigRef": {
"properties": {
"name": {
"type": "string"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"podSecurityContext": {
"properties": {
"fsGroup": {
"format": "int64",
"type": "integer"
},
"fsGroupChangePolicy": {
"type": "string"
},
"runAsGroup": {
"format": "int64",
"type": "integer"
},
"runAsNonRoot": {
"type": "boolean"
},
"runAsUser": {
"format": "int64",
"type": "integer"
},
"seLinuxOptions": {
"properties": {
"level": {
"type": "string"
},
"role": {
"type": "string"
},
"type": {
"type": "string"
},
"user": {
"type": "string"
}
},
"type": "object"
},
"seccompProfile": {
"properties": {
"localhostProfile": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"supplementalGroups": {
"items": {
"format": "int64",
"type": "integer"
},
"type": "array"
},
"sysctls": {
"items": {
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
],
"type": "object"
},
"type": "array"
},
"windowsOptions": {
"properties": {
"gmsaCredentialSpec": {
"type": "string"
},
"gmsaCredentialSpecName": {
"type": "string"
},
"hostProcess": {
"type": "boolean"
},
"runAsUserName": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"resources": {
"properties": {
"claims": {
"items": {
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-map-keys": [
"name"
],
"x-kubernetes-list-type": "map"
},
"limits": {
"additionalProperties": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
"x-kubernetes-int-or-string": true
},
"type": "object"
},
"requests": {
"additionalProperties": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
"x-kubernetes-int-or-string": true
},
"type": "object"
}
},
"type": "object"
},
"retention": {
"properties": {
"hostnames": {
"items": {
"type": "string"
},
"type": "array"
},
"keepDaily": {
"type": "integer"
},
"keepHourly": {
"type": "integer"
},
"keepLast": {
"type": "integer"
},
"keepMonthly": {
"type": "integer"
},
"keepTags": {
"items": {
"type": "string"
},
"type": "array"
},
"keepWeekly": {
"type": "integer"
},
"keepYearly": {
"type": "integer"
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"successfulJobsHistoryLimit": {
"type": "integer"
},
"volumes": {
"items": {
"properties": {
"configMap": {
"properties": {
"defaultMode": {
"format": "int32",
"type": "integer"
},
"items": {
"items": {
"properties": {
"key": {
"type": "string"
},
"mode": {
"format": "int32",
"type": "integer"
},
"path": {
"type": "string"
}
},
"required": [
"key",
"path"
],
"type": "object"
},
"type": "array"
},
"name": {
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"name": {
"type": "string"
},
"persistentVolumeClaim": {
"properties": {
"claimName": {
"type": "string"
},
"readOnly": {
"type": "boolean"
}
},
"required": [
"claimName"
],
"type": "object"
},
"secret": {
"properties": {
"defaultMode": {
"format": "int32",
"type": "integer"
},
"items": {
"items": {
"properties": {
"key": {
"type": "string"
},
"mode": {
"format": "int32",
"type": "integer"
},
"path": {
"type": "string"
}
},
"required": [
"key",
"path"
],
"type": "object"
},
"type": "array"
},
"optional": {
"type": "boolean"
},
"secretName": {
"type": "string"
}
},
"type": "object"
}
},
"required": [
"name"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"status": {
"properties": {
"conditions": {
"items": {
"properties": {
"lastTransitionTime": {
"format": "date-time",
"type": "string"
},
"message": {
"maxLength": 32768,
"type": "string"
},
"observedGeneration": {
"format": "int64",
"minimum": 0,
"type": "integer"
},
"reason": {
"maxLength": 1024,
"minLength": 1,
"pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
"type": "string"
},
"status": {
"enum": [
"True",
"False",
"Unknown"
],
"type": "string"
},
"type": {
"maxLength": 316,
"pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
"type": "string"
}
},
"required": [
"lastTransitionTime",
"message",
"reason",
"status",
"type"
],
"type": "object"
},
"type": "array"
},
"exclusive": {
"type": "boolean"
},
"finished": {
"type": "boolean"
},
"started": {
"type": "boolean"
}
},
"type": "object"
}
},
"type": "object"
}