Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 5 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,11 @@ Supported cloud providers:

## How it works

```mermaid
flowchart TD
A[cloud-secrets starts] --> B[Load config from env vars]
B --> C["Create Docker Swarm<br/>and Cloud clients"]
C --> E[Application sync loop]

F[Trigger by timer] --> E
Q[Trigger by SIGHUP] --> E

E --> G[Read secrets from Cloud]
E --> H[Read secrets from Swarm]
G --> I["Compare by logical path<br/>and external version id"]
H --> I

I --> J{Secret state in Swarm}
J -->|not exists| K[Create new Swarm secret]
J -->|version changed| L[Create new secret version]
J -->|same version| M[Skip]

L --> N["Update services to use new secret ID"]
N --> R[Rolls updated service tasks]
R --> O[Remove old versions]
O --> S[Restore parent secret]
S --> T["Reload Swarm state"]
T --> U{"CS_CLEANUP_ORPHANED=true"}
U -->|yes| V["Remove managed secrets absent in Cloud<br/>and unused by services, with all versions"]
U -->|no| P

K --> P[Write sync result logs]
V --> P
M --> P
```
<p align="center">
<img src="./docs/architecture-overview.svg" alt="External Secret Manager → cloud-secrets → Docker Secrets → Swarm Services" width="760" />
</p>

See [Architecture](./docs/architecture.md) for the full synchronization lifecycle.

## Design goals

Expand Down
86 changes: 86 additions & 0 deletions docs/architecture-overview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Architecture

**cloud-secrets** continuously synchronizes secrets from an external secret manager into Docker Swarm, creates versioned Docker Secrets when values change, and rolls affected services onto the new secret version.

The diagram below shows the full synchronization lifecycle.

```mermaid
flowchart TD
A[cloud-secrets starts] --> B[Load config from env vars]
B --> C["Create Docker Swarm<br/>and Cloud clients"]
C --> E[Application sync loop]

F[Trigger by timer] --> E
Q[Trigger by SIGHUP] --> E

E --> G[Read secrets from Cloud]
E --> H[Read secrets from Swarm]
G --> I["Compare by logical path<br/>and external version id"]
H --> I

I --> J{Secret state in Swarm}
J -->|not exists| K[Create new Swarm secret]
J -->|version changed| L[Create new secret version]
J -->|same version| M[Skip]

L --> N["Update services to use new secret ID"]
N --> R[Rolls updated service tasks]
R --> O[Remove old versions]
O --> S[Restore parent secret]
S --> T["Reload Swarm state"]
T --> U{"CS_CLEANUP_ORPHANED=true"}
U -->|yes| V["Remove managed secrets absent in Cloud<br/>and unused by services, with all versions"]
U -->|no| P

K --> P[Write sync result logs]
V --> P
M --> P
```

[Back to README](../README.md)
Loading