# amhiraq/pfa-repo architecture

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

- Interactive diagram: https://gitdiagram.com/amhiraq/pfa-repo
- Repository: https://github.com/amhiraq/pfa-repo

## Overview

PFA is an infrastructure-as-code repository for deploying a secured, observable Kubernetes cluster. The principal workflow is operator-triggered Terraform provisioning, Ansible cluster setup, then ArgoCD synchronization of security and monitoring resources from GitHub. The graph also preserves the documented metrics, logging, and security-scanning capabilities. Source excerpts were unavailable, so relationships are limited to those explicitly described in the README.

Main entry points: [`argocd/argocd-application`](https://github.com/amhiraq/pfa-repo/blob/main/argocd/argocd-application) (ArgoCD), [`helm-charts/grafana-chart`](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/grafana-chart) (Grafana), [`helm-charts/promtail-chart`](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/promtail-chart) (Promtail), [`helm-charts/prometheus-chart`](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/prometheus-chart) (Prometheus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_infrastructure["Infrastructure"]
  node_terraform["Terraform Infrastructure"]
  node_aws["AWS Resources"]
end

subgraph group_cluster["Cluster Setup"]
  node_ansible["Ansible Provisioning<br/>[install-k8s.yml]"]
  node_kubernetes["Kubernetes Cluster"]
end

subgraph group_gitops["GitOps and Security"]
  node_argocd["ArgoCD"]
  node_gitrepo["GitHub Repository"]
  node_psa["Pod Security Admission"]
  node_rbac["RBAC Roles<br/>[rbac-roles.yaml]"]
  node_kyverno["Kyverno Policies<br/>[policies.yaml]"]
  node_exceptions["Policy Exceptions"]
end

subgraph group_observability["Observability"]
  node_prometheus["Prometheus"]
  node_nodeexporter["Node Exporter"]
  node_grafana["Grafana"]
  node_loki["Loki"]
  node_promtail["Promtail"]
  node_podlogs[("Pod Logs")]
end

subgraph group_scanning["Security Scanning"]
  node_actions["GitHub Actions<br/>[security-scan.yml]"]
  node_scanners["tfsec and Trivy<br/>[security-scan.yml]"]
end

node_operator(("Operator"))
node_prpush(("PR or Push"))

node_operator -->|"runs apply"| node_terraform
node_terraform -->|"provisions"| node_aws
node_operator -->|"runs playbook"| node_ansible
node_ansible -->|"provisions cluster"| node_kubernetes
node_argocd -->|"syncs from"| node_gitrepo
node_argocd -->|"deploys"| node_psa
node_argocd -->|"deploys"| node_rbac
node_argocd -->|"deploys"| node_kyverno
node_argocd -->|"deploys"| node_prometheus
node_argocd -->|"deploys"| node_grafana
node_argocd -->|"deploys"| node_loki
node_argocd -->|"deploys"| node_promtail
node_prometheus -->|"scrapes metrics"| node_nodeexporter
node_promtail -->|"collects"| node_podlogs
node_promtail -->|"sends logs"| node_loki
node_grafana -->|"queries datasource"| node_prometheus
node_grafana -->|"queries datasource"| node_loki
node_prpush -->|"triggers"| node_actions
node_actions -->|"runs scans"| node_scanners

click node_terraform "https://github.com/amhiraq/pfa-repo/tree/main/terraform"
click node_ansible "https://github.com/amhiraq/pfa-repo/blob/main/ansible/install-k8s.yml"
click node_argocd "https://github.com/amhiraq/pfa-repo/blob/main/argocd/argocd-application"
click node_psa "https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/psa/psa-namespaces.yaml"
click node_rbac "https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/rbac/rbac-roles.yaml"
click node_kyverno "https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/kyverno/policies.yaml"
click node_exceptions "https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/kyverno/policy-exceptions.yaml"
click node_prometheus "https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/prometheus-chart"
click node_nodeexporter "https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/prometheus-chart"
click node_grafana "https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/grafana-chart"
click node_loki "https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/loki-chart"
click node_promtail "https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/promtail-chart"
click node_actions "https://github.com/amhiraq/pfa-repo/blob/main/.github/workflows/security-scan.yml"
click node_scanners "https://github.com/amhiraq/pfa-repo/blob/main/.github/workflows/security-scan.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_terraform,node_aws toneBlue
class node_ansible,node_kubernetes toneAmber
class node_argocd,node_gitrepo,node_psa,node_rbac,node_kyverno,node_exceptions toneMint
class node_prometheus,node_nodeexporter,node_grafana,node_loki,node_promtail,node_podlogs toneRose
class node_actions,node_scanners,node_operator,node_prpush toneIndigo
```

## Components

### Infrastructure

- [Terraform Infrastructure](https://github.com/amhiraq/pfa-repo/tree/main/terraform): `terraform`
- **AWS Resources**

### Cluster Setup

- [Ansible Provisioning](https://github.com/amhiraq/pfa-repo/blob/main/ansible/install-k8s.yml): `ansible/install-k8s.yml`
- **Kubernetes Cluster**

### GitOps and Security

- [ArgoCD](https://github.com/amhiraq/pfa-repo/blob/main/argocd/argocd-application): `argocd/argocd-application`
- **GitHub Repository**
- [Pod Security Admission](https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/psa/psa-namespaces.yaml): `kubernetes/psa/psa-namespaces.yaml`
- [RBAC Roles](https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/rbac/rbac-roles.yaml): `kubernetes/rbac/rbac-roles.yaml`
- [Kyverno Policies](https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/kyverno/policies.yaml): `kubernetes/kyverno/policies.yaml`
- [Policy Exceptions](https://github.com/amhiraq/pfa-repo/blob/main/kubernetes/kyverno/policy-exceptions.yaml): `kubernetes/kyverno/policy-exceptions.yaml`

### Observability

- [Prometheus](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/prometheus-chart): `helm-charts/prometheus-chart`
- [Node Exporter](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/prometheus-chart): `helm-charts/prometheus-chart`
- [Grafana](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/grafana-chart): `helm-charts/grafana-chart`
- [Loki](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/loki-chart): `helm-charts/loki-chart`
- [Promtail](https://github.com/amhiraq/pfa-repo/tree/main/helm-charts/promtail-chart): `helm-charts/promtail-chart`
- **Pod Logs**

### Security Scanning

- [GitHub Actions](https://github.com/amhiraq/pfa-repo/blob/main/.github/workflows/security-scan.yml): `.github/workflows/security-scan.yml`
- [tfsec and Trivy](https://github.com/amhiraq/pfa-repo/blob/main/.github/workflows/security-scan.yml): `.github/workflows/security-scan.yml`

### Other components

- **Operator**
- **PR or Push**

## Connections

- Operator → Terraform Infrastructure: runs apply (evidence: `README.md`)
- Terraform Infrastructure → AWS Resources: provisions (evidence: `README.md`)
- Operator → Ansible Provisioning: runs playbook (evidence: `README.md`)
- Ansible Provisioning → Kubernetes Cluster: provisions cluster (evidence: `README.md`)
- ArgoCD → GitHub Repository: syncs from (evidence: `README.md`)
- ArgoCD → Pod Security Admission: deploys (evidence: `README.md`)
- ArgoCD → RBAC Roles: deploys (evidence: `README.md`)
- ArgoCD → Kyverno Policies: deploys (evidence: `README.md`)
- ArgoCD → Prometheus: deploys (evidence: `README.md`)
- ArgoCD → Grafana: deploys (evidence: `README.md`)
- ArgoCD → Loki: deploys (evidence: `README.md`)
- ArgoCD → Promtail: deploys (evidence: `README.md`)
- Prometheus → Node Exporter: scrapes metrics (evidence: `README.md`)
- Promtail → Pod Logs: collects (evidence: `README.md`)
- Promtail → Loki: sends logs (evidence: `README.md`)
- Grafana → Prometheus: queries datasource (evidence: `README.md`)
- Grafana → Loki: queries datasource (evidence: `README.md`)
- PR or Push → GitHub Actions: triggers (evidence: `README.md`)
- GitHub Actions → tfsec and Trivy: runs scans (evidence: `README.md`)
