This give details on fabric8-services/fabric8-oso-proxy project which is forked from containous/traefik project.
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.
This section list down all the code that is added in Traefik for OSO Proxy.
-
osio traefik provider package - provider/osio
-
osio traefik middleware package - middlewares/osio
-
integation test package and files - osio_middleware_test.go, osio_middleware_config.toml, osio_provider_test.go, osio_provider_config.toml, integration/common
-
build and deploy files - openshift, cico_setup.sh, cico_run_tests.sh, cico_build_deploy.sh, Dockerfile.builder, Dockerfile.deploy, Dockerfile.deploy.rhel,
-
traefik and oso-proxy code combined files - configuration.go, provider_aggregator.go server.go
Note
|
All files related to OSIO contains osio in file name so just searching file name cotaining osio will list all the relevant files. |
There are mainly two components added in traefik for OSIO in OSO Proxy project.
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:
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: