diff --git a/design/synchronizer/activity-diagram.png b/design/synchronizer/activity-diagram.png new file mode 100644 index 0000000000..4f755f5344 Binary files /dev/null and b/design/synchronizer/activity-diagram.png differ diff --git a/design/synchronizer/activity-diagram.puml b/design/synchronizer/activity-diagram.puml new file mode 100644 index 0000000000..252c94fb31 --- /dev/null +++ b/design/synchronizer/activity-diagram.puml @@ -0,0 +1,18 @@ +@startuml +start +repeat + if (am leader?) then (yes) + :update `leader-expiration` to future time (1); + else (no) + if (`leader-expiration` time has passed (2)?) then (yes) + :delete leader host (3); + :create leader host (4); + if (host create includes API key?) then (yes) + :update `leader-expiration` to future time (5); + else (no) + endif + else (no) + endif + endif +repeat while (sleep) +@enduml diff --git a/design/synchronizer/auto-failover.md b/design/synchronizer/auto-failover.md new file mode 100644 index 0000000000..e26a10eb78 --- /dev/null +++ b/design/synchronizer/auto-failover.md @@ -0,0 +1,92 @@ +# Synchronizer Auto-Failover + +The following is an overview of the workflow for a Vault Sychronizer to gain leadership: + +![](./activity-diagram.png) + +Given the following Policy: +```yml +- !policy + id: conjur + body: + - !policy + id: vault-synchronizer + body: + - !variable leader-expiration + + # The Group all Synchronizer hosts need to be added to. + - !group members + + - !permit + role: !group members + privileges: [ read, execute, update ] + resources: + - !variable leader-expiration + + - !policy + id: leader + owner: !group members + + - !policy + id: vault-lines-of-business + owner: !group members + body: + - !variable + id: lob-1 + mime_type: application/json + - !variable + id: lob-2 + mime_type: application/json +``` + +The following are the steps (using the API) listed above: + +1. Update `leader-expiration` to future time: + + ```sh + POST /secrets/{account}/variable/conjur%2Fvault-synchronizer%2Fleader-expiration + + Time.now() +