Skip to content

Latest commit

 

History

History
131 lines (100 loc) · 5.17 KB

architecture.md

File metadata and controls

131 lines (100 loc) · 5.17 KB

Architecture

This repository is the declarative Kubernetes layer of the app-poly-gitops lab. It contains desired state only; provisioning and Argo CD bootstrap are owned by app-poly-gitops-infra.

Reconciliation model

flowchart LR
    Infra[Terraform and Argo CD bootstrap] --> Root[One root Application]
    Root --> GitOps[clusters/dev or clusters/smoke]
    GitOps --> Child[Child Applications and raw root resources]
    Helm[FastAPI Helm chart] --> Child
    Child --> API[Kubernetes API]
    API --> Controllers[Controllers]
    Controllers --> Workloads[Workloads]
Loading

An environment root renders Argo CD Application objects. Each child application then pulls a pinned chart or a versioned path and reconciles it into the in-cluster destination. Sync waves order Argo CD child applications; they do not replace readiness checks inside a child chart.

The verified bootstrap consumers are in app-poly-gitops-infra: its Taskfile creates Application/dev-cluster from the versioned app-of-apps.yaml, while the cloud smoke workflow creates Application/gitops-smoke-root. Retained dev reuses and repoints that same smoke root rather than creating a competing root. See ownership.md for the complete consumer table, dormant manual entrypoints, collision risks, and operator decisions.

Supported environment roots

Development

clusters/dev is the full application profile validated by CI. It includes:

  • namespace definitions;
  • ingress-nginx, cert-manager, and external-dns for the documented dev hosts;
  • Loki, Grafana, and a Vector OTLP gateway;
  • the FastAPI Helm release and CrewAI runtime.

FastAPI uses local SQLite in this profile. Database operators and custom database resources exist as optional building blocks but are not included by the dev root. The standalone UI repository is also not included.

Smoke

clusters/smoke is the bounded disposable profile used by the infrastructure acceptance workflow. It contains FastAPI, CrewAI, and a small Jaeger deployment. It has no public ingress, DNS automation, Grafana, Loki, or Vector.

Scaffolding

clusters/tst, clusters/stg, and clusters/prd are not in the CI Kustomize matrix. Their tenant secrets, destination setup, and operational procedures are incomplete. Treat them as scaffolding, not deployable environment contracts.

The ApplicationSets are also outside the supported roots. Several generate the same child Application names as dev, while the tenant ApplicationSet can create different Application names that manage the same FastAPI payload. They are migration scaffolds, not an additional controller plane that can safely run in parallel.

Application delivery

FastAPI is rendered from app-poly-gitops-helm. Environment overlays supply the image tag, provider URL/model, telemetry endpoint, resources, and existing Secret references. CrewAI is rendered from tenants/product-team/apps/crewai/runtime with environment telemetry patches.

Supported roots use explicit, reviewed chart and image pins. They do not run an automatic Git writer. The reusable Image Updater manifest remains under platform/gitops, and incomplete environment scaffolds still reference it, but activation requires a separate ownership design that writes to the environment desired-state repository rather than the Helm packaging repository.

Observability

The development profile sends OTLP/HTTP data to Vector:

FastAPI and CrewAI
  -> Vector gateway
     -> OTLP logs to Loki
     -> OTLP traces to structured console output
     -> metrics discarded

Grafana is configured with Loki as a data source. The development profile does not deploy Jaeger. The smoke profile instead sends traces directly to Jaeger and does not deploy the development observability stack.

Networking and secrets

The development profile declares three intended hosts:

  • argo.syncjob.ru
  • grafana.syncjob.ru
  • chat-dev.syncjob.ru

External DNS is restricted to annotated Ingresses in syncjob.ru, uses upsert-only policy, and tracks ownership with TXT records. cert-manager uses a Cloudflare DNS-01 issuer. Fresh cloudflare-token, grafana-admin, and chat-api-basic-auth Secrets must be created outside Git for a new cluster. The provider key for FastAPI and the LLM key for CrewAI are also runtime Secrets.

See DEV-WEBS.md for the security boundaries and exact Secret names. No secret value is stored in this repository.

Repository layout

clusters/                 environment entrypoints
platform/core/            namespaces, RBAC, and bootstrap applications
platform/infrastructure/  optional platform components
platform/observability/   dev and smoke telemetry components
platform/gitops/          Argo CD automation
tenants/                  application desired state
policies/                 OPA policy
tests/                    rendered-contract checks

Validation boundary

CI renders and validates only dev and smoke. A successful render proves the desired state can be assembled; it does not prove a cluster, DNS record, certificate, provider call, or telemetry backend is live.