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

1240 lines
42 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"apiVersion": {
"type": "string"
},
"kind": {
"type": "string"
},
"metadata": {
"type": "object"
},
"spec": {
"properties": {
"agentAffinity": {
"nullable": true,
"properties": {
"nodeAffinity": {
"properties": {
"preferredDuringSchedulingIgnoredDuringExecution": {
"items": {
"properties": {
"preference": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchFields": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"weight": {
"format": "int32",
"type": "integer"
}
},
"required": [
"preference",
"weight"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"requiredDuringSchedulingIgnoredDuringExecution": {
"properties": {
"nodeSelectorTerms": {
"items": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchFields": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"nodeSelectorTerms"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
}
},
"type": "object"
},
"podAffinity": {
"properties": {
"preferredDuringSchedulingIgnoredDuringExecution": {
"items": {
"properties": {
"podAffinityTerm": {
"properties": {
"labelSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"matchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"mismatchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"namespaceSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"namespaces": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"topologyKey": {
"type": "string"
}
},
"required": [
"topologyKey"
],
"type": "object"
},
"weight": {
"format": "int32",
"type": "integer"
}
},
"required": [
"podAffinityTerm",
"weight"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"requiredDuringSchedulingIgnoredDuringExecution": {
"items": {
"properties": {
"labelSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"matchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"mismatchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"namespaceSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"namespaces": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"topologyKey": {
"type": "string"
}
},
"required": [
"topologyKey"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"type": "object"
},
"podAntiAffinity": {
"properties": {
"preferredDuringSchedulingIgnoredDuringExecution": {
"items": {
"properties": {
"podAffinityTerm": {
"properties": {
"labelSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"matchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"mismatchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"namespaceSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"namespaces": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"topologyKey": {
"type": "string"
}
},
"required": [
"topologyKey"
],
"type": "object"
},
"weight": {
"format": "int32",
"type": "integer"
}
},
"required": [
"podAffinityTerm",
"weight"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"requiredDuringSchedulingIgnoredDuringExecution": {
"items": {
"properties": {
"labelSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"matchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"mismatchLabelKeys": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"namespaceSelector": {
"properties": {
"matchExpressions": {
"items": {
"properties": {
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"values": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"required": [
"key",
"operator"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"matchLabels": {
"additionalProperties": {
"type": "string"
},
"type": "object"
}
},
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"namespaces": {
"items": {
"type": "string"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
},
"topologyKey": {
"type": "string"
}
},
"required": [
"topologyKey"
],
"type": "object"
},
"type": "array",
"x-kubernetes-list-type": "atomic"
}
},
"type": "object"
}
},
"type": "object"
},
"agentEnvVars": {
"items": {
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
},
"valueFrom": {
"properties": {
"configMapKeyRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"default": "",
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"fieldRef": {
"properties": {
"apiVersion": {
"type": "string"
},
"fieldPath": {
"type": "string"
}
},
"required": [
"fieldPath"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"fileKeyRef": {
"properties": {
"key": {
"type": "string"
},
"optional": {
"default": false,
"type": "boolean"
},
"path": {
"type": "string"
},
"volumeName": {
"type": "string"
}
},
"required": [
"key",
"path",
"volumeName"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"resourceFieldRef": {
"properties": {
"containerName": {
"type": "string"
},
"divisor": {
"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
},
"resource": {
"type": "string"
}
},
"required": [
"resource"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
},
"secretKeyRef": {
"properties": {
"key": {
"type": "string"
},
"name": {
"default": "",
"type": "string"
},
"optional": {
"type": "boolean"
}
},
"required": [
"key"
],
"type": "object",
"x-kubernetes-map-type": "atomic"
}
},
"type": "object"
}
},
"required": [
"name"
],
"type": "object"
},
"nullable": true,
"type": "array"
},
"agentNamespace": {
"nullable": true,
"type": "string"
},
"agentResources": {
"nullable": true,
"properties": {
"claims": {
"items": {
"properties": {
"name": {
"type": "string"
},
"request": {
"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"
},
"agentSchedulingCustomization": {
"properties": {
"podDisruptionBudget": {
"properties": {
"maxUnavailable": {
"type": "string"
},
"minAvailable": {
"type": "string"
}
},
"type": "object"
},
"priorityClass": {
"properties": {
"preemptionPolicy": {
"type": "string"
},
"value": {
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
},
"agentTolerations": {
"items": {
"properties": {
"effect": {
"type": "string"
},
"key": {
"type": "string"
},
"operator": {
"type": "string"
},
"tolerationSeconds": {
"format": "int64",
"type": "integer"
},
"value": {
"type": "string"
}
},
"type": "object"
},
"nullable": true,
"type": "array"
},
"clientID": {
"nullable": true,
"type": "string"
},
"hostNetwork": {
"nullable": true,
"type": "boolean"
},
"kubeConfigSecret": {
"nullable": true,
"type": "string"
},
"kubeConfigSecretNamespace": {
"nullable": true,
"type": "string"
},
"paused": {
"type": "boolean"
},
"privateRepoURL": {
"nullable": true,
"type": "string"
},
"redeployAgentGeneration": {
"format": "int64",
"type": "integer"
},
"templateValues": {
"nullable": true,
"type": "object",
"x-kubernetes-preserve-unknown-fields": true
}
},
"type": "object"
},
"status": {
"properties": {
"activeSchedule": {
"type": "boolean"
},
"agent": {
"properties": {
"lastSeen": {
"format": "date-time",
"nullable": true,
"type": "string"
},
"namespace": {
"nullable": true,
"type": "string"
}
},
"type": "object"
},
"agentAffinityHash": {
"type": "string"
},
"agentConfigChanged": {
"type": "boolean"
},
"agentDeployedGeneration": {
"format": "int64",
"nullable": true,
"type": "integer"
},
"agentEnvVarsHash": {
"nullable": true,
"type": "string"
},
"agentHostNetwork": {
"nullable": true,
"type": "boolean"
},
"agentMigrated": {
"type": "boolean"
},
"agentNamespaceMigrated": {
"type": "boolean"
},
"agentPrivateRepoURL": {
"nullable": true,
"type": "string"
},
"agentResourcesHash": {
"nullable": true,
"type": "string"
},
"agentSchedulingCustomizationHash": {
"type": "string"
},
"agentTLSMode": {
"nullable": true,
"type": "string"
},
"agentTolerationsHash": {
"nullable": true,
"type": "string"
},
"apiServerCAHash": {
"nullable": true,
"type": "string"
},
"apiServerURL": {
"nullable": true,
"type": "string"
},
"cattleNamespaceMigrated": {
"type": "boolean"
},
"conditions": {
"items": {
"properties": {
"lastTransitionTime": {
"type": "string"
},
"lastUpdateTime": {
"type": "string"
},
"message": {
"type": "string"
},
"reason": {
"type": "string"
},
"status": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"status",
"type"
],
"type": "object"
},
"type": "array"
},
"desiredReadyGitRepos": {
"type": "integer"
},
"desiredReadyHelmOps": {
"type": "integer"
},
"display": {
"properties": {
"readyBundles": {
"type": "string"
},
"state": {
"nullable": true,
"type": "string"
}
},
"type": "object"
},
"garbageCollectionInterval": {
"type": "string"
},
"namespace": {
"type": "string"
},
"readyGitRepos": {
"type": "integer"
},
"readyHelmOps": {
"type": "integer"
},
"resourceCounts": {
"properties": {
"desiredReady": {
"type": "integer"
},
"missing": {
"type": "integer"
},
"modified": {
"type": "integer"
},
"notReady": {
"type": "integer"
},
"orphaned": {
"type": "integer"
},
"ready": {
"type": "integer"
},
"unknown": {
"type": "integer"
},
"waitApplied": {
"type": "integer"
}
},
"type": "object"
},
"scheduled": {
"type": "boolean"
},
"summary": {
"properties": {
"desiredReady": {
"type": "integer"
},
"errApplied": {
"type": "integer"
},
"modified": {
"type": "integer"
},
"nonReadyResources": {
"items": {
"properties": {
"bundleState": {
"nullable": true,
"type": "string"
},
"message": {
"nullable": true,
"type": "string"
},
"modifiedStatus": {
"items": {
"properties": {
"apiVersion": {
"nullable": true,
"type": "string"
},
"delete": {
"type": "boolean"
},
"exist": {
"type": "boolean"
},
"kind": {
"nullable": true,
"type": "string"
},
"missing": {
"type": "boolean"
},
"name": {
"nullable": true,
"type": "string"
},
"namespace": {
"nullable": true,
"type": "string"
},
"patch": {
"nullable": true,
"type": "string"
}
},
"type": "object"
},
"nullable": true,
"type": "array"
},
"name": {
"nullable": true,
"type": "string"
},
"nonReadyStatus": {
"items": {
"properties": {
"apiVersion": {
"nullable": true,
"type": "string"
},
"kind": {
"nullable": true,
"type": "string"
},
"name": {
"nullable": true,
"type": "string"
},
"namespace": {
"nullable": true,
"type": "string"
},
"summary": {
"properties": {
"error": {
"type": "boolean"
},
"message": {
"items": {
"type": "string"
},
"type": "array"
},
"state": {
"type": "string"
},
"transitioning": {
"type": "boolean"
}
},
"type": "object"
},
"uid": {
"nullable": true,
"type": "string"
}
},
"type": "object"
},
"nullable": true,
"type": "array"
}
},
"type": "object"
},
"nullable": true,
"type": "array"
},
"notReady": {
"type": "integer"
},
"outOfSync": {
"type": "integer"
},
"pending": {
"type": "integer"
},
"ready": {
"type": "integer"
},
"waitApplied": {
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}