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

Loading a deployment from server with a config file throws exception #807

Closed
kkucera opened this issue Jul 5, 2017 · 2 comments
Closed

Comments

@kkucera
Copy link

kkucera commented Jul 5, 2017

The following call with a config file of kind: Deployment causes an exception:

KubernetesClient client = new DefaultKubernetesClient();
List<HasMetadata> deploymentList = client.load(getFileInputString("deployment.yml")).inNamespace("mynamespace").fromServer().get();
Exception in thread "main" java.lang.ClassCastException: io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder cannot be cast to io.fabric8.kubernetes.client.HasMetadataVisitiableBuilder
	at io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.get(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java:270)
	at io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.get(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java:66)

I'm using kubernetes-client: 2.5.2 which pulls kubernetes-model: 1.0.78

I'm not sure if this is an issue in the kubernetes-client project or the kubernetes-model project.
Seems like io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder is supposed to be implementing io.fabric8.kubernetes.client.HasMetadataVisitiableBuilder

@uce
Copy link

uce commented May 24, 2018

This issue still persists for kubernetes-client:3.1.11 with kubernetes-model:2.0.9. For a similar operation as shown by @kkucera for a ConfigMap, I get:

java.lang.ClassCastException: io.fabric8.kubernetes.api.model.ConfigMapBuilder cannot be cast to io.fabric8.kubernetes.client.HasMetadataVisitiableBuilder
	at io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.get(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java:173)
	at io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.get(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java:59)

Any plans to fix this soon?

izhigalko pushed a commit to izhigalko/kubernetes-client that referenced this issue Mar 14, 2019
Fix get from server resource list
@rohanKanojia
Copy link
Member

closed via #1434

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