Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* explicitly specify the namespace in the role reference when creating
  che workspace service account role bindings in openshift infra
* create the roles in the namespace, not as cluster roles in k8s infra

Signed-off-by: Lukas Krejci <[email protected]>
  • Loading branch information
metlos committed Apr 15, 2020
1 parent 5c004a2 commit 20e5972
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ void prepare() throws InfrastructureException {
}

String execRoleName = "exec";
if (k8sClient.rbac().clusterRoles().inNamespace(namespace).withName(execRoleName).get()
== null) {
if (k8sClient.rbac().roles().inNamespace(namespace).withName(execRoleName).get() == null) {
createExecRole(k8sClient, execRoleName);
}

String viewRoleName = "workspace-view";
if (k8sClient.rbac().clusterRoles().inNamespace(namespace).withName(viewRoleName).get()
== null) {
if (k8sClient.rbac().roles().inNamespace(namespace).withName(viewRoleName).get() == null) {
createViewRole(k8sClient, viewRoleName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private OpenshiftRoleBinding createViewRoleBinding() {
.endMetadata()
.withNewRoleRef()
.withName("workspace-view")
.withNamespace(projectName)
.endRoleRef()
.withSubjects(
new ObjectReferenceBuilder()
Expand All @@ -167,6 +168,7 @@ private OpenshiftRoleBinding createExecRoleBinding() {
.endMetadata()
.withNewRoleRef()
.withName("exec")
.withNamespace(projectName)
.endRoleRef()
.withSubjects(
new ObjectReferenceBuilder()
Expand Down

0 comments on commit 20e5972

Please sign in to comment.