Make CRD w/ webhook conversion strategy example usable (#16105)

- Sample CRD will not work due to apiextensions.k8s.io/v1beta1 setting preserveUnknownFields to true by default. Set to `false`.
- Provide required `type: object` at `openAPIV3Schema` root for both versions to avoid `schema.openAPIV3Schema.type: Required value: must not be empty at the root` error.
This commit is contained in:
Matt Dorn 2019-09-04 22:06:51 -05:00 committed by Kubernetes Prow Robot
parent f8439cbe69
commit e05483d771
1 changed files with 4 additions and 0 deletions

View File

@ -217,6 +217,8 @@ metadata:
spec: spec:
# group name to use for REST API: /apis/<group>/<version> # group name to use for REST API: /apis/<group>/<version>
group: example.com group: example.com
# prunes object fields that are not specified in OpenAPI schemas below.
preserveUnknownFields: false
# list of versions supported by this CustomResourceDefinition # list of versions supported by this CustomResourceDefinition
versions: versions:
- name: v1beta1 - name: v1beta1
@ -228,6 +230,7 @@ spec:
# schema is defined. # schema is defined.
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object
properties: properties:
hostPort: hostPort:
type: string type: string
@ -236,6 +239,7 @@ spec:
storage: false storage: false
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object
properties: properties:
host: host:
type: string type: string