Files
devops-infra-argo-config-gcp/claude/05-naming-conventions.md
T
2026-08-26 04:03:34 +05:30

87 lines
3.8 KiB
Markdown

> Per [AI Blitz Plan §6](../docs/global/AGENT_BOUNDARIES.md). Layer: 1-T.
# 05 — Naming Conventions
Naming in this repo is **structural** — names are routing identifiers used by ArgoCD, not cosmetic labels. A mismatch between a filename, `metadata.name`, and `clusterSpec.destination.name` can cause silent misrouting. See [SANCTITY_RULES.md R9](../docs/global/SANCTITY_RULES.md).
## File naming
File naming and directory layout differ by environment:
| Env | Branch | Incubator dir | Incubator file prefix | Values dir |
| --- | ------ | ------------- | --------------------- | ---------- |
| prd | `main` | `incubator/prd/` | `incubator-infra-` | `values/prd/` |
| stg / dev (infra) | `develop` | `incubator/infra/` | `incubator-infra-` | `values/dev/` |
| stg / dev (apps) | `develop` | `incubator/apps/` | `incubator-apps-` | `values/dev/` |
| int | `pre-prod` | *(no incubator file — values only)* | `incubator-infra-` | `values/int/` |
| admin | `main` / `pre-prod` | `incubator/admin/` | `incubator-infra-` | `values/admin/` |
**Full filename patterns:**
| File type | Pattern | Example (prd) | Example (stg) |
| --------- | ------- | ------------- | ------------- |
| Incubator Application (infra) | `incubator-infra-<gke-cluster>.yaml` | `incubator-infra-k8s-central-prd-ase1.yaml` | `incubator-infra-k8s-central-stg-ase1.yaml` |
| Incubator Application (apps) | `incubator-apps-<gke-cluster>.yaml` | *(prd uses infra only)* | `incubator-apps-k8s-central-stg-ase1.yaml` |
| Values file | `incubator-infra-<gke-cluster>-values.yaml` | `values/prd/incubator-infra-k8s-central-prd-ase1-values.yaml` | `values/dev/incubator-infra-k8s-central-stg-ase1-values.yaml` |
| AppProject | `<team>-project.yaml` | `sre-project.yaml` | — |
## Incubator ↔ values file invariant
The incubator filename (without `.yaml`) **must equal** `metadata.name` inside it, and must have a matching values file. Directory prefix and env segment both vary by branch:
```text
prd (main):
incubator/prd/incubator-infra-k8s-central-prd-ase1.yaml
metadata.name: incubator-infra-k8s-central-prd-ase1
valueFiles: ../values/prd/incubator-infra-k8s-central-prd-ase1-values.yaml
stg (develop):
incubator/infra/incubator-infra-k8s-central-stg-ase1.yaml
metadata.name: incubator-infra-k8s-central-stg-ase1
valueFiles: ../values/dev/incubator-infra-k8s-central-stg-ase1-values.yaml
int (pre-prod):
(no incubator file — values/int/incubator-infra-k8s-shared-int-ase1-values.yaml only)
```
## ArgoCD Application name generation
Child Applications are named by the generic chart template:
```text
<appSpec.name>-<mungedCluster>-<env>
```
**Munging rules** (applied in order):
| Input | Output |
| ----- | ------ |
| Strip `k8s-` | `k8s-central-prd-ase1``central-prd-ase1` |
| Strip `-ase1` | `central-prd-ase1``central-prd` |
| Replace `-ase1c``-c` | `central-prd-ase1c``central-prd-c` |
| Strip `prd-`, `int-`, `dev-` | `prd-central``central` |
Result: `keda` on `k8s-central-prd-ase1`**`keda-central-prd`**
## Namespace convention
| Pattern | When | Example |
| ------- | ---- | ------- |
| `<tool>-<mungedCluster>` | Default | `keda-central-prd` |
| Shared namespace | Multi-component tools | `victoriametrics` (all VM stack apps) |
| `kube-system` | System-level tools | CoreDNS, kube-dns |
| `<tool>-role-<cluster>` | Multi-instance | `contour-internal-0-central-prd` |
## GKE cluster naming pattern
```text
k8s-<bu>-<env>-<region>
k8s-<workload>-<env>-<region>
```
prd examples: `k8s-central-prd-ase1`, `k8s-demand-prd-ase1`, `k8s-datascience-prd-ase1`
stg examples: `k8s-central-stg-ase1`, `k8s-demand-stg-ase1`, `k8s-farmiso-stg-ase1`
dev examples: `k8s-central-dev-ase1`, `k8s-demand-dev-ase1`, `k8s-dengspark-dev-ase1`
int examples: `k8s-shared-int-ase1`
admin examples: `k8s-admin-prd-ase1`, `k8s-devops-admin-ase1`, `k8s-sec-admin-ase1`