-
Notifications
You must be signed in to change notification settings - Fork 191
Description
What would you like to be added:
#1386 introduce a bunch of changes to make pointer to be non-pointer.
kubeapilinter made such suggestions probably because of inner type validation for example like #1366 (comment)
I did manual experiment and noticed that currently kubeapi linter will force to use non-pointer type wherever the zero value is not valid. As zero value is not valid, the zero value can be used to represent nil(when users don't set it), therefore pointer is not needed. It matches https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#serialization-of-custom-resources
But as I read https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#optional-vs-required, I feel that the k8s built-in convention is more clear. When the filed is optional, we use pointer in most cases. And for the developers, we can always check nil to know whether users don't set it and may use some additional default mechanism, currently developers need to remember in which cases zero value is not valid and can be used to represent unset cases.
Why is this needed: