Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Latest commit

 

History

History
74 lines (50 loc) · 6.09 KB

README.adoc

File metadata and controls

74 lines (50 loc) · 6.09 KB

Fabric8 OSO Proxy (Traefik Extension)

1. Overview

OSO Proxy project is proxy between OSIO (OpenShift.io) and OSO (OpenShift Online server / OpenShift server). It takes care of replacing OSIO Token (user token) with OSO Token. Ideally, all calls from OSIO to OSO should go through oso-proxy but currently there are some exception due to some well known reason.

OSO Proxy is forked from Traefik project. Ideally, oso-proxy should have used Traefik as dependency and should not have been forked from Traefik but currently Traefik does not provide mechanism to plugin 3rd party extensions, so oso-proxy is forked from Traefik and OSIO extensions were added directly into Traefik codebase.

2. OSO Proxy code

This section list down all the code that is added in Traefik for OSO Proxy.

Note
All files related to OSIO contains osio in file name so just searching file name cotaining osio will list all the relevant files.

3. OSIO and Traefik

There are mainly two components added in traefik for OSIO in OSO Proxy project.

3.1. Traefik Provider

Traefik docs link: frontends, backends

Traefik configuration has two main elements called "frontends and backends" which provides details on routing/redirecting to traefik. These configurations can be provided in multiple ways to traefik. For OSIO, we have implmentation "OSIO Traefik Provider" to provide these configuration details to traefik.

OSIO provider code_link implements Provider inerface from Traefik code_link and registered at code_link.

Here is basic sequence flow which shows OSIO Traefik provider operations:

OSIO Traefik Provider - Sequence Flow

3.2. Traefik Middleware

This is a regular Go Middleware. Each http request comes to traefik, it will call all middleware in sequence addded in server.go. There is a OSIO Traefik middleware added in server.go. Please check, Server struct with osioMiddleware field having type *osio.OSIOAuth.

OSIO Traefik middleware mainly does two things. First, it replaces OSIO User Token with OSO User token in http request. Second, it sets traefik Matchers "Headers" with "Target" as key and "OSO Cluster URL" as value. With help of "Target", traefik will redirect call to corresponding OSO Server.

Here is basic sequence flow which shows OSIO Traefik middleware operations:

OSIO Traefik Middleware - Sequence Flow