# azure/k8s-deploy architecture

> Architecture diagram of the GitHub repository azure/k8s-deploy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azure/k8s-deploy
- Repository: https://github.com/azure/k8s-deploy

## Overview

##### Main Components Identification

a) Action Interface Layer
- Entry points (deploy.ts, promote.ts, reject.ts)
- Input handling (inputUtils.ts)

b) Strategy Layer
- Blue-Green Deployment
- Canary Deployment
- Basic Deployment

c) Kubernetes Integration Layer
- Kubectl Operations
- Manifest Management
- Resource Management

##### Component Relationships

**Action Interface Layer**

- Input Validation & Processing

- Strategy Selection

- Strategy Layer

- Blue-Green Implementation
- Service Route
- Ingress Route
- SMI Route

- Canary Implementation
- Pod-based
- SMI-based

- Basic Implementation

- Kubernetes Integration Layer

- Manifest Processing
- Resource Management
- Stability Checks

##### Important Details

a) Input Processing:
- Manifest paths
- Image information
- Strategy selection
- Authentication details

b) Strategy-specific flows:
- Blue-Green: Show version switch buffer
- Canary: Show traffic split methods
- Basic: Show direct deployment path

c) Kubernetes Integration:
- Manifest validation
- Resource creation/updates
- Status checking

##### Implementation Notes

- Blue-Green deployment flow
- Canary deployment flow
- Basic deployment flow
- Error handling paths

##### External Interactions

Connections to:
- Kubernetes API
- Container registries
- Service mesh (if applicable)
- GitHub Actions runtime

##### Technical Details

Aspects:
- TypeScript implementation
- GitHub Actions integration
- Kubernetes resource handling
- Strategy pattern implementation

##### Deployment Flows

- Initial deployment
- Promotion flows
- Rollback scenarios
- Error handling

Remember to maintain a balance between showing the complexity of the system while keeping it readable and understandable. Consider creating multiple views or layers that can be expanded for more detail when needed.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Action Interface Layer"
        EP["Entry Points"]
        IH["Input Handler"]
        EP --> IH
    end

    subgraph "Strategy Layer"
        SS["Strategy Selection"]:::decision
        
        subgraph "Blue-Green Implementation"
            BG["Blue-Green Controller"]
            SR["Service Route"]
            IR["Ingress Route"]
            SMR["SMI Route"]
            BG --> SR
            BG --> IR
            BG --> SMR
        end
        
        subgraph "Canary Implementation"
            CC["Canary Controller"]
            PB["Pod-based"]
            SB["SMI-based"]
            CC --> PB
            CC --> SB
        end
        
        BD["Basic Deployment"]
        
        SS --> BG
        SS --> CC
        SS --> BD
    end
    
    subgraph "Kubernetes Integration Layer"
        KO["Kubectl Operations"]
        MM["Manifest Management"]
        RM["Resource Management"]
        SC["Stability Checks"]
        
        MM --> KO
        RM --> KO
        SC --> KO
    end
    
    IH --> SS
    BG --> MM
    CC --> MM
    BD --> MM
    
    subgraph "External Systems"
        K8S[("Kubernetes Cluster")]:::external
        CR[("Container Registry")]:::external
    end
    
    KO --> K8S
    KO -.-> CR
    
    %% Component Styles
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef external fill:#purple,stroke:#333
    classDef decision fill:#90EE90,stroke:#333
    
    %% Click Events
    click EP "https://github.com/azure/k8s-deploy/tree/main/src/actions/"
    click IH "https://github.com/azure/k8s-deploy/blob/main/src/inputUtils.ts"
    click BG "https://github.com/azure/k8s-deploy/tree/main/src/strategyHelpers/blueGreen/"
    click SR "https://github.com/azure/k8s-deploy/blob/main/src/strategyHelpers/blueGreen/serviceBlueGreenHelper.ts"
    click IR "https://github.com/azure/k8s-deploy/blob/main/src/strategyHelpers/blueGreen/ingressBlueGreenHelper.ts"
    click SMR "https://github.com/azure/k8s-deploy/blob/main/src/strategyHelpers/blueGreen/smiBlueGreenHelper.ts"
    click CC "https://github.com/azure/k8s-deploy/tree/main/src/strategyHelpers/canary/"
    click PB "https://github.com/azure/k8s-deploy/blob/main/src/strategyHelpers/canary/podCanaryHelper.ts"
    click SB "https://github.com/azure/k8s-deploy/blob/main/src/strategyHelpers/canary/smiCanaryHelper.ts"
    click BD "https://github.com/azure/k8s-deploy/blob/main/src/strategyHelpers/deploymentHelper.ts"
    click KO "https://github.com/azure/k8s-deploy/blob/main/src/types/kubectl.ts"
    click MM "https://github.com/azure/k8s-deploy/blob/main/src/utilities/manifestUpdateUtils.ts"
    click RM "https://github.com/azure/k8s-deploy/blob/main/src/utilities/kubectlUtils.ts"
    
    %% Legend
    subgraph Legend
        L1["Component"]
        L2[("External System")]:::external
        L3["Decision Point"]:::decision
    end
```
