For CRDs to be installed by an operator, can I suspend typechecking when doing kubectl apply?

When I ask to create my Custom Resource using kubectl apply, I get a failure on: "Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "my-crd.example.com" not found"

The CRD is meant to be installed by an Operator.
If we skipped this typecheck, it would not cause a functional problem, because other code guarantees that by the time the Operator starts up, the CRD is available. So when the Operator reads the Custom Resource yaml and tries to create it, the CRD will be there.

Can I suspend the typechecking that produces this error?

There isn’t a way that I am aware of to do this since the API server needs to understand the the type you are creating and it doesn’t just yet.

Maybe you could look into changing your approach on when the CRD should get created, it could poll the API for that type and wait for the CRD to be ready.

1 Like

Thank you.I see that it will not be possible to do it that way. Can you point me to documentation on the typechecking done by the API Server?

This page outlines how Custom Resources work: Custom Resources - Kubernetes

1 Like