5.9 KiB
5.9 KiB
AGENTS.md
Read order:
/AGENTS.md- nearest nested
AGENTS.md /docs/standards/infra/STYLE.md(normative labels/naming/ports/images/resources — always read before any manifest work)- relevant
/docs/standards/infra/** - relevant
/docs/examples/infra/** - current request
WARNING TO AI AGENTS: You MUST READ the files in
/docs/standards/infra/and/docs/examples/infra/using your file reading tools BEFORE proposing or writing any K8s manifests. DO NOT rely on generic Kubernetes knowledge. The standard documents contain mandatory strict rules (e.g., probe settings, security contexts, non-root constraints, resource limits, namespace strategies) that MUST be hardcoded into your output. Generating plain boilerplate YAML without strict standards compliance is a critical failure.
Repo role:
- this repository owns infrastructure lifecycle and Kubernetes/K3s desired state
- source of truth is Git + IaC under
infrastructure/+ Kustomize undergitops/ - scripts are helper tools, not the source of truth
- runtime cluster state or server-local manifest files are not authoritative
Primary directories:
bootstrap/: foundation and selected GitOps controller bootstrapinfrastructure/components/: reusable IaC primitivesinfrastructure/stacks/: optional reusable compositionsinfrastructure/live/: the only IaC plan/apply and state entrypointsgitops/apps/: app-owned workloads, data, and one-shot operationsgitops/platform/: shared services, operators, ingress, mesh, storage, and secret deliverygitops/policies/: reusable governance and security policygitops/tenants/: namespace, RBAC, quota, and tenant boundariesgitops/clusters/<env>/<cluster>/namespacesandstages/: current deployable Kubernetes entrypointsgitops/clusters/<env>/<cluster>/all/: render/audit aggregate; never apply itscripts/: render, diff, apply, validate, backup, and restore helpersdocs/standards/infra/: infra standardsdocs/examples/infra/: approved examples
Current runtime exception:
labhas no Argo CD/Flux controller;scripts/bin/bootstrap.shapplies the clusternamespacesentrypoint and orderedstages/*;all/remains audit-only
Structure principle:
- catalogs are organized by ownership; every unit may contain an environment-neutral
baseand focusedoverlays/<env> - catalog directories are never deployment/controller roots
infrastructure/liveandgitops/clustersare environment-first entrypoint trees- current
labrollout ownership lives undergitops/clusters/lab/main/namespacesandgitops/clusters/lab/main/stages _templateis copied to start new units and is never imported by live/cluster roots- approved manifest examples live only under
docs/examples/infra
Hard bans:
- do not treat
/var/lib/rancher/k3s/server/manifestsas source of truth - do not edit K3s packaged component manifests directly
- do not put production secrets in Git/plain manifests
- do not bypass Kustomize with ad-hoc generated YAML as the primary path
- do not mix app rollout, DB migration, and control-plane upgrade in one opaque step
- do not apply
gitops/clusters/<env>/<cluster>/all; deploy ordered stage entrypoints - do not expose health, metrics, admin, or management endpoints publicly by default
- do not use
hostPathas an operating default - do not use
start-dev/dev-mode style configs for production components - do not rely on default namespace for production workloads
Global routing:
- environment / namespace / source-of-truth / K3s packaged components
->
/docs/standards/infra/architecture-environments.md - config / secret / Vault delivery strategy
->
/docs/standards/infra/config-and-secrets.md - workload kind selection
->
/docs/standards/infra/workload-selection.md - storage / PVC / storage class / retention
->
/docs/standards/infra/storage-pvc.md - network / service / ingress / TLS
->
/docs/standards/infra/network-ingress-tls.md - resources / probes / quota / PDB / HPA
->
/docs/standards/infra/resources-probes-availability.md - backup / restore
->
/docs/standards/infra/backup-restore.md - security hardening / RBAC / network policy / pod security
->
/docs/standards/infra/security-hardening.md - operational procedure / upgrade / rollback
->
/docs/standards/infra/operations-runbook-upgrade-rollback.md - observability / health / metrics / logs
->
/docs/standards/infra/observability-health.md - database / PostgreSQL / migration ownership / Flyway flow
->
/docs/standards/infra/db-and-migration.md - K3s-only rules
->
/docs/standards/infra/k3s-specific.md - scripts structure and shell rules
->
/docs/standards/infra/scripts.md - Kustomize structure and overlay rules
->
/docs/standards/infra/kustomize.md
Component routing:
- Keycloak
->
/docs/standards/infra/keycloak.md - Vault
->
/docs/standards/infra/vault.md - MinIO
->
/docs/standards/infra/minio.md - Flyway
->
/docs/standards/infra/flyway.md
Before editing:
- identify target environment: lab / staging / prod
- identify target unit: app / data / platform / operation / script / docs
- identify whether the change belongs in
bootstrap,infrastructure, agitopscatalog,gitops/clusters,scripts, or docs - identify workload type: Deployment / StatefulSet / Job / CronJob
- identify whether storage, secret delivery, ingress, migration, or rollback path changes
- identify whether the change touches a K3s-specific rule
Default execution flow:
- read the owning standard first
- prefer changing IaC/Kustomize source under
infrastructure/orgitops/over live state - prefer render -> validate -> diff -> apply thinking
- prefer explicit rollback/restore path before risky changes
If the request touches multiple areas, use this priority:
k3s-specific.mdarchitecture-environments.mddb-and-migration.md- the directly relevant component standard
- supporting standards such as storage / security / operations / observability