# rajinikanthvadla-ai/aiops-slack-chat-project architecture

> Architecture diagram of the GitHub repository rajinikanthvadla-ai/aiops-slack-chat-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajinikanthvadla-ai/aiops-slack-chat-project
- Repository: https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project

## Overview

1. **What this repo is**
   - This is a containerized Slack bot for Kubernetes operations.
   - The core architecture is a small Python application that sits between three external systems: Slack, the Kubernetes API, and Google Gemini for analysis.

2. **Primary runtime entrypoint**
   - `main.py` is the application entrypoint.
   - It likely bootstraps configuration, logging, and the Slack bot runtime, then starts the long-lived process inside the container.

3. **Slack-facing subsystem**
   - `src/slack_bot.py` is the interaction layer for Slack events and messages.
   - The README indicates Socket Mode and bot token-based auth, so the bot listens for mentions/DMs and replies in channels rather than exposing a public webhook.
   - Channel access is restricted through `ALLOWED_CHANNELS`, which is a key policy boundary.

4. **Natural-language command layer**
   - `src/command_parser.py` converts free-form user requests like “show me pods in kube-system” into structured actions.
   - This is the main request-routing boundary: it decides whether a message is a namespace listing, pod query, log retrieval, describe command, or cluster-status request.

5. **Kubernetes operations layer**
   - `src/kubernetes_executor.py` is the cluster access layer.
   - It is responsible for read-only Kubernetes API calls such as listing namespaces, pods, services, fetching logs, describing resources, and gathering cluster health data.
   - This subsystem is intentionally constrained by RBAC, which makes it the security boundary for all cluster interactions.

6. **AI analysis layer**
   - `src/llm_analyzer.py` takes raw operational output, especially logs and cluster-state data, and turns it into health summaries, issue detection, root-cause hints, and remediation guidance.
   - The README shows that Gemini is the external model provider, so the bot has a second outbound dependency besides Kubernetes and Slack.
   - This analysis stage is additive: it does not execute changes, only interprets data and recommends actions.

7. **Configuration boundary**
   - `src/config.py` centralizes environment-driven settings such as Slack tokens, Gemini API key, allowed channels, default namespace, debug mode, and port.
   - This file is likely the single source of truth for runtime configuration, keeping secrets and deployment-specific values out of the code path.

8. **End-to-end data flow**
   - A Slack message enters the bot.
   - The message is filtered by bot/channel policy, then parsed into an intent.
   - If it maps to a Kubernetes command, the executor queries the cluster.
   - If the command includes logs or health data, the raw output is passed to the LLM analyzer.
   - The final response is formatted and sent back to Slack.

9. **Infrastructure and deployment model**
   - The bot is designed to run in Kubernetes using the manifests under `kubernetes/`.
   - `deployment.yaml` defines the workload, `service.yaml` exposes the pod internally, `rbac.yaml` grants least-privilege read access, and `secrets.yaml` stores credentials.
   - The README’s health endpoints and port 3000 suggest the container also exposes internal readiness/health checks for Kubernetes probes and monitoring.

10. **Security and access model**
   - The repo is explicitly read-only: no mutating Kubernetes actions are part of the intended architecture.
   - Security relies on three gates: Slack channel allowlisting, Kubernetes RBAC, and Kubernetes Secrets for credentials.
   - The bot is intended to run as a non-root container, which is part of the operational trust boundary.

11. **Supporting scripts and ops workflow**
   - `scripts/healthcheck.py` and `scripts/cleanup.sh` support operational validation and teardown.
   - `killercoda-quickstart.sh` appears to automate demo or lab deployment, tying together build, cluster setup, and app installation.
   - `QUICKSTART.md` and the README document the operator workflow, but they do not change the runtime architecture.

12. **Containerization and packaging**
   - `Dockerfile` packages the Python app for deployment.
   - `requirements.txt` captures the Python dependencies, which are likely Slack SDK, Kubernetes client, and Gemini-related libraries.
   - The architecture is therefore: Python service in a container, deployed to Kubernetes, interacting with Slack over the network and with the cluster through the in-cluster service account.

13. **Important architectural boundaries to draw**
   - External user boundary: Slack users in allowed channels.
   - Application boundary: Slack event handling and command parsing.
   - Cluster boundary: Kubernetes API access under RBAC-limited service account.
   - AI boundary: outbound analysis requests to Gemini.
   - Operational boundary: health/readiness endpoints and Kubernetes probes.

14. **What is intentionally not in the system**
   - There is no evidence of a database, job queue, or persistent state layer.
   - The bot appears stateless beyond runtime configuration and live API calls, which keeps the diagram simple: message in, cluster query, optional AI analysis, response out.

Main entry points: [`src/slack_bot.py`](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/slack_bot.py) (Slack bot), [`kubernetes/deployment.yaml`](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/deployment.yaml) (Deployment), [`src/kubernetes_executor.py`](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/kubernetes_executor.py) (K8s exec), [`src/llm_analyzer.py`](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/llm_analyzer.py) (LLM analyzer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main["main<br/>entrypoint<br/>[main.py]"]
  node_config["Config<br/>settings<br/>[config.py]"]
  node_slack_bot["Slack bot<br/>event handler<br/>[slack_bot.py]"]
  node_parser["Parser<br/>intent router<br/>[command_parser.py]"]
end

subgraph group_integrations["Integrations"]
  node_k8s_exec[("K8s exec<br/>cluster client")]
  node_llm{{"LLM analyzer<br/>ai analysis<br/>[llm_analyzer.py]"}}
  node_slack(("Slack<br/>external system"))
  node_kubernetes_api(("Kubernetes API<br/>external system"))
  node_gemini(("Gemini<br/>external model"))
end

subgraph group_deployment["Deployment"]
  node_dockerfile["Container<br/>image build"]
  node_deps["Deps<br/>python requirements<br/>[requirements.txt]"]
  node_deploy["Deployment<br/>k8s workload<br/>[deployment.yaml]"]
  node_service["Service<br/>[service.yaml]"]
  node_rbac["RBAC<br/>k8s permissions<br/>[rbac.yaml]"]
  node_secrets["Secrets<br/>k8s secret<br/>[secrets.yaml]"]
end

subgraph group_ops["Operations"]
  node_healthcheck["Healthcheck<br/>ops script<br/>[healthcheck.py]"]
  node_cleanup["Cleanup<br/>ops script<br/>[cleanup.sh]"]
  node_quickstart["Quickstart<br/>automation script"]
end

node_main -->|"loads"| node_config
node_main -->|"starts"| node_slack_bot
node_slack_bot -->|"connects to"| node_slack
node_slack_bot -->|"routes messages to"| node_parser
node_parser -->|"dispatches queries"| node_k8s_exec
node_parser -->|"dispatches analysis"| node_llm
node_k8s_exec -->|"calls"| node_kubernetes_api
node_k8s_exec -->|"supplies data to"| node_llm
node_llm -->|"calls"| node_gemini
node_slack_bot -->|"checks policy"| node_config
node_slack_bot -->|"executes commands"| node_k8s_exec
node_slack_bot -->|"summarizes results"| node_llm
node_dockerfile -->|"bundles"| node_deps
node_dockerfile -->|"runs"| node_main
node_deploy -->|"deploys image"| node_dockerfile
node_deploy -->|"exposes"| node_service
node_deploy -->|"uses"| node_rbac
node_deploy -->|"mounts"| node_secrets
node_healthcheck -->|"probes"| node_service
node_quickstart -.->|"installs"| node_deploy
node_cleanup -.->|"removes"| node_deploy

click node_main "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/main.py"
click node_config "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/config.py"
click node_slack_bot "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/slack_bot.py"
click node_parser "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/command_parser.py"
click node_k8s_exec "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/kubernetes_executor.py"
click node_llm "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/llm_analyzer.py"
click node_dockerfile "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/tree/main/Dockerfile"
click node_deps "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/requirements.txt"
click node_deploy "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/deployment.yaml"
click node_service "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/service.yaml"
click node_rbac "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/rbac.yaml"
click node_secrets "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/secrets.yaml"
click node_healthcheck "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/scripts/healthcheck.py"
click node_cleanup "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/scripts/cleanup.sh"
click node_quickstart "https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/killercoda-quickstart.sh"

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_main,node_config,node_slack_bot,node_parser toneBlue
class node_k8s_exec,node_llm,node_slack,node_kubernetes_api,node_gemini toneAmber
class node_dockerfile,node_deps,node_deploy,node_service,node_rbac,node_secrets toneMint
class node_healthcheck,node_cleanup,node_quickstart toneRose
```

## Components

### Runtime

Core Python application and request handling

- [main](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/main.py): entrypoint · Bootstraps config, logging, and the bot runtime · `main.py`
- [Config](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/config.py): settings · Environment-driven runtime settings and secrets wiring · `src/config.py`
- [Slack bot](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/slack_bot.py): event handler · Receives Slack events, enforces channel policy, and sends replies · `src/slack_bot.py`
- [Parser](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/command_parser.py): intent router · Converts free-form requests into structured command intents · `src/command_parser.py`

### Integrations

External systems and service boundaries

- [K8s exec](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/kubernetes_executor.py): cluster client · Runs read-only Kubernetes API operations and gathers cluster state · `src/kubernetes_executor.py`
- [LLM analyzer](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/src/llm_analyzer.py): ai analysis · Summarizes logs and cluster data into findings and guidance · `src/llm_analyzer.py`
- **Slack**: external system · Slack users, channels, and Socket Mode delivery
- **Kubernetes API**: external system · Cluster control plane accessed through least-privilege RBAC
- **Gemini**: external model · Outbound model provider for operational analysis

### Deployment

Container, Kubernetes manifests, and operational setup

- [Container](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/tree/main/Dockerfile): image build · Packages the Python service for container deployment · `Dockerfile`
- [Deps](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/requirements.txt): python requirements · Python dependency set for Slack, Kubernetes, and AI integration · `requirements.txt`
- [Deployment](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/deployment.yaml): k8s workload · Runs the bot container in Kubernetes · `kubernetes/deployment.yaml`
- [Service](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/service.yaml): k8s service · Internal service endpoint for the pod · `kubernetes/service.yaml`
- [RBAC](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/rbac.yaml): k8s permissions · Read-only cluster permissions for the service account · `kubernetes/rbac.yaml`
- [Secrets](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/kubernetes/secrets.yaml): k8s secret · Stores credentials and API keys for runtime access · `kubernetes/secrets.yaml`

### Operations

Health checks, cleanup, and quickstart automation

- [Healthcheck](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/scripts/healthcheck.py): ops script · Validates container and service readiness · `scripts/healthcheck.py`
- [Cleanup](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/scripts/cleanup.sh): ops script · Removes demo or lab resources · `scripts/cleanup.sh`
- [Quickstart](https://github.com/rajinikanthvadla-ai/aiops-slack-chat-project/blob/main/killercoda-quickstart.sh): automation script · Automates demo deployment and setup · `killercoda-quickstart.sh`

## Connections

- main → Config: loads · Initial runtime configuration
- main → Slack bot: starts · Launches the long-lived bot process
- Slack bot → Slack: connects to · Receives and sends Slack messages
- Slack bot → Parser: routes messages to · Turns user text into structured intents
- Parser → K8s exec: dispatches queries · Maps intents to cluster operations
- Parser → LLM analyzer: dispatches analysis · Selects AI-backed interpretation when needed
- K8s exec → Kubernetes API: calls · Performs read-only cluster queries
- K8s exec → LLM analyzer: supplies data to · Passes logs and state for analysis
- LLM analyzer → Gemini: calls · Sends analysis prompts and data
- Slack bot → Config: checks policy · Uses allowed channels and runtime settings
- Slack bot → K8s exec: executes commands · Invokes Kubernetes reads on behalf of users
- Slack bot → LLM analyzer: summarizes results · Adds AI-generated operational insight
- Container → Deps: bundles · Builds the runtime image from Python dependencies
- Container → main: runs · Container entrypoint starts the app
- Deployment → Container: deploys image · Kubernetes workload uses the built container
- Deployment → Service: exposes · Creates an internal service for the pod
- Deployment → RBAC: uses · Attaches least-privilege permissions
- Deployment → Secrets: mounts · Injects runtime credentials
- Healthcheck → Service: probes · Checks readiness and liveness surfaces
- Quickstart → Deployment: installs · Automates demo deployment workflow
- Cleanup → Deployment: removes · Tears down demo resources
