instrumenta / kubernetes-json-schema

Schemas for every version of every object in every version of Kubernetes
https://kubernetesjsonschema.dev
Other
306 stars 134 forks source link

Perhaps missing schemas in standalone/strict #1

Closed mikerhodes closed 5 years ago

mikerhodes commented 5 years ago

Using kubeval (which looks to be super-awesome), I was receiving the error:

> kubeval --version
Version: 0.10.0
Commit: bc9ab56cc345f67265b8fb01b03489170fd0e504
Date: 2019-06-09T17:38:35Z

> kubeval test.yaml
1 error occurred:
    * Failed initalizing schema https://kubernetesjsonschema.dev/master-standalone/customresourcedefinition-apiextensions-v1beta1.json: Could not read schema from HTTP, response status is 404 Not Found

I noticed that master has this file but master-standalone does not. It appears that kubeval will either use master-standalone or master-standalone-strict -- from what I can tell of how this repo works, that's what a tool like kubeval must do to avoid relative refs.

I'm no sure whether it's relevant, but GH reports 1,027 files for master but only 1,010 for master-standalone.

I'm not sure whether this is a bug or not, but it does feel perhaps like one?


test.yaml is taken from the CRD page at https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/:

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: crontabs.stable.example.com
spec:
  # group name to use for REST API: /apis/<group>/<version>
  group: stable.example.com
  # list of versions supported by this CustomResourceDefinition
  versions:
    - name: v1
      # Each version can be enabled/disabled by Served flag.
      served: true
      # One and only one version must be marked as the storage version.
      storage: true
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: crontabs
    # singular name to be used as an alias on the CLI and for display
    singular: crontab
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: CronTab
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - ct
undeadops commented 5 years ago

I'm also having an issue with this

garethr commented 5 years ago

Assuming you are using the schemas via Kubeval, it now has a few different flags to work around issues with custom resource definitions. https://kubeval.instrumenta.dev/#crds