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

autocloning no longer works - route creation ahead fails #350

Closed
henrjk opened this issue May 25, 2020 · 7 comments · Fixed by #355
Closed

autocloning no longer works - route creation ahead fails #350

henrjk opened this issue May 25, 2020 · 7 comments · Fixed by #355
Labels
bug Something isn't working

Comments

@henrjk
Copy link
Member

henrjk commented May 25, 2020

Describe the bug
After enabling autocloning the build fails with the following:

[Pipeline] sh (create dummy route for extraction (test-route-1590397255632))
+ oc -n ods30hk-feature-test-jsl-core-branch create route edge test-route-1590397255632 --service=dummy --port=80
+ true
Error from server (Forbidden): routes.route.openshift.io is forbidden: User "system:serviceaccount:ods30hk-cd:jenkins" cannot create routes.route.openshift.io in the namespace "ods30hk-feature-test-jsl-core-branch": RBAC: clusterrole.rbac.authorization.k8s.io "self-provisoner" not found
[Pipeline] sh (get cluster route domain)
+ oc -n ods30hk-feature-test-jsl-core-branch get route test-route-1590397255632 -o 'jsonpath={.spec.host}'
Error from server (Forbidden): routes.route.openshift.io "test-route-1590397255632" is forbidden: User "system:serviceaccount:ods30hk-cd:jenkins" cannot get routes.route.openshift.io in the namespace "ods30hk-feature-test-jsl-core-branch": RBAC: clusterrole.rbac.authorization.k8s.io "self-provisoner" not found

To Reproduce
Steps to reproduce the behavior:

  1. In a quickstarter (used be-golang) enable autocloning by changing Jenkinsfile as follows:
√ ods30hk-be-golang-a $ git diff master..feature/test-jsl-core-branch
   branchToEnvironmentMapping: [
     'master': 'dev',
-    // 'release/': 'test'
-  ]
+    'develop': 'dev',
+    'feature/': 'feature',
+    '*': 'dev'
+  ],
+  autoCloneEnvironmentsFromSourceMapping: [
+    'feature': 'dev'
+  ]
 ) { context ->
  1. Commit above change into a new branch feature/test-auto-clone and push branch so that build is triggered
  2. You can see the error described above in the Jenkins build log.

Expected behavior

Autocloning should work without any issue.

Affected version (please complete the following information):

  • OpenShift: [3.11]
  • OpenDevStack [3.x]
@Library('ods-jenkins-shared-library@3.x') _
odsComponentPipeline(
  imageStreamTag: 'ods/jenkins-slave-golang:3.x',
@henrjk henrjk added the bug Something isn't working label May 25, 2020
@michaelsauter michaelsauter added this to To Do in OpenDevStack 3.0 via automation May 25, 2020
@clemensutschig
Copy link
Member

@michaelsauter - is this because of your refactoring changes? ... I am quite surprised because the SA rights are global, or?

@henrjk
Copy link
Member Author

henrjk commented May 26, 2020

I believe the issue is that the OpenShiftService executes the command against the target namespace before it is created. I am getting the same error message if I do this manually.

@clemensutschig
Copy link
Member

closed by #351 - @henrjk - please use the attached PR .. that should do it :)

@clemensutschig clemensutschig changed the title autocloning no longer works autocloning no longer works - route creation ahead fails May 27, 2020
@michaelsauter
Copy link
Member

michaelsauter commented May 27, 2020

Given the error:

Error from server (Forbidden): routes.route.openshift.io is forbidden: User "system:serviceaccount:ods30hk-cd:jenkins" cannot create routes.route.openshift.io in the namespace "ods30hk-feature-test-jsl-core-branch": RBAC: clusterrole.rbac.authorization.k8s.io "self-provisoner" not found

... it sounds like the permissions are insufficient. To my knowledge, there is nothing in ODS which sets up self-provisioner for the jenkins service account. This happens manually. It can either be done for all service accounts (which is the case in your cluster @henrjk) or be given individually for one service account only.

What I can imagine is that some kind of check fails here that disallows route creation. For example, if you ask oc can-i create project, the answer might be no because you yourself cannot see the cluster rights assigned to you. Which means oc thinks you cannot create projects, but actually you can. Maybe something similar happens here behind the scenes?

@henrjk
Copy link
Member Author

henrjk commented May 27, 2020

When I recap the change from commit 734cd84 suggested by Clemens, the build advances, but I am now hitting an issue in my code during cloning so that the application domain call after the cloning is not executed.

@henrjk
Copy link
Member Author

henrjk commented May 27, 2020

Luckily the mentioned issue in my code was an easy fix now cloning actually worked for me.

@michaelsauter does commit 734cd84 makes sense to you?

@michaelsauter
Copy link
Member

@henrjk Yes 734cd84 looks right to me. Would be great to have this as a separate PR for easier traceability. Maybe you can extract into a PR from you so that we can merge it into master apart from the other stuff so you can easily test?

OpenDevStack 3.0 automation moved this from To Do to Done May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants