# microsoft/docker-provider architecture

> Architecture diagram of the GitHub repository microsoft/docker-provider, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/docker-provider
- Repository: https://github.com/microsoft/docker-provider

## Overview

##### Project type and purpose
- This is a “Container Monitoring Agent” project for Azure Monitor. It builds and packages both Linux and Windows agents that run in Kubernetes clusters (AKS, Arc-enabled, on-prem) to collect logs/metrics from containers and forward them to Azure Monitor (Log Analytics and Metrics).

##### File structure
- Top-level folders:
- .pipelines – Azure DevOps CI/CD definitions (build/test/release).
- build – scripts/Makefiles to compile and bundle Linux/Windows installers and shared objects.
- charts – Helm charts for deploying the agent in non-AKS clusters.
- alerts – curated alert rule JSONs (ARM).
- kubernetes – Dockerfiles + build/publish scripts and entrypoint scripts for Linux/Windows agent container images.
- scripts – onboarding, troubleshoot, preview scripts using Azure CLI/ARM/Bicep/Terraform to set up DCR, Workspace RBAC, Azure Policy, etc.
- source/plugins – the core agent “plugins”:
– go/ – out_oms plugin and extension binaries in Go
– ruby/ – in/out/filter plugins in Ruby, ApplicationInsights client, telemetry channel
- test – unit, e2e (sonobuoy, pytest, ginkgo), scenario, scale tests.

##### README for additional insights
- Describes the dual-agent (Linux + Windows) architecture, prerequisites, build steps (Go, .NET Core, Docker), source layout, pipeline usage, and deployment via Kubernetes YAML/Helm and Azure DevOps release pipelines.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Code Repository
    subgraph "Source Code Repository"
        Repo["Git Repository"]:::external
        PluginsGo["Go Plugins"]:::runtime
        PluginsRuby["Ruby Plugins"]:::runtime
        InstallerCommon["Common Installer Code"]:::build
        InstallerLinux["Linux Installer Code"]:::build
        InstallerWindows["Windows Installer Code"]:::build
        HelmCharts["Helm Charts"]:::deploy
        ARMAlerts["Alert Rule Definitions"]:::external
        Documentation["Documentation"]:::external
    end

    %% CI/CD Layer
    subgraph "CI/CD (Azure DevOps)" 
        CI["Build Pipelines"]:::build
        SecurityScans["Security Scans"]:::build
        DockerBuild["Container Image Build & Push"]:::build
        ReleasePipelines["Release Pipelines"]:::build
    end

    %% Artifact Repositories
    subgraph "Artifact Repositories"
        ACR["Azure Container Registry"]:::azure
        HelmRepo["Helm Chart Repository"]:::deploy
    end

    %% Deployment & Onboarding
    subgraph "Deployment & Onboarding"
        Onboard["Onboarding Scripts"]:::scripts
        Troubleshoot["Troubleshoot Scripts"]:::scripts
        ArcExtension["Azure Arc K8s Extension"]:::deploy
    end

    %% Kubernetes Cluster
    subgraph "Kubernetes Cluster (AKS / Arc / On-prem)"
        K8sAPI["Kubernetes API"]:::deploy
        subgraph "Agent DaemonSets"
            LinuxDS["Linux Agent DaemonSet"]:::runtime
            WindowsDS["Windows Agent DaemonSet"]:::runtime
            FluentSidecar["Fluent-bit Sidecar"]:::runtime
        end
    end

    %% Agent Plugins & Config
    subgraph "Agent Runtime"
        ConfigMaps["ConfigMaps & Secrets"]:::runtime
        PluginsGoRuntime["Load Go Plugins"]:::runtime
        PluginsRubyRuntime["Load Ruby Plugins"]:::runtime
    end

    %% Azure Monitor Backend
    subgraph "Azure Monitor Backend"
        LogAnalytics["Log Analytics Workspace"]:::azure
        MetricsStore["Metrics Ingestion Endpoint"]:::azure
        AppInsights["Application Insights Channel"]:::azure
    end

    %% Testing
    subgraph "Test Automation"
        UnitTests["Unit Tests"]:::test
        E2E["End-to-End Tests"]:::test
        ScenarioScale["Scenario & Scale Tests"]:::test
    end

    %% Relationships
    Repo -->|push to Git| CI
    CI -->|build binaries| DockerBuild
    CI -->|run pipelines| SecurityScans
    DockerBuild -->|push images| ACR
    CI -->|publish charts| HelmRepo
    ReleasePipelines -->|deploy charts| HelmRepo

    Onboard -->|configure DCR & RBAC| K8sAPI
    Troubleshoot -->|collect logs| K8sAPI
    ArcExtension -->|deploy extension| K8sAPI

    HelmRepo -->|helm install| K8sAPI
    ACR -->|pull images| K8sAPI

    K8sAPI --> LinuxDS
    K8sAPI --> WindowsDS
    LinuxDS --> FluentSidecar
    WindowsDS --> FluentSidecar

    LinuxDS --> PluginsGoRuntime
    LinuxDS --> PluginsRubyRuntime
    WindowsDS --> PluginsGoRuntime
    WindowsDS --> PluginsRubyRuntime
    LinuxDS --> ConfigMaps
    WindowsDS --> ConfigMaps

    FluentSidecar -->|forwards logs| LogAnalytics
    LinuxDS -->|metrics & logs| MetricsStore
    LinuxDS -->|AppInsights| AppInsights
    WindowsDS -->|metrics & logs| MetricsStore
    WindowsDS -->|AppInsights| AppInsights

    UnitTests -->|deploy tests| K8sAPI
    E2E -->|validate flows| K8sAPI
    ScenarioScale -->|validate scale| K8sAPI

    %% Click Events
    click CI "https://github.com/microsoft/docker-provider/tree/ci_prod/.pipelines/"
    click InstallerCommon "https://github.com/microsoft/docker-provider/tree/ci_prod/build/common/installer/"
    click InstallerLinux "https://github.com/microsoft/docker-provider/tree/ci_prod/build/linux/installer/"
    click InstallerLinux "https://github.com/microsoft/docker-provider/tree/ci_prod/build/linux/Makefile"
    click InstallerWindows "https://github.com/microsoft/docker-provider/tree/ci_prod/build/windows/installer/"
    click InstallerWindows "https://github.com/microsoft/docker-provider/blob/ci_prod/build/windows/Makefile.ps1"
    click PluginsGo "https://github.com/microsoft/docker-provider/tree/ci_prod/source/plugins/go/"
    click PluginsRuby "https://github.com/microsoft/docker-provider/tree/ci_prod/source/plugins/ruby/"
    click HelmCharts "https://github.com/microsoft/docker-provider/tree/ci_prod/charts/azuremonitor-containers/"
    click HelmCharts "https://github.com/microsoft/docker-provider/tree/ci_prod/charts/azuremonitor-containers-geneva/"
    click LinuxDS "https://github.com/microsoft/docker-provider/tree/ci_prod/kubernetes/linux/"
    click WindowsDS "https://github.com/microsoft/docker-provider/tree/ci_prod/kubernetes/windows/"
    click ArcExtension "https://github.com/microsoft/docker-provider/tree/ci_prod/deployment/arc-k8s-extension/"
    click ArcExtension "https://github.com/microsoft/docker-provider/tree/ci_prod/deployment/arc-k8s-extension-release-v2/"
    click Onboard "https://github.com/microsoft/docker-provider/tree/ci_prod/scripts/onboarding/"
    click Troubleshoot "https://github.com/microsoft/docker-provider/tree/ci_prod/scripts/troubleshoot/"
    click UnitTests "https://github.com/microsoft/docker-provider/tree/ci_prod/test/unit-tests/"
    click E2E "https://github.com/microsoft/docker-provider/tree/ci_prod/test/e2e/"
    click E2E "https://github.com/microsoft/docker-provider/tree/ci_prod/test/ginkgo-e2e/"
    click ScenarioScale "https://github.com/microsoft/docker-provider/tree/ci_prod/test/scenario/"
    click ScenarioScale "https://github.com/microsoft/docker-provider/tree/ci_prod/test/containerlog-scale-tests/"
    click ScenarioScale "https://github.com/microsoft/docker-provider/tree/ci_prod/test/networkflow-scale-tests/"
    click ARMAlerts "https://github.com/microsoft/docker-provider/tree/ci_prod/alerts/recommended_alerts_ARM/"
    click Documentation "https://github.com/microsoft/docker-provider/tree/ci_prod/Documentation/"

    %% Styles
    classDef build fill:#cfe2f3,stroke:#0366d6
    classDef deploy fill:#d9ead3,stroke:#38761d
    classDef runtime fill:#f9cb9c,stroke:#b45f06
    classDef azure fill:#d9d2e9,stroke:#674ea7
    classDef test fill:#f2f2f2,stroke:#7f7f7f
    classDef scripts fill:#fff2cc,stroke:#bf9000
    classDef external fill:#ffffff,stroke:#000000,stroke-dasharray: 2 2
```
