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

Unknown apiVersionKind XXXX is it registered? #3364

Open
LikLiComing opened this issue Apr 29, 2024 · 3 comments
Open

Unknown apiVersionKind XXXX is it registered? #3364

LikLiComing opened this issue Apr 29, 2024 · 3 comments

Comments

@LikLiComing
Copy link

Solution!!!!!!!!!!!!!!!!!!!!!!!
Use "ClassLoader classLoader = Thread.currentThread().getContextClassLoader();"
instead of "Yaml.class.getClassLoader()", and it works!!!!
so please fix this issue, thanks
image

Describe the bug
Unknown apiVersionKind XXXClass is it registered? and "No kubernetes api model classes found from classloader, this may break automatic api discovery"

Client Version
since from 15.0.1 as I know

Kubernetes Version
N/A

Java Version
Java 8

To Reproduce
as it is deployed to server through CI and CD in way of JAR, we got wrong because of 'Yaml.class.getClassLoader()'

Expected behavior
get all KubernetesObject class in package 'io.kubernetes.client.openapi.models', but fail, since It scan the running server JAR, not "java-client.jar"!

KubeConfig
N/A

Server (please complete the following information):

  • OS: Linux
  • Environment container
  • Cloud Azure

Additional context
N/A

@brendandburns
Copy link
Contributor

The class loading stuff is kind of hacky no matter what because of the dependency on classes. I'm not sure that this is better (e.g. fewer situations where it doesn't work) vs anything else, but I'm open to a discussion or pointers for why this is better.

@LikLiComing
Copy link
Author

agree, this is uderlying code, we should be very careful for each single change, you can find more details in the QA below, please use it as reference and do enough testing, like 'try to find an overload of the method that accepts the class loader as a parameter.', look forwards to your team's effort.
Thanks for your attention, brendandburns.
image

https://stackoverflow.com/questions/1771679/difference-between-threads-context-class-loader-and-normal-classloader

@godnesszsp
Copy link

"I'm facing an issue where the Kubernetes Java client (client-java) is loaded as expected when running in IntelliJ IDEA locally, but after packaging the application into a JAR via Maven or building a Docker image and then attempting to run it, the client-java JAR is not being loaded correctly. Despite this, I've confirmed that the client-java JAR is correctly included within both the Maven-built JAR and the Docker image.

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

3 participants