Kontakt

Making Rancher 2 and GitLab OAuth Authentication work together

by Sebastian Kurfürst on 31.12.2020

We are big fans of GitLab for the DevOps Pipeline, and of Rancher 2 for Kubernetes Orchestration. However, there is no Single-Signon between GitLab and Rancher. It is requested some times, but I totally understand that the Rancher folks need to prioritize which services they support.

So, after figuring out that the GitHub oAuth API is supported by Rancher, I checked the source code and found that actually not many APIs of GitHub are needed.

Thus, I built a small proxy in Golang which implements the relevant parts of the GitHub API, and sends the requests to GitLab. And because GitLab's and GitHub's API are quite similar and both implement oAuth, it all fits into a single file and is stateless :)

You'll find the full source code, including the needed adjustments to the GitLab config below.

Happy k8s-ing, rancher'ing and gitlab-ing,
and a Happy and Healthy New Year 2021,
Sebastian
PS: Let me know what you think about this on twitter :)