controller-tools icon indicating copy to clipboard operation
controller-tools copied to clipboard

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

Open ahmetb opened this issue 1 year ago • 1 comments

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.

ahmetb avatar Feb 29 '24 19:02 ahmetb

Sounds good to me

sbueringer avatar Mar 23 '24 12:03 sbueringer

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 avatar Apr 26 '24 07:04 ahmetb

@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.

k8s-ci-robot avatar Apr 26 '24 07:04 k8s-ci-robot