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

Role, RoleBinding, ClusterRole, ClusterRoleBinding handlers are registered with wrong key #1152

Closed
leogps opened this issue Jul 25, 2018 · 17 comments
Labels

Comments

@leogps
Copy link

leogps commented Jul 25, 2018

It should be "Role" not "KubernetesRole". Using Class.getSimpleName() returns the class name.

Similar issue in the following classes:

  • KubernetesRoleBinding

--> RoleBinding; Affected class KubernetesRoleBindingHandler.

  • KubernetesClusterRole

--> ClusterRole; Affected class KubernetesClusterRoleHandler.

  • KubernetesClusterRoleBinding

--> ClusterRoleBinding; Affected class KubernetesClusterRoleBindingHandler.

@fnan-avq
Copy link

Is there any plan to fix this in a coming release ?

@rohanKanojia
Copy link
Member

Yeah, we'll fix this in coming release

@traviswinter
Copy link
Contributor

@rohanKanojia - do you know if there was a reason Kubernetes was added to the front of those class names? Just to avoid collision with the Openshift resources? Would this be as simple as renaming them in the kubeschema.json?

@rohanKanojia
Copy link
Member

ah, no. I need to check

@rohanKanojia
Copy link
Member

@traviswinter :You're right Kubernetes was added in order to avoid collision with Openshift Role Bindings(Since they were implemented before); I think we need to remove prefixes from here to rename it:

K8sRole rbac.Role
K8sRoleList rbac.RoleList
K8sRoleBinding rbac.RoleBinding
K8sRoleBindingList rbac.RoleBindingList
NetNameSpace networkapi.NetNamespace

But I'm afraid doing this might break backward compatibility for openshift users.

@batsatt
Copy link

batsatt commented Nov 17, 2018

Can you just change the getKind() implementations to return the correct string constant instead of the (simple) class name?

We are blocked on this bug.

@batsatt
Copy link

batsatt commented Nov 18, 2018

I've worked around this for now by making renamed copies of the classes and manually registering them. (And no, modifying getKind() was not enough.)

@traviswinter
Copy link
Contributor

@rohanKanojia - What do you think we should do here? Any idea on how we can prevent breaking of Openshift backwards compatibility? I was looking into just checking for "Kubernetes"+getKind() in Handler but that could potentially break the OpenShift handlers as well.

Going to try and get more familiar with this code (now that I found out how to add the Eclipse key-bindings to IntelliJ :)) so I can be more productive.

@rohanKanojia
Copy link
Member

@traviswinter : This is creating lots of confusion among users. I think we should move forward with renaming these classes to their proper names and rename Openshift classes with prefixes( I think this would make more sense).

@iocanel @oscerd : thoughts???

@oscerd
Copy link
Member

oscerd commented Dec 20, 2018

+1, makes sense.

@rohanKanojia
Copy link
Member

@traviswinter : Would be awesome if you can find time to fix this. You just need to rename classes in generate.go and resolve some conflicts in client code due to newly generated model. Otherwise, I would try to send PR this weekend :-)

@traviswinter
Copy link
Contributor

@rohanKanojia , sure - can take a stab at it this afternoon. Any recommendation for the prefixes? Simply call it "Openshift"+kind? Would this simply trade the issue from Kubernetes to Openshift? Or does Openshift require a different pattern for creating their resources?

@rohanKanojia
Copy link
Member

@traviswinter : No, it's the same pattern. It's just that for an Openshift object we read from an openshift vendor directory(in case of RoleBinding github.com/openshift/api/authorization/v1). If I'm not wrong these Role bindings were introduced earlier in Openshift and then came into kubernetes(the generated classes also look similar). Now kubernetes also supports them so as an openshift user I would prefer to use kubernetes based RoleBindings(that's just my opinion ;-) ).

@traviswinter
Copy link
Contributor

Looks like the generate.go changes were not enough - changes to kube-schema.json were required as well, or am I doing something wrong? :)

The generated classes themselves will need to be changed as well for
return KubernetesRole.class.getSimpleName(); to work in KubernetesRoleHandler.java.

@singhania
Copy link

In which version this will be released ?

@rohanKanojia
Copy link
Member

@singhania : It would be available in next release i.e 4.1.2

@PMarci
Copy link

PMarci commented Jan 25, 2019

Could this be the cause of my Kubernetes RoleBinding fragment not being picked up by the fabric8-maven-plugin? It's located in the same (default) directory as other fragments, which are created successfully. I can also see from the logs and by inspecting the generated OpenShift manifest that the equivalent OpenShift RoleBinding is in fact generated.

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

No branches or pull requests

8 participants