vmware-archive / operator-builder

A Kubebuilder plugin to accelerate the development of Kubernetes operators
MIT License
41 stars 6 forks source link

Add error to operator-builder CLI when cluster-scoped with no namespace resource #276

Open lander2k2 opened 2 years ago

lander2k2 commented 2 years ago

If a code base using cluster-scoped workload is created without a namespace child resource included, we should throw an error. This is because the resulting operator could attempt to create resources in a namespace that doesn't exist.

We should add a force flag so operator developer can override in the case they have good controls for namespace creation.

Error message something like:

You are using a cluster-scoped workload without a namespace child resource.  This could result in your controller attempting to create resources in a non-existent namespace.  Add the --force-cluster-scoped-without-ns flag to ignore this error message.