added repo

This commit is contained in:
Your Name
2026-08-26 04:03:34 +05:30
parent 2389ec1fd6
commit 1055e1394f
150 changed files with 12395 additions and 0 deletions
+125
View File
@@ -0,0 +1,125 @@
# Skill: Add Tool to Cluster
> Parameterized agent task for adding a new `appSpec` entry to a cluster values file.
>
> **Layer:** 1-T (Tool-Mediated). Agent generates the diff and opens a PR.
>
> **Procedure:** [docs/platform/procedures/add-tool-to-cluster.md](../../docs/platform/procedures/add-tool-to-cluster.md)
---
## When to use
Trigger on requests like:
- "Add `<tool>` to `<cluster>`"
- "Deploy `<tool>` on `<cluster>`"
- "Onboard `<tool>` to `<cluster>`"
- "Roll out `<tool>` to `<cluster>`"
---
## Inputs
| Parameter | Required | Example | Source |
| --------- | -------- | ------- | ------ |
| `tool_name` | yes | `kyverno` | User request |
| `cluster` | yes | `k8s-farmiso-prd-ase1` | User request |
| `env` | yes | `prd` | Derived from cluster name |
| `namespace` | yes | `kyverno-farmiso-prd` | Convention: `<tool>-<mungedCluster>` |
| `chartDir` | yes | `kyverno` | Must exist in `devops-infra-helm-charts/helm-templates/` |
| `valuesDir` | yes | `kyverno` | Must exist in `devops-infra-helm-charts/helm-overrides/<cluster>/` |
---
## Steps (deterministic — no branching)
### Step 0: Resolve the values file path
```
values/<env>/incubator-infra-<cluster>-values.yaml
```
Halt if the file doesn't exist — the cluster may not be onboarded yet. Direct user to [add-new-cluster.md](../../docs/platform/procedures/add-new-cluster.md).
### Step 1: Verify chartDir exists in `devops-infra-helm-charts`
```bash
ls /path/to/devops-infra-helm-charts/helm-templates/<chartDir>/
```
**Halt** if missing. The chart must be created in the sister repo first.
### Step 2: Verify valuesDir exists in `devops-infra-helm-charts`
```bash
ls /path/to/devops-infra-helm-charts/helm-overrides/<cluster>/<valuesDir>/custom-values.yaml
```
**Halt** if missing. The override must be created in the sister repo first.
### Step 3: Compute the auto-generated Application name
Apply munging rules:
```
<tool_name>-<mungedCluster>-<env>
```
Where `mungedCluster` = strip `k8s-`, `prd-`, `int-`, `dev-`, `-ase1`; map `-ase1c``-c`.
### Step 4: Check for name collisions
```bash
grep "^\s*- name:" values/<env>/incubator-infra-<cluster>-values.yaml
```
Verify the computed Application name doesn't collide with any existing entry.
### Step 5: Append the appSpec entry
Add to the `appSpec` list in the values file:
```yaml
- name: <tool_name>
namespace: <namespace>
chartDir: <chartDir>
valuesDir: <valuesDir>
```
Do NOT add `nameOverride` unless Step 4 found a collision.
### Step 6: Validate
```bash
helm template generic-argo-apps-chart/ \
-f values/<env>/incubator-infra-<cluster>-values.yaml | grep -A 20 "name: <tool_name>"
yamllint values/<env>/incubator-infra-<cluster>-values.yaml
```
### Step 7: Open PR
Title: `add <tool_name> to <cluster>`
PR body checklist:
- [ ] `chartDir` exists in `devops-infra-helm-charts/helm-templates/`
- [ ] `valuesDir` exists in `devops-infra-helm-charts/helm-overrides/<cluster>/`
- [ ] Application name <= 253 characters
- [ ] No name collision
- [ ] `helm template` renders correctly
- [ ] Pre-commit hooks pass
---
## Output
One modified file: `values/<env>/incubator-infra-<cluster>-values.yaml` with a new `appSpec` entry appended.
---
## Gotchas
1. **Never skip Step 1 and Step 2.** A missing chartDir or valuesDir will cause ArgoCD render failure fleet-wide on auto-sync.
2. **Auto-sync means immediate deploy.** Once the PR merges to `main`, the tool is deployed. There is no "staging deploy" step.
3. **Namespaces must be unique per cluster.** Two tools can share a namespace (e.g., `victoriametrics`), but this should be intentional and documented.
4. **Multi-instance tools** (e.g., `contour-internal-0`, `contour-internal-1`) need unique `name` and `valuesDir` per instance.
+129
View File
@@ -0,0 +1,129 @@
# Skill: Fleet-Wide Tool Rollout
> Parameterized agent task for adding a new tool to multiple clusters in a single PR.
>
> **Layer:** 1-T (Tool-Mediated). Agent generates the diff and opens a PR.
>
> **Procedure:** [docs/platform/procedures/fleet-wide-tool-rollout.md](../../docs/platform/procedures/fleet-wide-tool-rollout.md)
---
## When to use
Trigger on requests like:
- "Add `<tool>` to all prd clusters"
- "Roll out `<tool>` to demand, supply, central, farmiso"
- "Onboard `<tool>` fleet-wide"
- "Deploy `<tool>` across all data clusters"
Do NOT use for single-cluster additions — use [add-tool.md](add-tool.md) instead.
---
## Inputs
| Parameter | Required | Example | Source |
| --------- | -------- | ------- | ------ |
| `tool_name` | yes | `coroot` | User request |
| `target_clusters` | yes | `["k8s-demand-prd-ase1", "k8s-supply-prd-ase1"]` or `"all-prd"` | User request |
| `env` | yes | `prd` | Derived from cluster names |
| `chart_dir` | yes | `coroot` | Must exist in `devops-infra-helm-charts/helm-templates/` |
| `values_dir_pattern` | yes | `coroot` or `coroot-<cluster>` | Depends on whether overrides are cluster-specific |
| `namespace_pattern` | yes | `prd-<tool>` or `<tool>-<mungedCluster>` | Convention from procedure |
---
## Steps (deterministic)
### Step 0: Resolve target clusters
If `target_clusters = "all-prd"`:
```bash
ls values/prd/
```
Otherwise: use the provided list. Derive env from cluster names.
### Step 1: Verify `chartDir` exists
```bash
ls /path/to/devops-infra-helm-charts/helm-templates/<chart_dir>/
```
**Halt** if missing.
### Step 2: Verify `valuesDir` exists for each cluster
```bash
for cluster in <target_clusters>; do
ls /path/to/devops-infra-helm-charts/helm-overrides/$cluster/<values_dir>/custom-values.yaml \
&& echo "OK: $cluster" || echo "MISSING: $cluster"
done
```
**Halt** if any cluster is missing its override. Report which clusters are missing so the user can create them in `devops-infra-helm-charts` first.
### Step 3: Check for existing entries (idempotency)
```bash
for f in <target_values_files>; do
grep "name: <tool_name>" "$f" && echo "Already exists in $f"
done
```
Skip clusters that already have the tool.
### Step 4: Compute Application names, check collisions
For each cluster, compute `<tool_name>-<mungedCluster>-<env>` and verify no collision.
### Step 5: Append appSpec entries
For each cluster values file, append:
```yaml
- name: <tool_name>
namespace: <namespace>
chartDir: <chart_dir>
valuesDir: <values_dir>
```
Use the cluster-specific `valuesDir` if overrides are cluster-named.
### Step 6: Validate all modified files
```bash
for f in <modified_files>; do
helm template generic-argo-apps-chart/ -f "$f" | grep -c "kind: Application"
yamllint "$f"
done
```
All must pass.
### Step 7: Open PR
Title: `onboard <tool_name> to [all prd | <cluster-group>] clusters`
PR body checklist:
- [ ] Clusters modified: `[list]`
- [ ] `chartDir` exists: `devops-infra-helm-charts/helm-templates/<chart_dir>/`
- [ ] `valuesDir` verified for each cluster
- [ ] Application names computed, no collisions
- [ ] `helm template` passes for all clusters
- [ ] Pre-commit hooks pass
---
## Output
Multiple modified `values/<env>/<cluster>-values.yaml` files, one new `appSpec` entry per file.
---
## Gotchas
1. **valuesDir names vary per cluster.** Some tools use `<tool>` as the valuesDir (same for all clusters); others use cluster-specific directories like `coroot-central`. Verify each one — do not assume uniformity.
2. **Auto-sync = simultaneous fleet deploy.** All clusters deploy on merge. If you want staged rollout, open separate PRs — one per cluster group.
3. **Skip already-deployed clusters silently.** If a cluster already has the tool (Step 3), skip it with a note in the PR body — don't add a duplicate entry.
4. **Namespace convention matters.** Confirm the namespace pattern with the tool owner. Some tools use `prd-<tool>` (env-prefixed), others use `<tool>-<mungedCluster>`. Inconsistency across clusters is a drift risk.
+135
View File
@@ -0,0 +1,135 @@
> Per [AI Blitz Plan §5.5](../../docs/global/AGENT_BOUNDARIES.md). Layer: 1-T.
# Skill — Onboard a New Cluster
Parameterised skill for adding a new GKE cluster to the ArgoCD infrastructure control plane.
**Full procedure:** [docs/platform/procedures/add-new-cluster.md](../../docs/platform/procedures/add-new-cluster.md)
---
## Inputs
| Parameter | Example | Required |
| --------- | ------- | -------- |
| `CLUSTER_NAME` | `k8s-dsgpu-prd-ase1` | yes |
| `ENV` | `prd` | yes |
| `INITIAL_TOOLS` | `keda,external-secrets,contour-internal` | no (default: empty appSpec) |
**Env → branch / namespace / values-dir:**
| ENV | Branch | ArgoCD namespace | Values dir | Incubator dir |
| --- | ------ | ---------------- | ---------- | ------------- |
| `prd` | `main` | `argocd-prd` | `values/prd/` | `incubator/prd/` |
| `stg` / `dev` | `develop` | `argocd-dev` | `values/dev/` | `incubator/infra/` |
| `int` | `pre-prod` | `argocd-shared-int` | `values/int/` | `incubator/int/` |
---
## Pre-flight checks
```bash
# 1. Verify GKE cluster exists and is registered as an ArgoCD destination
argocd cluster list | grep <CLUSTER_NAME>
# 2. Verify helm-overrides directory exists in sister repo
ls ../devops-infra-helm-charts/helm-overrides/<CLUSTER_NAME>/
# 3. Check no incubator file already exists for this cluster
ls incubator/<env>/incubator-infra-<CLUSTER_NAME>.yaml 2>/dev/null && echo "ALREADY EXISTS"
```
---
## Step 1: Create incubator file
**File:** `incubator/<env>/incubator-infra-<CLUSTER_NAME>.yaml`
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: incubator-infra-<CLUSTER_NAME>
namespace: <ARGOCD_NAMESPACE>
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://github.com/Meesho/devops-infra-argo-config'
targetRevision: <BRANCH>
path: generic-argo-apps-chart
helm:
valueFiles:
- ../values/<ENV>/incubator-infra-<CLUSTER_NAME>-values.yaml
destination:
name: in-cluster
namespace: <ARGOCD_NAMESPACE>
```
**Invariant (R9):** `metadata.name` must exactly equal the filename without `.yaml`.
---
## Step 2: Create values file
**File:** `values/<ENV>/incubator-infra-<CLUSTER_NAME>-values.yaml`
```yaml
clusterSpec:
destination:
server: ""
name: "<CLUSTER_NAME>"
argocdSpec:
namespace: <ARGOCD_NAMESPACE>
teamSpec:
devops:
source:
repoURL: https://github.com/Meesho/devops-infra-helm-charts
targetRevision: <BRANCH>
path: helm-templates
valueFiles: ../../helm-overrides/<CLUSTER_NAME>
labels:
bu: infra
team: devops
env: <ENV>
cluster: <CLUSTER_NAME>
appSpec: []
```
Start with `appSpec: []`. Add tools via [add-tool.md](add-tool.md) in a follow-up PR.
---
## Step 3: Validate
```bash
helm template generic-argo-apps-chart/ \
-f values/<ENV>/incubator-infra-<CLUSTER_NAME>-values.yaml
yamllint incubator/<env>/incubator-infra-<CLUSTER_NAME>.yaml
yamllint values/<ENV>/incubator-infra-<CLUSTER_NAME>-values.yaml
```
---
## Step 4: Open PR
```bash
git checkout -b onboard-cluster-<CLUSTER_NAME>
git add incubator/<env>/incubator-infra-<CLUSTER_NAME>.yaml \
values/<ENV>/incubator-infra-<CLUSTER_NAME>-values.yaml
git commit -m "feat: onboard cluster <CLUSTER_NAME> to ArgoCD infra control plane"
git push origin HEAD
```
PR target branch: `<BRANCH>` (matches environment).
---
## Blast radius
New cluster only. Existing clusters and their `appSpec` entries are unaffected. The incubator renders zero child Applications until `appSpec` entries are added.
+108
View File
@@ -0,0 +1,108 @@
# Skill: Upgrade Chart Version
> Parameterized agent task for changing the `chartDir` of an `appSpec` entry to reference a new chart version, across one or more clusters.
>
> **Layer:** 1-T (Tool-Mediated). Agent generates the diff and opens a PR.
>
> **Procedure:** [docs/platform/procedures/upgrade-chart-version.md](../../docs/platform/procedures/upgrade-chart-version.md)
---
## When to use
Trigger on requests like:
- "Upgrade `<tool>` to `<version>` on `<cluster>`"
- "Bump `<tool>` chart to `<newChartDir>`"
- "Roll out `<tool>` chart upgrade across all prd clusters"
- "Pin `<tool>` back to `<oldChartDir>`"
---
## Inputs
| Parameter | Required | Example | Source |
| --------- | -------- | ------- | ------ |
| `tool_name` | yes | `contour-internal-0` | User request (`name` field in appSpec) |
| `new_chart_dir` | yes | `contour-v1.33.3` | User request or devops-infra-helm-charts PR |
| `clusters` | yes | `k8s-central-prd-ase1` or `all-prd` | User request |
| `env` | yes | `prd` | Derived from cluster name |
---
## Steps (deterministic)
### Step 0: Resolve target values files
Single cluster:
```text
values/<env>/incubator-infra-<cluster>-values.yaml
```
All prd clusters:
```bash
ls values/prd/
```
Halt if any values file doesn't exist.
### Step 1: Verify new `chartDir` exists in `devops-infra-helm-charts`
```bash
ls /path/to/devops-infra-helm-charts/helm-templates/<new_chart_dir>/
```
**Halt** if missing. The chart must be created in the sister repo first.
### Step 2: Find the appSpec entry in each values file
```bash
grep -n -A 5 "^\s*- name: <tool_name>$" values/<env>/incubator-infra-<cluster>-values.yaml
```
Record the line number and current `chartDir` value.
**Halt** if the tool is not in the values file — it may not be deployed on this cluster.
### Step 3: Update the `chartDir`
Change `chartDir: <old>` to `chartDir: <new_chart_dir>` in each target values file.
Do not change `name`, `namespace`, `valuesDir`, or `nameOverride`.
### Step 4: Validate each modified file
```bash
helm template generic-argo-apps-chart/ \
-f values/<env>/incubator-infra-<cluster>-values.yaml \
| grep -B 2 -A 30 "name: <tool_name>"
yamllint values/<env>/incubator-infra-<cluster>-values.yaml
```
Every file must render cleanly before proceeding.
### Step 5: Open PR
Title: `upgrade <tool_name> chartDir to <new_chart_dir> [on <cluster> | across prd clusters]`
PR body checklist:
- [ ] New `chartDir` exists in `devops-infra-helm-charts/helm-templates/`
- [ ] Previous `chartDir`: `<old_chart_dir>` (for easy rollback reference)
- [ ] `helm template` renders correctly for each cluster
- [ ] Pre-commit hooks pass
- [ ] `custom-values.yaml` compatibility confirmed
---
## Output
One or more modified `values/<env>/incubator-infra-<cluster>-values.yaml` files with updated `chartDir`.
---
## Gotchas
1. **`valuesDir` compatibility:** Some chart upgrades require changes to `custom-values.yaml` in `devops-infra-helm-charts`. If the new chart version has breaking value key changes, that must be a separate PR in the sister repo first.
2. **Auto-sync on merge:** All changed clusters deploy simultaneously on merge to the env branch (`main` for prd, `develop` for stg, `pre-prod` for int). For large fleet upgrades, consider staged rollout (separate PRs per cluster group).
3. **`name` field ≠ `chartDir`:** The `name` field is the appSpec identifier and is NOT changed during a chart upgrade. Only `chartDir` changes.
4. **Rollback:** Simply change `chartDir` back to the previous value in a new PR.