openshift / openshift-restclient-java

Other
78 stars 112 forks source link

RoleBinding fails on OpenShift 4 Cluster #451

Closed srueg closed 4 years ago

srueg commented 4 years ago

I get an exception while getting RoleBindings from an OpenShift 4.4 cluster:

Unexpected exception[ClassCastException: class com.openshift.internal.restclient.model.KubernetesResource cannot be cast to class com.openshift.internal.restclient.model.authorization.RoleBinding

Maybe this is due to the new resource version lookup algorithm introduced in https://github.com/openshift/openshift-restclient-java/commit/4f5b2e41afd3e1f904b694bf13d5d3ccdc25ebc1 ? It seems like the library gets the rbac.authorization.k8s.io/v1 version of RoleBindings instead of authorization.openshift.io/v1 which in turn can't be casted to the RoleBinding type.

(I'm using version 9.0.0.Final)

adietish commented 4 years ago

Hi @srueg

this sounds very likely. Maybe there were additional changes introduced in 4.4 that cause this. @jeffmaury, do you know?

jeffmaury commented 4 years ago

Yes I would think the mapping is not up to date. Will test

jeffmaury commented 4 years ago

There is a workaround if you're interested: add a k8stypes.properties file in your classpath with the following content:

com.openshift.internal.restclient.model.authorization.RoleBinding=rbac.authorization.k8s.io/v1.RoleBinding

Fix is coming

srueg commented 4 years ago

Thanks a lot, I'll give it a try 👍