Skip to content

Commit

Permalink
Merge pull request #9 from piotrmsc/docs
Browse files Browse the repository at this point in the history
Design documents
  • Loading branch information
Piotr Mścichowski authored Aug 5, 2019
2 parents f67d2fd + d4d0d02 commit 90c16eb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,4 @@ The project is based on [Kubebuilder](https://github.com/kubernetes-sigs/kubebui

# Design

The controller listens for Custom Resource which defines client registration request. Once Custom resource is created, the controller register oauth2 client in hydra using hydra's REST API.
Client Id, Client Secret and Identifier of the client in hydra are be stored in the kubernetes as a secret and referenced in the applied CR.
Reference is used to identify in which kubernetes secret are stored mentioned properties. Secret iscreated in the same namespace of applied CR.
By default controller should be deployed in the same pod as hydra. Service discovery will come in place in the future.


## Synchronization mode

Additionally, controller supports synchronization mode, where it tries to register all clients in hydra.
Synchronization is an optional mode, enabled via config, which is meant for use cases where hydra is deployed with in memory storage.
If hydra pod is restarted for some reason then it does not have client in its storage. With synchronization mode the controller makes sure that hydra has up to date clients.
Synchronization is done by making POST request to hydra with payload describing all client information including clientID,clientSecret and Identifier of last applied client.
If client exists in hydra storage 409 is returned which is considered as ok and synchronization continues with other clients.
Take a look at [Design Readme](./docs/README.md)
24 changes: 24 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Design


## Controller design

The controller listens for Custom Resource which defines client registration request. Once Custom resource is created, the controller register oauth2 client in hydra using hydra's REST API.
Client Id, Client Secret and Identifier of the client in hydra are be stored in the kubernetes as a secret and referenced in the applied CR.
Reference is used to identify in which kubernetes secret are stored mentioned properties. Secret iscreated in the same namespace of applied CR.
By default controller should be deployed in the same pod as hydra. Service discovery will come in place in the future.


It is represented in the diagram

![diagram](./assets/workflow.svg)

## Synchronization mode

Additionally, controller supports synchronization mode, where it tries to register all clients in hydra.
Synchronization is an optional mode, enabled via config, which is meant for use cases where hydra is deployed with in memory storage.
If hydra pod is restarted for some reason then it does not have client in its storage. With synchronization mode the controller makes sure that hydra has up to date clients.
Synchronization is done by making POST request to hydra with payload describing all client information including clientID,clientSecret and Identifier of last applied client.
If client exists in hydra storage 409 is returned which is considered as ok and synchronization continues with other clients.

![diagram](./assets/synchronization-mode.svg)
2 changes: 2 additions & 0 deletions docs/assets/synchronization-mode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 90c16eb

Please sign in to comment.