Skip to content

Instantly share code, notes, and snippets.

@sa-spag
Last active October 6, 2022 09:55
Show Gist options
  • Save sa-spag/a84e9c1926b4a28642fc694b91746c13 to your computer and use it in GitHub Desktop.
Save sa-spag/a84e9c1926b4a28642fc694b91746c13 to your computer and use it in GitHub Desktop.
sequenceDiagram
    actor Author
    actor Peers
    participant App Git repository
    participant CI
    participant Container image repository
    participant CD controller
    Note right of CD controller: Deployed in a control cluster
    participant Kubernetes manifests Git repository
    Note right of Kubernetes manifests Git repository: Possibly the same as the app's
    participant Kubernetes cluster


    loop
        Author->>App Git repository: Pushes commit to working branch
    end

    Author->>App Git repository: Opens pull request targeting the default branch
    Peers->>App Git repository: Approve the pull request
    opt Auto-merge disabled
        Author->>App Git repository: Merges the pull request
    end

    App Git repository->>+CI: Notifies about new commits to build on the default branch
    CI->>Container image repository: Pushes new app container image
    Container image repository->>CD controller: Notifies about new image tags

    alt Continuous Deployment (recommended for staging environments)
        CD controller->>Kubernetes manifests Git repository: Patches relevant manifests on the default branch
    else Continuous Delivery
        CD controller->>Kubernetes manifests Git repository: Creates a pull request with manifests patches
        Note left of Kubernetes manifests Git repository: Pull request description includes changelog inferred from<br>the container image source repository (retrieved from an image label).<br>Reviewers can be set according to changes authors.
        Kubernetes manifests Git repository-->>CI: Notifies about deployment pull request
        CI-->>Author: Notifies about deployment pull request
        CI-->>Peers: Notifies about deployment pull request
        par
            Kubernetes manifests Git repository-->>Author: Requests review from
            Author->>Kubernetes manifests Git repository: Approves the pull request
        and
            Kubernetes manifests Git repository-->>Peers: Requests review from
            Peers->>Kubernetes manifests Git repository: Approves the pull request
        end
        Author->>Kubernetes manifests Git repository: Merges the pull request
    end
    Kubernetes manifests Git repository-->>CD controller: Notifies about new commits on the default branch

    CD controller->>Kubernetes cluster: Patches resources
    Kubernetes cluster->>Kubernetes cluster: Converges according to configuration
    Note right of Kubernetes cluster: Eventually introduce a progressive delivery controller

    Kubernetes cluster-->>CD controller: Notifies about successful convergence
    CD controller-->>Kubernetes manifests Git repository: Notifies about successful deployment
    Note right of CD controller: Using commit statuses or other GitHub APIs
    CD controller-->>CI: Notifies about successful deployment
    CI-->>App Git repository: Notifies about successful deployment
    Note left of CI: Using commit statuses or other GitHub APIs
    CI-->>Author: Notifies about successful deployment
    Note left of CI: Via Slack
    deactivate CI
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment