Skip to content

CustomResourceDefinition/catalog

Repository files navigation

CRD Catalog

This repository aggregates hundreds of popular Kubernetes CRDs (CustomResourceDefinition) including their JSON schema format.

The intended purpose with this repository is aid with validation, language servers and code generation.

The catalog are checked for updates every 8 hours, but the catalog is also tagged with kubernetes versions to make the catalog available as it were when a specific version was released.

Known use cases

Validation using Kubeconform

The schema files can be used by various tools such as Kubeconform as an alternative to kubectl --dry-run to perform validation on custom (and native) Kubernetes resources.

Running Kubernetes schema validation checks helps apply the "shift-left approach" on machines without giving them access to your cluster (e.g. locally or on CI).

Example:

kubeconform -schema-location default -schema-location 'https://raw.githubusercontent.com/CustomResourceDefinition/catalog/main/schema/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' [MANIFEST]

Example using the catalog as it were when version 1.33.6 was released:

kubeconform -schema-location default -schema-location 'https://raw.githubusercontent.com/CustomResourceDefinition/catalog/refs/tags/v1.33.6/schema/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' [MANIFEST]

Code generation using kopium

The definition files can be used by tools like kopium to generate Rust data structs.

Example:

curl -sSL 'https://raw.githubusercontent.com/CustomResourceDefinition/catalog/main/definitions/monitoring.coreos.com/prometheusrule.yaml' \
    | kopium -Af - > prometheusrule.rs

Example using the catalog as it were when version 1.33.6 was released:

curl -sSL 'https://raw.githubusercontent.com/CustomResourceDefinition/catalog/refs/tags/v1.33.6/definitions/monitoring.coreos.com/prometheusrule.yaml' \
    | kopium -Af - > prometheusrule.rs

Language server support

yaml-language-server is a language server that can provide its functionality in a number of editors like:

  • Visual Studio Code
  • Neovim
  • Vim
  • Emacs
  • ... and more

This language server is in general installed as a plugin into your editor, for instance YAML for VSCode or coc.nvim for Vim/Neovim.

This allows for language assistance for specific file with inline declared schemas like:

# yaml-language-server: $schema=https://raw.githubusercontent.com/CustomResourceDefinition/catalog/refs/heads/main/schema/monitoring.coreos.com/prometheusrule_v1.json
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
# ...

or more broadly with a section in your .vscode/settings.json:

{
  "yaml.schemas": {
    "https://raw.githubusercontent.com/CustomResourceDefinition/catalog/refs/heads/main/schema/monitoring.coreos.com/prometheusrule_v1.json": [
      "prometheus/rules/*.yaml"
    ]
  }
}

Adding missing CRDs

You can use the how to contribute guide to make a pull request.

Otherwise you are welcome to create an issue asking for a CRD that is not yet present in the catalog. For the best result you should include the following information in your issue, if you have it:

If you are missing most of the details above, try to include a link to an installation guide or a short explanation of the purpose of the CRD.

Origins

This catalog is inspired by the CRDs-catalog from Datree, but instead uses a sources list to pull updates automatically and enables re-creation from these sources provided the source helm charts, uris, etc are still available.

See a comparison of the schema files available in each respective repository.

About

Repository with Custom Resource Definition files for validation purposes

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 7