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 · 5 comments
Open

Unknown apiVersionKind XXXX is it registered? #3364

LikLiComing opened this issue Apr 29, 2024 · 5 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

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.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 22, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants