Skip to content

Instantly share code, notes, and snippets.

@adietish
Created February 8, 2022 17:58
Show Gist options
  • Save adietish/f83d4347e96ce14788b9f739613abdfb to your computer and use it in GitHub Desktop.
Save adietish/f83d4347e96ce14788b9f739613abdfb to your computer and use it in GitHub Desktop.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: crontabs.stable.example.com
spec:
group: stable.example.com
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
cronSpec:
type: string
image:
type: string
replicas:
type: integer
scope: Namespaced
names:
plural: crontabs
singular: crontab
kind: CronTab
shortNames:
- ct
"com.example.stable.v1.CronTab": {
"type": "object",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More 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. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"metadata": {
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta_v2"
},
"spec": {
"type": "object",
"properties": {
"cronSpec": {
"type": "string"
},
"image": {
"type": "string"
},
"replicas": {
"type": "integer"
}
}
}
},
"x-kubernetes-group-version-kind": [
{
"group": "stable.example.com",
"kind": "CronTab",
"version": "v1"
}
]
}
@adietish
Copy link
Author

adietish commented Feb 8, 2022

using swagger.json:

  • name should be deducible via <kind>.<group>
  • group, kind & version can be taken from "x-kubernetes-group-version-kind"
  • scope is missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment