TemplateProcessor can add custom resource schemas to openapi

This commit is contained in:
Katrina Verey
2021-05-12 14:48:03 -07:00
parent 9557888b32
commit 0fdf0f825f
9 changed files with 270 additions and 19 deletions

View File

@@ -0,0 +1,10 @@
# Copyright 2021 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
spec:
targets:
- app: B
size: small
- app: C
type: Ruby
size: large

View File

@@ -0,0 +1,58 @@
{
"definitions": {
"com.example.v1.Foo": {
"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"
},
"spec": {
"type": "object",
"required": [
"targets"
],
"properties": {
"targets": {
"type": "array",
"x-kubernetes-patch-merge-key": "app",
"x-kubernetes-patch-strategy": "merge",
"items": {
"type": "object",
"required": [
"app"
],
"properties": {
"app": {
"type": "string"
},
"size": {
"type": "string"
},
"type": {
"type": "string"
}
}
}
}
}
}
},
"x-kubernetes-group-version-kind": [
{
"group": "example.com",
"kind": "Foo",
"version": "v1"
}
]
}
}
}

View File

@@ -0,0 +1,14 @@
# Copyright 2021 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
apiVersion: example.com/v1
kind: Foo
metadata:
name: example
spec:
targets:
- app: A
type: Go
size: small
- app: B
type: Go