Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update config apply diagrams #914

Merged
merged 19 commits into from
Nov 8, 2024
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
36 changes: 29 additions & 7 deletions docs/architecture/config_apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ flowchart TB
0["Start"] --> 2["Receive Config Apply Request"]
2 --> 3{"File in allowed directory list?"}
3 -- No --> 4["Send Data Plane Response <br> COMMAND_STATUS_FAILURE"]
3 -- Yes --> 5["Compare File Hash"]
3 -- Yes --> 5["Determine File Actions"]
4 --> 6["Clear File Cache"]
6 --> 1["End"]
5 --> 7{"Error Reading Files to Compare Hashes?"}
5 --> 7{"Error Determining File Actions?"}
7 -- Yes --> 4
7 -- No --> 8["File Action Write, Add, Delete"]
8 --> 10{"File Changes ?"}
Expand Down Expand Up @@ -37,7 +37,7 @@ flowchart TB

```

# Config Apply Sequence Diagram
# Config Apply Sequence Diagram
```mermaid
sequenceDiagram
participant Command Plugin as Command Plugin
Expand All @@ -52,29 +52,49 @@ sequenceDiagram
participant Watcher Plugin as Watcher Plugin

Command Plugin -) Message Bus: ConfigApplyRequestTopic
Message Bus -)+ Watcher Plugin: ConfigApplyRequestTopic
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(false)
Message Bus -)+ File Plugin: ConfigApplyRequestTopic
File Plugin ->>+ File Manager Service: ConfigApply(ctx, configApplyRequest)
File Manager Service ->> File Manager Service: checkAllowedDirectory(checkFiles)
File Manager Service ->> File Manager Service: CompareFileHash(fileOverview)
File Manager Service ->> File Manager Service: DetermineFileActions(currentFilesOnDisk, modifiedFiles)
File Manager Service ->> File Manager Service: executeFileActions(ctx)
File Manager Service ->> File Operator: Write()
File Operator -->> File Manager Service: error
File Manager Service -->>- File Plugin: writeStatus, error
alt no file changes
rect rgb(66, 129, 164)
File Plugin -) Message Bus: ConfigApplySuccessfulTopic
Message Bus -) Watcher Plugin: ConfigApplySuccessfulTopic
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(true)

Message Bus -) File Plugin: ConfigApplySuccessfulTopic
File Plugin ->> File Plugin: ClearCache()
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_OK
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_OK
end
else has error
rect rgb(166, 128, 140)
File Plugin -) Message Bus: ConfigApplyCompleteTopic
Message Bus -) Watcher Plugin: ConfigApplyCompleteTopic
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(true)
Message Bus -) File Plugin: ConfigApplyCompleteTopic
File Plugin ->> File Plugin: ClearCache()
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE
end
else rollback required
rect rgb(144, 143, 217)
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_ERROR
File Plugin ->> File Manager Service: Rollback(ctx, instanceID)
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_ERROR
File Plugin ->> File Manager Service: Rollback(ctx, instanceID)
File Plugin -) Message Bus: ConfigApplyCompleteTopic
Message Bus -) Watcher Plugin: ConfigApplyCompleteTopic
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(true)
Message Bus -) File Plugin: ConfigApplyCompleteTopic
File Plugin ->> File Plugin: ClearCache()
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE
end
else no error
rect rgb(66, 129, 164)
Expand All @@ -99,12 +119,13 @@ sequenceDiagram
alt no error
rect rgb(66, 129, 164)
Resource Plugin -) Message Bus: ConfigApplySuccessfulTopic
Resource Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_OK
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_OK
Message Bus -)+ File Plugin: ConfigApplySuccessfulTopic
File Plugin ->>- File Plugin: clearCache()
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_OK
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_OK
Message Bus -)+ Watcher Plugin: ConfigApplySuccessfulTopic
Watcher Plugin ->>- Watcher Plugin: Reparse Config
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(true)
end
else error
rect rgb(146, 144, 199)
Expand All @@ -118,4 +139,5 @@ sequenceDiagram




```
125 changes: 68 additions & 57 deletions docs/architecture/config_apply_rollback.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,66 +25,77 @@ flowchart TB
# Config Apply Rollback Sequence Diagram
```mermaid
sequenceDiagram
participant Command Plugin as Command Plugin
participant Message Bus as Message Bus
participant File Plugin as File Plugin
participant File Manager Service as File Manager Service
participant File Operator as File Operator
participant Resource Plugin as Resource Plugin
participant Resource Service as Resource Service
participant Instance Operator as Instance Operator
participant Log Tailer Operator as Log Tailer Operator
participant Command Plugin as Command Plugin
participant Message Bus as Message Bus
participant File Plugin as File Plugin
participant File Manager Service as File Manager Service
participant File Operator as File Operator
participant Resource Plugin as Resource Plugin
participant Resource Service as Resource Service
participant Instance Operator as Instance Operator
participant Log Tailer Operator as Log Tailer Operator

Message Bus -)+ File Plugin: ConfigApplyFailedTopic
File Plugin ->>+ File Manager Service: Rollback(ctx, instanceID)
File Manager Service ->> File Operator: Write()
File Operator -->> File Manager Service: error
File Manager Service -->>- File Plugin: error
alt error
rect rgb(166, 128, 140)
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_ERROR
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_ERROR
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -)+ File Plugin: ConfigApplyFailedTopic
File Plugin ->>+ File Manager Service: Rollback(ctx, instanceID)
File Manager Service ->> File Operator: Write()
File Operator -->> File Manager Service: error
File Manager Service -->>- File Plugin: error
alt error
rect rgb(166, 128, 140)
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_ERROR
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_ERROR
File Plugin -) Message Bus: ConfigApplyCompleteTopic
Message Bus -) Watcher Plugin: ConfigApplyCompleteTopic
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(true)
Message Bus -) File Plugin: ConfigApplyCompleteTopic
File Plugin ->> File Plugin: ClearCache()
File Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE
end
else no error
rect rgb(66, 129, 164)
File Plugin -)- Message Bus: RollbackWriteTopic
end
end
else no error
rect rgb(66, 129, 164)
File Plugin -)- Message Bus: RollbackWriteTopic
Message Bus -)+ Resource Plugin: WriteConfigSuccessfulTopic
Resource Plugin ->>+ Resource Service: ApplyConfig(ctx, instanceID)
Resource Service ->>+ Instance Operator: Validate(ctx, instance)
Instance Operator ->> Instance Operator: validateConfigCheckResponse()
Instance Operator -->>- Resource Service: error
Resource Service ->>+ Instance Operator: Reload(ctx, instance)
loop monitorLogs()
Instance Operator ->>+ Log Tailer Operator: Tail(ctx, errorLog, errorChannel)
loop Tail()
Log Tailer Operator ->>- Log Tailer Operator: doesLogLineContainError(line)
Log Tailer Operator -->> Instance Operator: error
end
end
end
Message Bus -)+ Resource Plugin: WriteConfigSuccessfulTopic
Resource Plugin ->>+ Resource Service: ApplyConfig(ctx, instanceID)
Resource Service ->>+ Instance Operator: Validate(ctx, instance)
Instance Operator ->> Instance Operator: validateConfigCheckResponse()
Instance Operator -->>- Resource Service: error
Resource Service ->>+ Instance Operator: Reload(ctx, instance)
loop monitorLogs()
Instance Operator ->>+ Log Tailer Operator: Tail(ctx, errorLog, errorChannel)
loop Tail()
Log Tailer Operator ->>- Log Tailer Operator: doesLogLineContainError(line)
Log Tailer Operator -->> Instance Operator: error
end
end
Instance Operator -->>- Resource Service: error
Resource Service -->>- Resource Plugin: error
alt no error
rect rgb(66, 129, 164)
Resource Plugin -) Message Bus: RollbackCompleteTopic
Resource Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -)+ File Plugin: RollbackCompleteTopic
File Plugin ->>- File Plugin: clearCache()
end
else error
rect rgb(166, 128, 140)
Resource Plugin -) Message Bus: RollbackCompleteTopic
Resource Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_ERROR
Resource Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_ERROR
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -)+ File Plugin: RollbackCompleteTopic
File Plugin ->>- File Plugin: clearCache()
Instance Operator -->>- Resource Service: error
Resource Service -->>- Resource Plugin: error
alt no error
rect rgb(66, 129, 164)
Resource Plugin -) Message Bus: ConfigApplyCompleteTopic
Message Bus -) Watcher Plugin: ConfigApplyCompleteTopic
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(true)
Message Bus -)+ File Plugin: ConfigApplyCompleteTopic
File Plugin ->> File Plugin: clearCache()
File Plugin -)- Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE
end
else error
rect rgb(166, 128, 140)
Resource Plugin -) Message Bus: ConfigApplyCompleteTopic
Message Bus -) Watcher Plugin: ConfigApplyCompleteTopic
Watcher Plugin ->> Watcher Plugin: FileWatcherService.SetEnabled(true)
Resource Plugin -) Message Bus: DataPlaneResponseTopic Command_Status_ERROR
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_ERROR
Message Bus -)+ File Plugin: ConfigApplyCompleteTopic
File Plugin ->> File Plugin: clearCache()
File Plugin -)- Message Bus: DataPlaneResponseTopic Command_Status_FAILURE
Message Bus -) Command Plugin: DataPlaneResponseTopic Command_Status_FAILURE

end
end
end


```
Loading