kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

Rationalize KubernetesList/BaseKubernetesList/DefaultKubernetesResourceList

Open shawkins opened this issue 3 years ago • 4 comments

Is your task related to a problem? Please describe

These classes after #3628 there are further cleanups that can be made to several list classes.

Describe the solution you'd like

  • BaseKubernetesList could can be merged with KubernetesList (this would mean changing/moving the generated class to be KubernetesList).
  • ~~KubernetesList should implement KubernetesResourceList.~~ - it already does
  • DefaultKubernetesResourceList and CustomResourceList would then be deprecated and indicate to use KubernetesList instead.

Describe alternatives you've considered

No response

Additional context

No response

shawkins avatar Feb 26 '22 17:02 shawkins

Ideal state is:

  • deprecate/remove: DefaultKubernetesResourceList, CustomResourceList, and KubernetesResourceList
  • BaseKubernetesList becomes generic (and thus a replacement for CustomResourceList and DefaultKubernetesResourceList) and the generation logic is changed to make each resource list extend BaseKubernetesList
  • KubernetesList can still be used in the api where appropriate - if BaseKubernetesList<HasMetadata> is possible, you could even just rename BaseKubernetesList to KubernetesList to eliminate one more class.

Since the generation logic seems more involved that I want to mess with, that means we need to keep KubernetesResourceList as the resource lists will not have a common base with the other lists.

From there no matter what I try if I have a generic BaseKubernetesList something fails with the buildable logic with KubernetesList - if BaseKubernetesList is not buildable, the KubernetesListFluent isn't aware of the necessary fields. If BaseKubernetesList is buildable, I get:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.0:compile (default-compile) on project kubernetes-model-core: Fatal error compiling: java.lang.ClassCastException: class io.sundr.model.TypeParamRef cannot be cast to class io.sundr.model.ClassRef (io.sundr.model.TypeParamRef and io.sundr.model.ClassRef are in unnamed module of loader java.net.URLClassLoader @6921cfa)

So I think that means the I'm stuck. If we want to retain a KubernetesList builder, then we cannot improve on the current set of classes other than to deprecate CustomResourceList

shawkins avatar Mar 10 '22 03:03 shawkins

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!

stale[bot] avatar Jun 08 '22 20:06 stale[bot]

Shall we go ahead with the CustomResourceList deprecation?

manusa avatar Jun 09 '22 10:06 manusa

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!

stale[bot] avatar Sep 07 '22 13:09 stale[bot]