github上面的原问题链接:https://github.com/kubernetes/kubernetes/issues/98079
按照他说的,
我新建了一个crd,yaml文件内容如下:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: resous.getnull.example.com
spec:
group: getnull.example.com
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
allocations:
items:
nullable: true
type: integer
type: array
scope: Namespaced
names:
plural: resous
singular: resou
kind: Resou
apply -f 这个文件,然后根据这个crd实例化出来一个资源,yaml文件如下:
apiVersion: getnull.example.com/v1
kind: Resou
metadata:
name: resous-sample
spec:
allocations: null
这之后执行kubectl edit ipamblocks
,直接 :q 退出,就会来到一个新的页面,可以看到这样的报错:
* <nil>: Invalid value: "The edited file failed validation": [ValidationError(IPAMBlock.spec.allocations): unknown object type "nil" in IPAMBlock.spec.allocations[1]...