kopf
kopf copied to clipboard
Can't apply turtorial crd.yaml example,The CustomResourceDefinition "ephemeralvolumeclaims.zalando.org" is invalid
I am trying to run the turtorial https://kopf.readthedocs.io/en/latest/walkthrough/resources/
And when I
kubectl apply -f crd.yaml
then it goes wrong as
The CustomResourceDefinition "ephemeralvolumeclaims.zalando.org" is invalid: spec.versions: Invalid value: []apiextensions.CustomResourceDefinitionVersion{apiextensions.CustomResourceDefinitionVersion{Name:"v1", Served:true, Storage:true, Schema:(*apiextensions.CustomResourceValidation)(0xc01c503bc0), Subresources:(*apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil)}}: per-version schemas may not all be set to identical values (top-level validation should be used instead)
my k8s version are:
ubuntu@k8s-master:~/k8s_operator$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:18:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.4", GitCommit:"67d2fcf276fcd9cf743ad4be9a9ef5828adc082f", GitTreeState:"clean", BuildDate:"2019-09-18T14:41:55Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
I read the docs of k8s v1.15 and search some git issues,I change crd.yaml to
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: ephemeralvolumeclaims.zalando.org
spec:
scope: Namespaced
group: zalando.org
names:
kind: EphemeralVolumeClaim
plural: ephemeralvolumeclaims
singular: ephemeralvolumeclaim
shortNames:
- evcs
- evc
versions:
- name: v1
served: true
storage: true
validation:
openAPIV3Schema:
type: object
properties:
spec:
type: object
x-kubernetes-preserve-unknown-fields: true
status:
type: object
x-kubernetes-preserve-unknown-fields: true
It is OK then.