Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into bug-cluster-size
Browse files Browse the repository at this point in the history
  • Loading branch information
grischperl committed Nov 21, 2023
2 parents 0f2196a + b77368d commit 75652ae
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 33 deletions.
36 changes: 4 additions & 32 deletions docs/user/01-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,23 @@ Upon starting the NATS Manager, the controller (following the [Kubebuilder conce
- Stateful Set (sts)
- DestinationRule (dr, [Istio](https://istio.io))

```mermaid
graph LR
A(Start NATS manager) -->|Controller| D(Creates, watches & reconciles resources: cm, sc, sv, sts, dr)
```
![Start NATS manager](./assets/Start_nats_manager.drawio.svg)

### Reacting to NATS CR changes

The NATS Manager reacts to changes of the NATS CR to adapt the resources mentioned above to the desired state.
For details how to configure NATS using the CR, visit the [Configuration documentation](./02-configuration.md).

```mermaid
graph LR
E(NATS CR changes)-->F(Reconciliation triggered)-->|Controller|G(Resources are adapted to reflect the changes)
```
![Reacting to NATS CR changes](./assets/reacting_to_nats_cr_changes.drawio.svg)

### Reacting to resource changes

When resources are changed or deleted, the controller reacts by restoring the defaults according to the NATS CR.
Thus, if you want to change the resources, you must edit the NATS CR; you cannot change the resources directly.

```mermaid
graph LR
A(Resource changes/deleted)-->B(Reconciliation triggered)-->|Controller|C(Resources are restored according to their owner: NATS CR)
```
![Reacting to resource changes](assets/reacting_to_resource_changes.drawio.svg)

### Overview: Reconciliation Flow
The reconciliation flow is as follows:

```mermaid
graph TB
A([Start])
-->B(Map configurations from NATS CR to overrides)
-->C(Render manifests from NATS Helm chart using Helm SDK)
-->D(Patch-apply rendered manifests to cluster using k8s client)
-->E(Checks status of StatefulSet for readiness)
-->F(Update NATS CR Status)
```

### Overview: NATS Manager watches resources

```mermaid
graph TD
Con[NATS-Controller] -->|watches| cm[ConfigMap]
Con -->|watches| sc[Secret]
Con -->|watches| sv[Service]
Con -->|watches| sfs[StatefulSet]
Con -->|watches| dr[DestinationRule]
```
![NM watches resources](assets/NC_watches_resources.drawio.svg)
2 changes: 1 addition & 1 deletion docs/user/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NATS Manager Module
# NATS module

This module ships the NATS Manager, which is responsible for managing the lifecycle of a [NATS JetStream](https://docs.nats.io/nats-concepts/jetstream) deployment.
It observes the state of the NATS cluster and reconciles its state according to the desired state.
Expand Down
4 changes: 4 additions & 0 deletions docs/user/assets/NC_watches_resources.drawio.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 75652ae

Please sign in to comment.