added repo
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
# Incubator Application YAML Schema
|
||||
|
||||
> Field-by-field documentation of the incubator Application YAML files.
|
||||
>
|
||||
> **File location:** Varies by env/branch:
|
||||
> - prd (`main`): `incubator/prd/incubator-infra-<cluster>.yaml`
|
||||
> - stg/dev (`develop`): `incubator/infra/incubator-infra-<cluster>.yaml` (or `incubator/apps/incubator-apps-<cluster>.yaml` for app workloads)
|
||||
> - int (`pre-prod`): no incubator file — values only in `values/int/`
|
||||
> - admin: `incubator/admin/incubator-infra-<cluster>.yaml`
|
||||
>
|
||||
> **Purpose:** Each incubator file is a single ArgoCD `Application` that acts as the **parent** in the App-of-Applications pattern. It points at `generic-argo-apps-chart/` and its corresponding values file. ArgoCD renders the generic chart to produce one child Application per `appSpec` entry.
|
||||
|
||||
---
|
||||
|
||||
## Full example
|
||||
|
||||
```yaml
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: incubator-infra-k8s-central-prd-ase1
|
||||
namespace: argocd-prd
|
||||
finalizers:
|
||||
- resources-finalizer.argocd.argoproj.io
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: 'https://github.com/Meesho/devops-infra-argo-config'
|
||||
targetRevision: main # prd=main, stg=develop, int=pre-prod
|
||||
path: generic-argo-apps-chart
|
||||
helm:
|
||||
valueFiles:
|
||||
- ../values/prd/incubator-infra-k8s-central-prd-ase1-values.yaml
|
||||
destination:
|
||||
name: in-cluster
|
||||
namespace: argocd-prd
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `metadata`
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `name` | string | yes | no | Must match the filename without `.yaml`. Convention: `incubator-infra-<gke-cluster-name>`. This name is an identifier — changing it breaks ArgoCD tracking. |
|
||||
| `namespace` | string | yes | no | Env-specific: `argocd-prd` (prd), `argocd-dev` (stg/dev), `argocd-shared-int` (int). This is the namespace in the **admin** cluster where ArgoCD runs, not the target cluster. |
|
||||
| `finalizers[0]` | string | yes | no | Always `resources-finalizer.argocd.argoproj.io`. Ensures ArgoCD deletes child Applications when the parent is deleted. Do not remove. |
|
||||
|
||||
### Filename ↔ name invariant (R9)
|
||||
|
||||
The incubator filename (without `.yaml`) **must equal** `metadata.name`. These are routing keys used by ArgoCD:
|
||||
|
||||
```text
|
||||
prd: incubator/prd/incubator-infra-k8s-central-prd-ase1.yaml
|
||||
└── metadata.name: incubator-infra-k8s-central-prd-ase1
|
||||
|
||||
stg: incubator/infra/incubator-infra-k8s-central-stg-ase1.yaml
|
||||
└── metadata.name: incubator-infra-k8s-central-stg-ase1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `spec.project`
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `project` | string | yes | no | Always `default` for incubator Applications. The child Applications use `sre` or `sec` projects. |
|
||||
|
||||
---
|
||||
|
||||
## `spec.source`
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `repoURL` | string | yes | no | Always `https://github.com/Meesho/devops-infra-argo-config`. Changing this is a Layer 3 operation. |
|
||||
| `targetRevision` | string | yes | no | Environment-specific: `main` (prd), `develop` (stg), `pre-prod` (int). Changing to any other value requires sign-off. |
|
||||
| `path` | string | yes | no | Always `generic-argo-apps-chart`. Points to the Helm chart in this repo. |
|
||||
| `helm.valueFiles[0]` | string | yes | yes | Relative path from the chart root to the cluster's values file. Convention: `../values/<env>/incubator-infra-<cluster>-values.yaml`. The `..` is required because ArgoCD resolves paths relative to `path` (i.e., relative to `generic-argo-apps-chart/`). |
|
||||
|
||||
### `valueFiles` path convention
|
||||
|
||||
The path is relative to the chart directory (`generic-argo-apps-chart/`), so you go up one level to reach the repo root:
|
||||
|
||||
```text
|
||||
generic-argo-apps-chart/ (chart root)
|
||||
└── ../values/prd/incubator-infra-k8s-central-prd-ase1-values.yaml
|
||||
└── resolves to: values/prd/incubator-infra-k8s-central-prd-ase1-values.yaml
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `spec.destination`
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `name` | string | yes | no | Always `in-cluster`. Incubator Applications run on the **admin cluster** where ArgoCD is installed, not on the target cluster. Child Applications (from `appSpec`) deploy to the target cluster. |
|
||||
| `namespace` | string | yes | no | Env-specific: `argocd-prd` (prd), `argocd-dev` (stg/dev), `argocd-shared-int` (int). This is where ArgoCD creates the child Application objects. |
|
||||
|
||||
---
|
||||
|
||||
## What this file controls vs. what it doesn't
|
||||
|
||||
| Controlled by this file | Controlled by the values file |
|
||||
| ----------------------- | ----------------------------- |
|
||||
| Which generic chart to use | Which tools deploy (`appSpec[]`) |
|
||||
| Which values file to use | Target cluster name (`clusterSpec`) |
|
||||
| ArgoCD namespace | Chart source repo and revision (`teamSpec`) |
|
||||
| Parent Application name | Per-tool namespace, chartDir, valuesDir |
|
||||
|
||||
---
|
||||
|
||||
## Files that must exist when this file is created
|
||||
|
||||
| File | Where | Why |
|
||||
| ---- | ----- | --- |
|
||||
| `values/<env>/incubator-infra-<cluster>-values.yaml` | This repo | Referenced by `helm.valueFiles` |
|
||||
| `generic-argo-apps-chart/` | This repo | The chart being rendered |
|
||||
|
||||
See also: [values-file-schema.md](values-file-schema.md) for the values file structure, and [add-new-cluster.md](../procedures/add-new-cluster.md) for the full cluster onboarding procedure.
|
||||
@@ -0,0 +1,171 @@
|
||||
# Values File Schema — Annotated Field Reference
|
||||
|
||||
> Field-by-field documentation of the cluster values files used by the generic ArgoCD chart.
|
||||
>
|
||||
> **File location:** `values/<env>/incubator-infra-<cluster>-values.yaml`
|
||||
>
|
||||
> **Consumer:** `generic-argo-apps-chart/templates/genericTemplate.yaml` reads these values to render one ArgoCD `Application` per `appSpec` entry.
|
||||
|
||||
---
|
||||
|
||||
## Top-level structure
|
||||
|
||||
```yaml
|
||||
clusterSpec: # REQUIRED — cluster identity and routing
|
||||
argocdSpec: # REQUIRED — ArgoCD operational config
|
||||
teamSpec: # REQUIRED — source repo, labels, team identity
|
||||
appSpec: # REQUIRED — list of tools to deploy (may be empty [])
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## `clusterSpec`
|
||||
|
||||
```yaml
|
||||
clusterSpec:
|
||||
destination:
|
||||
server: "" # String. Always empty — name-based routing is standard.
|
||||
name: "k8s-central-prd-ase1" # String. REQUIRED. GKE cluster name.
|
||||
# Must match: incubator file name, helm-overrides/<cluster>/ folder,
|
||||
# and teamSpec.devops.labels.cluster.
|
||||
```
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `destination.server` | string | yes | no | Always `""`. Name-based routing is used instead. |
|
||||
| `destination.name` | string | yes | no | GKE cluster name. Changing this redirects ALL tools — HIGH RISK. |
|
||||
|
||||
---
|
||||
|
||||
## `argocdSpec`
|
||||
|
||||
```yaml
|
||||
argocdSpec:
|
||||
namespace: argocd-prd # String. ArgoCD namespace where Applications are created.
|
||||
# prd → argocd-prd | stg/dev → argocd-dev | int → argocd-shared-int
|
||||
```
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `namespace` | string | yes | no | Env-specific: `argocd-prd` (prd), `argocd-dev` (stg/dev), `argocd-shared-int` (int). Changing is HIGH RISK. |
|
||||
|
||||
---
|
||||
|
||||
## `teamSpec`
|
||||
|
||||
```yaml
|
||||
teamSpec:
|
||||
devops: # Object. Team block — always "devops" for infra tooling.
|
||||
source:
|
||||
repoURL: https://github.com/Meesho/devops-infra-helm-charts # String. Helm charts source.
|
||||
targetRevision: main # String. Git ref for chart source in devops-infra-helm-charts.
|
||||
# prd → main | stg/dev → develop | int → pre-prod
|
||||
path: helm-templates # String. Root path for charts in the source repo.
|
||||
valueFiles: ../../helm-overrides/k8s-central-prd-ase1 # String. Relative path to overrides.
|
||||
labels:
|
||||
bu: infra # String. Business unit. Always "infra" for this repo.
|
||||
team: devops # String. Maps to ArgoCD AppProject name.
|
||||
env: prd # String. Environment: prd, int, dev, admin.
|
||||
cluster: k8s-central-prd-ase1 # String. Must match clusterSpec.destination.name.
|
||||
```
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `source.repoURL` | string | yes | no | Chart source repo. Changing this is HIGH RISK. |
|
||||
| `source.targetRevision` | string | yes | no | Env-specific: `main` (prd), `develop` (stg/dev), `pre-prod` (int). Changing to any other value is HIGH RISK. |
|
||||
| `source.path` | string | yes | no | Always `helm-templates`. |
|
||||
| `source.valueFiles` | string | yes | no | Relative path from chart to `helm-overrides/<cluster>`. |
|
||||
| `labels.bu` | string | yes | no | Always `infra`. |
|
||||
| `labels.team` | string | yes | no | Maps to AppProject. Usually `devops` → `sre` project. |
|
||||
| `labels.env` | string | yes | no | Matches cluster environment. |
|
||||
| `labels.cluster` | string | yes | no | Must match `clusterSpec.destination.name`. Used in Application name munging. |
|
||||
|
||||
---
|
||||
|
||||
## `appSpec` (the main editing surface)
|
||||
|
||||
```yaml
|
||||
appSpec:
|
||||
- name: keda # String. REQUIRED. Short tool name.
|
||||
namespace: keda-central-prd # String. REQUIRED. Target Kubernetes namespace.
|
||||
chartDir: keda # String. REQUIRED. Chart directory in helm-templates/.
|
||||
valuesDir: keda # String. REQUIRED. Override directory in helm-overrides/<cluster>/.
|
||||
nameOverride: "" # String. OPTIONAL. Custom Application name.
|
||||
additionalValueFiles: # List[String]. OPTIONAL. Extra values files.
|
||||
- ../../helm-templates/coredns/gcp-ase1a-values.yaml
|
||||
```
|
||||
|
||||
### Field reference
|
||||
|
||||
| Field | Type | Required | Editable | Notes |
|
||||
| ----- | ---- | -------- | -------- | ----- |
|
||||
| `name` | string | yes | yes | Short tool identifier. Used in auto-generated Application name: `<name>-<mungedCluster>-<env>`. Lowercase, hyphen-separated. |
|
||||
| `namespace` | string | yes | yes | Target K8s namespace. Auto-created by ArgoCD (`CreateNamespace=true`). Convention: `<tool>-<mungedCluster>` or shared namespace. |
|
||||
| `chartDir` | string | yes | yes | Directory under `devops-infra-helm-charts/helm-templates/`. **Must exist.** |
|
||||
| `valuesDir` | string | yes | yes | Directory under `devops-infra-helm-charts/helm-overrides/<cluster>/`. **Must exist** and contain `custom-values.yaml`. |
|
||||
| `nameOverride` | string | no | yes | Overrides the auto-generated Application name. Use only for collisions or >253 char names. See R7. |
|
||||
| `additionalValueFiles` | list | no | yes | Extra Helm values files merged during render. Paths are relative to the chart source. |
|
||||
|
||||
### How `appSpec` entries become ArgoCD Applications
|
||||
|
||||
The generic chart template (`genericTemplate.yaml`) iterates over `appSpec` and for each entry:
|
||||
|
||||
1. **Computes the Application name:** `<name>-<mungedCluster>-<env>` (or `nameOverride` if set).
|
||||
2. **Sets the source:** `repoURL` + `path/<chartDir>` from `teamSpec.devops.source`.
|
||||
3. **Sets the values:** `valueFiles/<valuesDir>/custom-values.yaml` + any `additionalValueFiles`.
|
||||
4. **Sets the destination:** `clusterSpec.destination.name` + `namespace`.
|
||||
5. **Sets the project:** from `teamSpec.devops.labels.team` (maps to AppProject).
|
||||
6. **Sets syncPolicy:** `CreateNamespace=true`.
|
||||
7. **Adds finalizer:** `resources-finalizer.argocd.argoproj.io`.
|
||||
|
||||
### Rendered Application example
|
||||
|
||||
For `name: keda` on `k8s-central-prd-ase1`:
|
||||
|
||||
```yaml
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: keda-central-prd
|
||||
namespace: argocd-prd
|
||||
labels:
|
||||
bu: infra
|
||||
team: devops
|
||||
env: prd
|
||||
cluster: k8s-central-prd-ase1
|
||||
finalizers:
|
||||
- resources-finalizer.argocd.argoproj.io
|
||||
spec:
|
||||
project: devops
|
||||
source:
|
||||
repoURL: https://github.com/Meesho/devops-infra-helm-charts
|
||||
targetRevision: main
|
||||
path: helm-templates/keda
|
||||
helm:
|
||||
valueFiles:
|
||||
- ../../helm-overrides/k8s-central-prd-ase1/keda/custom-values.yaml
|
||||
destination:
|
||||
name: k8s-central-prd-ase1
|
||||
server: ""
|
||||
namespace: keda-central-prd
|
||||
syncPolicy:
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Cluster name munging rules
|
||||
|
||||
Used by the generic template to produce short Application names:
|
||||
|
||||
| Step | Transformation | Example |
|
||||
| ---- | -------------- | ------- |
|
||||
| 1 | Preserve `dp-` and `backup` (placeholder swap) | `dp-foo` stays `dp-foo` |
|
||||
| 2 | Strip `p-`, `prd-`, `int-`, `dev-`, `-cluster` | `k8s-central-prd-ase1` → `k8s-central-ase1` |
|
||||
| 3 | Replace `prod-ops` → `infra` | — |
|
||||
| 4 | Replace `-ase1c` → `-c` | `k8s-central-prd-ase1c` → `central-c` |
|
||||
| 5 | Strip `-ase1` | `k8s-central-ase1` → `k8s-central` |
|
||||
| 6 | Strip `k8s-` | `k8s-central` → `central` |
|
||||
|
||||
**Net result:** `k8s-central-prd-ase1` → `central-prd`
|
||||
Reference in New Issue
Block a user