kubernetes-client
kubernetes-client copied to clipboard
CRDGenerator: Allow to configure categories
Is your enhancement related to a problem? Please describe
At the moment there is no easy way to configure the categories of a generator CRD: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#categories
Describe the solution you'd like
A new @Categories
annotation allows to configure a list of categories (similar to @ShortNames
):
/**
* Specifies categories of a Custom Resource.
*/
@Target({ TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Categories {
/**
* @return the categories this Custom Resource belongs to.
*/
String[] value();
}
The CRD-Generator detects this annotation on Custom Resource classes and creates a CRD which contains those categories.
Describe alternatives you've considered
As long as we stay to the "seperate annotations" strategy, adding categories to an existing annotation looks to me as a bad idea. If there are plans to consolidate them, I would revise this opinion.
Additional context
No response
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!
Is anyone working on this or is there any plans for it to be implemented?
This has for me a lower priority compared to other missing features I'm currently working on. But I already had such a requirement and I'm sure I will have it again. So I plan to implement it someday in the future.
Feel free to contribute a solution. I have updated the description and added more details on how it could be implemented.
@manusa Can you check the description and confirm it is going in the right direction?
Thanks @baloo42 for the info. I will contribute a PR.
Just one question - is crd-generator-api
considered deprecated and therefore I should only implement for crd-generator-api-v2
or should I implement for both?
Would be nice, thanks!
You only have to implement it in crd-generator/api-v2 ("api v2"). New features for crd-generator/api ("api v1") won't get merged by the maintainers. So it is kind of deprecated, but as far as I know, there is no official timeline for the deprecation yet.