# anjon/kafka-automation architecture

> Architecture diagram of the GitHub repository anjon/kafka-automation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anjon/kafka-automation
- Repository: https://github.com/anjon/kafka-automation

## Overview

1. This repository is not a service application; it is an automation toolkit for managing a Kafka cluster. The core intent is to apply declarative changes for Kafka topics and ACLs.

2. The main functional split is between two Python entrypoints:
   - `topics_manager.py` for topic lifecycle/administration
   - `acls_manager.py` for access-control administration  
   These are the primary execution units and likely the scripts you run directly or from CI.

3. The desired state for Kafka is described in YAML files:
   - `topics_descriptor.yml`
   - `acls_descriptor.yml`  
   These act as configuration inputs, separating “what should exist” from “how to create/update it.”

4. The data flow is straightforward: descriptor YAML is read by the corresponding manager script, which then talks to the Kafka cluster to apply changes. The cluster is an external dependency; this repo appears to automate an existing Kafka environment rather than host one.

5. CI/CD is a major architectural boundary. The repository includes:
   - `Jenkinsfile`
   - `Jenkinsfile-QA`
   - `jobs/Jenkinsfile-multiEnv`  
   This suggests the scripts are intended to run in multiple environments, with Jenkins orchestrating validation and deployment-like operations.

6. Containerization is built in for reproducibility:
   - `Dockerfile`
   - `docker-compose.yml`  
   These likely package the Python runtime and dependencies so the automation can run consistently in local, QA, or pipeline contexts.

7. The Python toolchain is modern and locked down:
   - `pyproject.toml`
   - `uv.lock`
   - `.python-version`  
   This indicates dependency and interpreter version management is explicit, which matters for deterministic automation runs.

8. The repository has two clear layers of concern:
   - declarative definitions (`*.yml`)
   - imperative execution (`*_manager.py`)  
   That separation is important for architecture diagrams because it shows configuration does not directly couple to pipeline logic.

9. The external system boundary is Apache Kafka itself. The repo’s job is to manage cluster objects such as topics and ACLs, not to provide a message producer/consumer application.

10. Operationally, the likely control plane is Jenkins running Python inside Docker, using the YAML descriptors as inputs, and applying changes to Kafka. The QA and multi-environment Jenkinsfiles imply environment-specific behavior is part of the design.

11. Supporting files like `LICENSE` and `.gitignore` are present, but they do not materially affect runtime architecture.

12. For an architecture diagram, the important boxes are:
   - CI orchestrator: Jenkins
   - Runtime: Docker/Python 3.14
   - Automation scripts: topics and ACL managers
   - Declarative config: descriptor YAMLs
   - Target system: Kafka cluster  
   The main arrows are “Jenkins triggers containerized Python scripts” and “scripts read descriptors and update Kafka.”

Main entry points: [`topics_manager.py`](https://github.com/anjon/kafka-automation/blob/main/topics_manager.py) (Topics mgr), [`acls_manager.py`](https://github.com/anjon/kafka-automation/blob/main/acls_manager.py) (ACLs mgr), [`pyproject.toml`](https://github.com/anjon/kafka-automation/blob/main/pyproject.toml) (pyproject), [`Dockerfile`](https://github.com/anjon/kafka-automation/tree/main/Dockerfile) (Dockerfile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_ci["CI/CD"]
  node_node_jenkins_main["Jenkinsfile<br/>pipeline"]
  node_node_jenkins_qa["Jenkins QA<br/>pipeline"]
  node_node_jenkins_multienv["MultiEnv<br/>pipeline"]
end

subgraph group_group_runtime["Runtime"]
  node_node_dockerfile["Dockerfile<br/>container build"]
  node_node_compose["Compose<br/>local runtime<br/>[docker-compose.yml]"]
  node_node_pyproject["pyproject<br/>python package<br/>[pyproject.toml]"]
  node_node_uvlock["uv.lock<br/>dependency lock<br/>[uv.lock]"]
  node_node_pythonver[".python-version<br/>toolchain pin<br/>[.python-version]"]
end

subgraph group_group_automation["Automation"]
  node_node_topics_mgr["Topics mgr<br/>topic automation<br/>[topics_manager.py]"]
  node_node_acls_mgr["ACLs mgr<br/>acl automation<br/>[acls_manager.py]"]
end

subgraph group_group_config["Desired State"]
  node_node_topics_desc["Topics YAML<br/>topic descriptor"]
  node_node_acls_desc["ACLs YAML<br/>acl descriptor"]
end

subgraph group_group_external["External System"]
  node_node_kafka[("Kafka cluster<br/>external broker")]
end

node_node_jenkins_main -->|"runs"| node_node_topics_mgr
node_node_jenkins_main -->|"runs"| node_node_acls_mgr
node_node_jenkins_qa -->|"runs"| node_node_topics_mgr
node_node_jenkins_qa -->|"runs"| node_node_acls_mgr
node_node_jenkins_multienv -->|"orchestrates"| node_node_topics_mgr
node_node_jenkins_multienv -->|"orchestrates"| node_node_acls_mgr
node_node_dockerfile -->|"packages"| node_node_topics_mgr
node_node_dockerfile -->|"packages"| node_node_acls_mgr
node_node_compose -->|"builds"| node_node_dockerfile
node_node_pyproject -->|"depends on"| node_node_topics_mgr
node_node_pyproject -->|"depends on"| node_node_acls_mgr
node_node_uvlock -->|"locks"| node_node_pyproject
node_node_pythonver -->|"pins"| node_node_pyproject
node_node_topics_desc -->|"inputs"| node_node_topics_mgr
node_node_acls_desc -->|"inputs"| node_node_acls_mgr
node_node_topics_mgr -->|"applies"| node_node_kafka
node_node_acls_mgr -->|"applies"| node_node_kafka

click node_node_jenkins_main "https://github.com/anjon/kafka-automation/tree/main/Jenkinsfile"
click node_node_jenkins_qa "https://github.com/anjon/kafka-automation/tree/main/Jenkinsfile-QA"
click node_node_jenkins_multienv "https://github.com/anjon/kafka-automation/tree/main/jobs/Jenkinsfile-multiEnv"
click node_node_dockerfile "https://github.com/anjon/kafka-automation/tree/main/Dockerfile"
click node_node_compose "https://github.com/anjon/kafka-automation/blob/main/docker-compose.yml"
click node_node_pyproject "https://github.com/anjon/kafka-automation/blob/main/pyproject.toml"
click node_node_uvlock "https://github.com/anjon/kafka-automation/blob/main/uv.lock"
click node_node_pythonver "https://github.com/anjon/kafka-automation/blob/main/.python-version"
click node_node_topics_mgr "https://github.com/anjon/kafka-automation/blob/main/topics_manager.py"
click node_node_acls_mgr "https://github.com/anjon/kafka-automation/blob/main/acls_manager.py"
click node_node_topics_desc "https://github.com/anjon/kafka-automation/blob/main/topics_descriptor.yml"
click node_node_acls_desc "https://github.com/anjon/kafka-automation/blob/main/acls_descriptor.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_jenkins_main,node_node_jenkins_qa,node_node_jenkins_multienv toneBlue
class node_node_dockerfile,node_node_compose,node_node_pyproject,node_node_uvlock,node_node_pythonver toneAmber
class node_node_topics_mgr,node_node_acls_mgr toneMint
class node_node_topics_desc,node_node_acls_desc toneRose
class node_node_kafka toneIndigo
```

## Components

### CI/CD

Jenkins orchestration and environment-specific pipelines

- [Jenkinsfile](https://github.com/anjon/kafka-automation/tree/main/Jenkinsfile): pipeline · Primary CI pipeline entrypoint · `Jenkinsfile`
- [Jenkins QA](https://github.com/anjon/kafka-automation/tree/main/Jenkinsfile-QA): pipeline · QA-specific CI pipeline · `Jenkinsfile-QA`
- [MultiEnv](https://github.com/anjon/kafka-automation/tree/main/jobs/Jenkinsfile-multiEnv): pipeline · Multi-environment Jenkins job definition · `jobs/Jenkinsfile-multiEnv`

### Runtime

Containerized Python execution and dependency pinning

- [Dockerfile](https://github.com/anjon/kafka-automation/tree/main/Dockerfile): container build · Builds the Python automation image · `Dockerfile`
- [Compose](https://github.com/anjon/kafka-automation/blob/main/docker-compose.yml): local runtime · Local container orchestration for running the toolkit · `docker-compose.yml`
- [pyproject](https://github.com/anjon/kafka-automation/blob/main/pyproject.toml): python package · Project metadata and dependency definition · `pyproject.toml`
- [uv.lock](https://github.com/anjon/kafka-automation/blob/main/uv.lock): dependency lock · Pinned Python dependency resolution · `uv.lock`
- [.python-version](https://github.com/anjon/kafka-automation/blob/main/.python-version): toolchain pin · Pinned Python interpreter version · `.python-version`

### Automation

Imperative scripts that apply Kafka changes

- [Topics mgr](https://github.com/anjon/kafka-automation/blob/main/topics_manager.py): topic automation · Applies topic lifecycle and administration changes · `topics_manager.py`
- [ACLs mgr](https://github.com/anjon/kafka-automation/blob/main/acls_manager.py): acl automation · Applies access-control changes · `acls_manager.py`

### Desired State

Declarative Kafka definitions consumed by the automation

- [Topics YAML](https://github.com/anjon/kafka-automation/blob/main/topics_descriptor.yml): topic descriptor · Declarative desired state for Kafka topics · `topics_descriptor.yml`
- [ACLs YAML](https://github.com/anjon/kafka-automation/blob/main/acls_descriptor.yml): acl descriptor · Declarative desired state for Kafka ACLs · `acls_descriptor.yml`

### External System

Target Kafka cluster managed by this repository

- **Kafka cluster**: external broker · External Kafka environment being managed

## Connections

- Jenkinsfile → Topics mgr: runs · Main pipeline executes topic management automation
- Jenkinsfile → ACLs mgr: runs · Main pipeline executes ACL management automation
- Jenkins QA → Topics mgr: runs · QA pipeline executes topic management automation
- Jenkins QA → ACLs mgr: runs · QA pipeline executes ACL management automation
- MultiEnv → Topics mgr: orchestrates · Multi-environment job drives topic changes
- MultiEnv → ACLs mgr: orchestrates · Multi-environment job drives ACL changes
- Dockerfile → Topics mgr: packages · Container image provides runtime for topic automation
- Dockerfile → ACLs mgr: packages · Container image provides runtime for ACL automation
- Compose → Dockerfile: builds · Compose references the containerized runtime
- pyproject → Topics mgr: depends on · Python project metadata defines runtime dependencies
- pyproject → ACLs mgr: depends on · Python project metadata defines runtime dependencies
- uv.lock → pyproject: locks · Locked dependency set corresponds to project metadata
- .python-version → pyproject: pins · Interpreter version constrains the Python toolchain
- Topics YAML → Topics mgr: inputs · Descriptor YAML is consumed by topic automation
- ACLs YAML → ACLs mgr: inputs · Descriptor YAML is consumed by ACL automation
- Topics mgr → Kafka cluster: applies · Topic manager mutates the Kafka cluster state
- ACLs mgr → Kafka cluster: applies · ACL manager mutates the Kafka cluster state
