Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use reflection in KubernetesClientBuilder #6687

Open
jamestpt opened this issue Dec 2, 2024 · 1 comment
Open

Don't use reflection in KubernetesClientBuilder #6687

jamestpt opened this issue Dec 2, 2024 · 1 comment

Comments

@jamestpt
Copy link

jamestpt commented Dec 2, 2024

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.

@manusa
Copy link
Member

manusa commented Dec 11, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants