Closed Pythoner6 closed 4 months ago
I stumbled upon the same issue. Also, the same exception is raised if default
is used (same CRD as above but enum
replaced with default
:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
spec:
group: foo.example.com
names:
kind: Foo
plural: foos
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
properties:
doesntwork:
default: foo
type: string
type: object
served: true
storage: true
I think I stumbled into this as well; thank you for tracking it down and your fix makes sense to me
Is this fixed with #29?
Yep, looks like this is now working with k8s.contrib.crd 1.0.1 :)
If a CRD uses an
enum
, k8s.contrib.crd will fail, and with a rather unhelpful error message to the user:Manually parsing and then calling deep to typed on the offending CRD (but without the type union used by k8s.contrib.crd) lead to a slightly better error message:
Which eventually lead me to the offending property, which is
enum
as defined here https://github.com/apple/pkl-k8s/blob/main/generated-package/apiextensions-apiserver/pkg/apis/apiextensions/v1/CustomResourceDefinition.pkl#L272 (there's also two other properties in there that use the typeAny
:default
andexample
)An example minimal CRD which reproduces the issue: