Description
Describe the bug
When trying to create a CRD with x-kubernetes-int-or-string
, its being dropped causing the server to respond with The CustomResourceDefinition "middlewares.traefik.io" is invalid: spec.validation.openAPIV3Schema.properties[spec].properties[circuitBreaker].properties[checkPeriod].type: Required value: must not be empty for specified object fields
.
Broken CRD
This is what is actually being passed to the server. How do I know? I print it out before sending the request in the underlying node_module
, node_modules/@kubernetes/client-node/dist/object.js
Client Version
1.0.0
to 1.3.0
Server Version
1.30.0
to 1.33.0
To Reproduce
Steps to reproduce the behavior:
First option
- Use example code
Second option
- kubectl apply -f [USE HERE BROKEN CRD YAML]
^^ These are the errors you get while using the first option
Expected behavior
The create
call should not strip out x-kubernetes-int-or-string
. In essence, it should replicate the behaviour of kubectl apply -f [USE HERE ORIGINAL CRD YAML]
which successfully creates the resource
Example Code
import yaml from 'yaml';
import * as k8s from '@kubernetes/client-node';
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
const spec = yaml.parse(USE HERE ORIGINAL CRD YAML).toJS()
await client.create(spec);
Environment (please complete the following information):
- OS: Linux
- Node.js version: v20.14.0
Additional context
Add any other context about the problem here.