Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Last active September 25, 2024 13:24
Show Gist options
  • Save hexfusion/c8959970a2739a3a607b315327774faa to your computer and use it in GitHub Desktop.
Save hexfusion/c8959970a2739a3a607b315327774faa to your computer and use it in GitHub Desktop.
agent_current
flowchart TD
    %% Define Vars
    MANAGEMENT_API[Query Mgt API]
    RECONCILE_LOOP[Reconcile Loop]
    UPDATE_CURRENT[Desired -> Current Spec]
    RECONCILE_NEW[New --> Desired Spec]

    STATUS_DEGRADED[Report Degraded Status]
    STATUS_SUCCESS[Report Success Status]

    CONTROLLER_CONSOLE[Console Controller]
    CONTROLLER_OS[OS Controller]
    CONTROLLER_RESOURCE[Resource Controller]
    CONTROLLER_HOOKS[Hooks Controller]
    CONTROLLER_CONFIG[Config Controller]

    REBOOT[Reboot]

    %% Evals
    EVAL_NEW_VERSION{New Version Available?}
    EVAL_RECONCILE{Reconciliation Successful?}
    EVAL_OS{Has OS Update}

    %%%% Begin Flow
    MANAGEMENT_API --> EVAL_NEW_VERSION

    %% New Desired Spec?
    EVAL_NEW_VERSION -- Yes --> RECONCILE_NEW
    EVAL_NEW_VERSION -- No --> RECONCILE_LOOP

    RECONCILE_NEW --> RECONCILE_LOOP
    RECONCILE_LOOP --> CONTROLLER_CONSOLE
    
    %% Reconciliation
    subgraph Controller Reconciliation
        CONTROLLER_CONSOLE --> CONTROLLER_HOOKS
        CONTROLLER_HOOKS --> CONTROLLER_CONFIG
        CONTROLLER_CONFIG --> CONTROLLER_RESOURCE
        CONTROLLER_RESOURCE --> CONTROLLER_OS
        CONTROLLER_OS --> EVAL_OS
    end

    %% OS    
    EVAL_OS -- Yes --> REBOOT
    EVAL_OS -- No --> EVAL_RECONCILE

    %% Reconcile Success
    EVAL_RECONCILE -- Yes --> UPDATE_CURRENT
    EVAL_RECONCILE -- No --> STATUS_DEGRADED

    STATUS_DEGRADED --> MANAGEMENT_API

    UPDATE_CURRENT --> STATUS_SUCCESS
    STATUS_SUCCESS --> MANAGEMENT_API

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment