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

Don't use reflection in KubernetesClientBuilder

Open jamestpt opened this issue 11 months ago • 3 comments

Is your enhancement related to a problem? Please describe

I have some code where I'm loading and unloading classes into Thread.currentThread().getContextClassLoader() for the purposes of compatibility with various different spark versions. I'm running into reflection problems when using KubernetesClientBuilder, since its using the very same classloader and reflection to load the constructor for KubernetesClientImpl.

Describe the solution you'd like

Could we possibly move out KubernetesClientBuilder from the client-api into the client, and use the constructor directly new KubernetesClientImpl(...) rather than using reflection? I think this would make the code safer and more readable.

Describe alternatives you've considered

No response

Additional context

Thanks for this useful library! Let me know what you think about this proposal.

jamestpt avatar Dec 02 '24 11:12 jamestpt

Hi @shawkins I'm not sure why we used reflection instead of SPI to build the KubernetesClient instance. Was there anything specific? Would changing this to use SPI or other alternatives have any unexpected side-effects?

manusa avatar Dec 11 '24 04:12 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 Mar 13 '25 06:03 stale[bot]

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 22 '25 06:06 stale[bot]

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 21 '25 16:09 stale[bot]