# inovex/external-dns-openstack-webhook architecture

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

- Interactive diagram: https://gitdiagram.com/inovex/external-dns-openstack-webhook
- Repository: https://github.com/inovex/external-dns-openstack-webhook

## Overview

##### Project type and purpose
- This is a Go-based “webhook provider” plugin for the Kubernetes ExternalDNS system.
- Its sole responsibility is to accept DNS change requests from ExternalDNS (via HTTP) and translate them into API calls against an OpenStack Designate instance (using Gophercloud under the hood).

##### File structure
- Top‐level entrypoint: cmd/webhook/main.go → starts an HTTP server.
- internal/designate/provider → implements the ExternalDNS “Provider” interface, handling Create/Update/Delete record calls.
- internal/designate/client → encapsulates all low‐level calls to OpenStack Designate (and Keystone for auth).
- Config & packaging: goreleaser.yaml, Dockerfile, Makefile, Helm values are implied by the README.

##### README for additional insights
- Runs as a sidecar in the ExternalDNS pod via Helm.
- Configured by mounting a Secret containing clouds.yaml and an optional OS_CLOUD env var.
- ExternalDNS sends HTTP POST/GET/DELETE for record changes to this webhook.

a. Main components
1. ExternalDNS Core (running in Kubernetes)
2. Webhook Provider Container (sidecar)
- HTTP Server (listens on /records)
- Provider Logic (internal/designate/provider)
- Designate Client (internal/designate/client)
3. Configuration Source (Kubernetes Secret → clouds.yaml)
4. OpenStack Keystone (Identity service)
5. OpenStack Designate (DNS service)
b. Relationships & data flow
1. ExternalDNS Core issues DNS‐Change HTTP requests → Webhook HTTP Server.
2. Webhook Provider Logic transforms requests → invokes Designate Client.
3. Designate Client authenticates against Keystone → obtains token.
4. Designate Client calls Designate API → manages DNS records.
5. Responses bubble back along the same path → ExternalDNS.
6. Configuration (clouds.yaml) is read at startup and periodically reloaded if desired.
c. Architectural patterns & principles
- Sidecar pattern: co‐located with ExternalDNS in the same Pod.
- “Adapter” pattern: Provider Logic adapts ExternalDNS interface to Designate API.
- Layered separation: HTTP layer → Business Logic layer → Client/Transport layer → External system.
- Immutable configuration via mounted Secret (clouds.yaml).
d. Key technologies & frameworks
- Golang (modules)
- Gophercloud (OpenStack client library)
- Kubernetes Webhook Provider model (HTTP callbacks)
- Helm for deployment

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Kubernetes Pod with containers
    subgraph "Kubernetes Pod"
        direction TB
        ExternalDNSCore["ExternalDNS Core"]:::container
        subgraph "Webhook Provider Container"
            direction TB
            HTTPServer["Webhook HTTP Server"]:::container
            ProviderLogic["Provider Logic"]:::container
            DesignateClient["Designate Client"]:::container
        end
    end

    %% External systems
    Keystone["OpenStack Keystone"]:::external
    Designate["OpenStack Designate"]:::external

    %% Configuration
    ConfigSecret["Kubernetes Secret\n(clouds.yaml)"]:::config

    %% Project Files
    subgraph "Project Files"
        direction TB
        GoreleaserYML[".goreleaser.yaml"]
        Dockerfile["goreleaser.dockerfile"]
        MakefileNode["Makefile"]
        GoMod["go.mod"]
        GoSum["go.sum"]
        GoCI[".github/workflows/go.yml"]
        DevStackCI[".github/workflows/devstack.yml"]
        Dependabot[".github/dependabot.yml"]
        README["README.md"]
    end

    %% Data Flows
    ExternalDNSCore -->|"HTTP POST/GET/DELETE"| HTTPServer
    HTTPServer -->|"calls interface"| ProviderLogic
    ProviderLogic -->|"invokes client"| DesignateClient
    DesignateClient -->|"auth request"| Keystone
    DesignateClient -->|"DNS API call"| Designate
    Designate -->|response| DesignateClient
    Keystone -->|token| DesignateClient
    DesignateClient -->|result| ProviderLogic
    ProviderLogic -->|response| HTTPServer
    HTTPServer -->|response| ExternalDNSCore

    %% Configuration flow
    ConfigSecret -.->|"mounts clouds.yaml"| HTTPServer

    %% Click Events
    click HTTPServer "https://github.com/inovex/external-dns-openstack-webhook/blob/main/cmd/webhook/main.go"
    click ProviderLogic "https://github.com/inovex/external-dns-openstack-webhook/blob/main/internal/designate/provider/provider.go"
    click DesignateClient "https://github.com/inovex/external-dns-openstack-webhook/blob/main/internal/designate/client/client.go"
    click GoreleaserYML "https://github.com/inovex/external-dns-openstack-webhook/blob/main/.goreleaser.yaml"
    click Dockerfile "https://github.com/inovex/external-dns-openstack-webhook/blob/main/goreleaser.dockerfile"
    click MakefileNode "https://github.com/inovex/external-dns-openstack-webhook/tree/main/Makefile"
    click GoMod "https://github.com/inovex/external-dns-openstack-webhook/blob/main/go.mod"
    click GoSum "https://github.com/inovex/external-dns-openstack-webhook/blob/main/go.sum"
    click GoCI "https://github.com/inovex/external-dns-openstack-webhook/blob/main/.github/workflows/go.yml"
    click DevStackCI "https://github.com/inovex/external-dns-openstack-webhook/blob/main/.github/workflows/devstack.yml"
    click Dependabot "https://github.com/inovex/external-dns-openstack-webhook/blob/main/.github/dependabot.yml"
    click README "https://github.com/inovex/external-dns-openstack-webhook/blob/main/README.md"

    %% Styles
    classDef container fill:#D0E1F9,stroke:#333,stroke-width:1px
    classDef external fill:#F9D5E5,stroke:#333,stroke-width:1px
    classDef config fill:#D5F9D8,stroke:#333,stroke-width:1px
    classDef default fill:#EFEFEF,stroke:#333,stroke-width:1px
    class GoreleaserYML,Dockerfile,MakefileNode,GoMod,GoSum,GoCI,DevStackCI,Dependabot,README default
```
