Currently, cluster-admin is a requirement according to the chectl error message:
[ibuziuk@fedora ~]$ chectl server:start --platform=minishift --multiuser
โ airplane Minishift preflight checklist
โ Verify if oc is installed...done.
โ Verify if minishift is installed...done.
โ Verify if minishift is running...done.
โฏ ๐โ Running the Che Operator
โ Copying operator resources...done.
โ Create Namespace (che)...done.
โ Create ServiceAccount che-operator in namespace che...done.
โ Create Role che-operator in namespace che
โ ERROR: It looks like you don't have enough privileges. You need to grant
โฆ
Create ClusterRole che-operator
Create RoleBinding che-operator in namespace che
Create ClusterRoleBinding che-operator
Create CRD checlusters.org.eclipse.che
Waiting 5 seconds for the new Kubernetes resources to get flushed
Create deployment che-operator in namespace che
Create Che Cluster eclipse-che in namespace che
โบ Error: ERROR: It looks like you don't have enough privileges. You need to
โบ grant more privileges to current user or use a different user. If you are
โบ using minishift you can "oc login -u system:admin"
admin rights should not be required (except if the user wants to configure Keycloak to use OpenShift OAuth). Today for some reason we create a che-operator ClusterRole. Why do we need that? Can we avoid it?
Usecase:
@ibuziuk
admin rights should not be required (except if the user wants to configure Keycloak to use OpenShift OAuth)
If we want to configure OpenShift OAuth or create console link - then we need cluster role https://github.com/eclipse/che-operator/blob/master/deploy/cluster_role.yaml
But from your logs, we can see that it failed during role creating and AFAIU it's about granting operator an ability to created pods, routes, services ... https://github.com/eclipse/che-operator/blob/master/deploy/role.yaml
But your issue totally makes sense if we can not avoid admin rights at all - maybe we can improve UX, like make chectl interactive - ask the user to type credentials that we will use only for those operations that we can not do with default context credentials.
Testing now on
minishift v1.34.1+c2ff9cb
chectl/0.0.20191011-next.7cfccb7 linux-x64 node-v10.16.3
I see
chectl server:start -a operator -m -p minishift
โ Verify Kubernetes API
โ Failed to connect to Kubernetes API. serviceaccounts is forbidden: User "developer" cannot list serviceaccounts in the namespace "default": no RBAC policy matched
๐ Looking for an already existing Che instance
โบ Error: Failed to connect to Kubernetes API. serviceaccounts is forbidden: User "developer" cannot list serviceaccounts in the namespace "default": no RBAC policy matched
And running as system:admin results in the eclipse-che namespace being created by system:admin, so inaccessible to a regular account. I need to oc policy add-role-to-user admin developer -n che to access Che.
@amisevsk It's not possible to deploy operator without admin rights yet.
There is a PR that make chectl does not require admin rights on this phase https://github.com/che-incubator/chectl/pull/340. But after it's merged - it would fail on clusterrole creation phase.
minishift addon admin-user and loggin to console with admin/admin.I just shared different alternatives for using chectl+minishift and I definitely agree that chectl workflow should be improved.
Thanks @sleshchenko -- I realize that the operator requires admin, it was just a little confusing. Mostly the issue is one you've described elsewhere of trying to get serviceaccounts in the default namespace causing a confusing message (but I think you've got a PR for this already).
@ibuziuk Regarding the scope of this issue, what actual testing is required? We currently have five platforms listed in the issue description, for each of those do we need to just test the "main" installer for that platform (e.g. helm for k8s clusters, etc)?
As it stands, my opinion would be
These are the minimum permissions required to install che via `chectl:
https://gist.github.com/tomgeorge/a1691328efd48735e6c7207008a03104
I bound those roles to the developer user in crc and installed che.
The main admin-y thing is being able to create clusterroles/roles. This requires a decent level of permissions, but not cluster-admin. If you are able to create cluster roles you can create the roles required to access oauthclients and consolelinks, while still not allowing access to those objects as the installing user.
Updated Roles required for a normal user to install che via chectl (without creating the clusterrole using this branch https://github.com/che-incubator/chectl/pull/381):
https://gist.github.com/tomgeorge/3e6d9cefad635160a022fc1a8f929e1c
Testing matrix:
Creating a CRD requires cluster wide privileges and I think we should process that in a different way compared to the creation of namespaced resourced. An idea would be to add the option chectl server:start --create-crd-only and use the following workflow:
system:admin user and use that for the creation of the CRD onlychectl server:start --create-crd-only and then come back to the current context to deploy che.@tomgeorge about your testing matrix: are the default user privileges enough to deploy Che (if we exclude the CRD) on minikube/minishift/crc?
They are not, I had to apply the roles listed above. If I disable --os-oauth then a regular user can install Che after the che-minimal role is applied in CRC. This is also the case for minishift.
Minikube does not have any identity provider and users are typically in the admin context, so that is less of an issue.
for point 2a: I believe that you would need permission to impersonate system:admin which a regular user probably won't have
@l0rd @davidfestal what if the che operator created a che-installer service account with appropriate permissions, and cluster administrators or OLM allowed an identity provider group to impersonate that service account?
hello @sleshchenko @amisevsk could we update the doc accordingly ? if anything is needed to install Che, should be specified in https://www.eclipse.org/che/docs/che-7/running-che-locally/#using-minishift-to-set-up-openshift-3_running-che-locally
hello @sleshchenko @amisevsk could we update the doc accordingly ?
@sunix Sorry, accordingly to what?
It's better to sync with Michal, he has PR[1] to che-operator and it seems after that we will always require cluster-admin context while deploying Che.
There is a thread[2] in che-dev mailing list and there are no objections since now.
[1] https://github.com/eclipse/che-operator/pull/137
[2] https://www.eclipse.org/lists/che-dev/msg03498.html
Is this issue done? If so, please close. If not, please move to backlog or scheduled milestone.
Tom said: "No it probably should go back in the backlog"
As it stands, a "regular" user would not be able to install che via chectl without the intervention of an administrator. We had a couple of ideas to proceed but never started work on them. @tolusha @l0rd I believe this is under the deploy team now.
Also, is this a P1 issue anymore?