kubernetes-sigs/controller-tools

Strict validation for unrecognized `+kubebuilder` markers in controller-gen

ahmetb opened this issue · 3 comments

ahmetb commented

I am recently hurt by a lowercase-uppercase mistake in +kubebuilder:validation:enum vs +kubebuilder:validation:Enum marker (which is not even a misspelling).

So I'm proposing that controller-gen should try to do something with every single +kubebuilder:* marker and fail if it does not recognize the marker.

Sounds good to me

I took a quick look, this doesn't seem easily possible as controller-gen has a wide variety of markers that don't start with +kubebuilder: (e.g. +output, +groupName, +optional).

So there's no way to check a +marker against a known list of registered markers, and fail if an unknown one (or one that has a typo) is seen. It would likely require a lot of change.

/close

@ahmetb: Closing this issue.

In response to this:

I took a quick look, this doesn't seem easily possible as controller-gen has a wide variety of markers that don't start with +kubebuilder: (e.g. +output, +groupName, +optional).

So there's no way to check a +marker against a known list of registered markers, and fail if an unknown one (or one that has a typo) is seen. It would likely require a lot of change.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.