Skip to content

Commit 91c009a

Browse files
haarchrimchmarny
andauthored
ci(kwok): add flux-git lane with in-cluster gitea (#1290)
Signed-off-by: Christopher Haar <christopher.haar@upbound.io> Co-authored-by: Mark Chmarny <mchmarny@users.noreply.github.com>
1 parent bbd0849 commit 91c009a

14 files changed

Lines changed: 1252 additions & 87 deletions

File tree

.github/actions/kwok-test/action.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ inputs:
2020
description: 'Recipe name to test'
2121
required: true
2222
deployer:
23-
description: 'Deployer to exercise: helm | argocd-oci | argocd-helm-oci | flux-oci'
23+
description: 'Deployer to exercise: helm | argocd-oci | argocd-helm-oci | flux-oci | flux-git'
2424
required: false
2525
default: 'helm'
2626
go_version:
@@ -50,7 +50,7 @@ inputs:
5050
required: false
5151
default: 'v4.52.4'
5252
flux_version:
53-
description: 'Flux CLI version to install (required for flux-oci deployer)'
53+
description: 'Flux CLI version to install (required for the flux-oci and flux-git deployers)'
5454
required: false
5555
default: ''
5656
chainsaw_version:
@@ -111,7 +111,7 @@ runs:
111111
flux_version: '${{ inputs.flux_version }}'
112112
install_goreleaser: 'true'
113113
goreleaser_version: '${{ inputs.goreleaser_version }}'
114-
# chainsaw drives the argocd-* / flux-oci sync gates from
114+
# chainsaw drives the argocd-* / flux-* sync gates from
115115
# kwok/scripts/validate-scheduling.sh (issue #962 migration).
116116
install_chainsaw: 'true'
117117
chainsaw_version: '${{ inputs.chainsaw_version }}'
@@ -150,11 +150,12 @@ runs:
150150
kubectl get applications -n argocd -o yaml > "/tmp/kwok-debug-artifacts/${cluster}-argo-apps.yaml" 2>/dev/null || true
151151
kubectl logs -n argocd deploy/argocd-repo-server --tail=500 > "/tmp/kwok-debug-artifacts/${cluster}-argo-reposerver.log" 2>/dev/null || true
152152
kubectl logs -n argocd statefulset/argocd-application-controller --tail=500 > "/tmp/kwok-debug-artifacts/${cluster}-argo-appcontroller.log" 2>/dev/null || true
153-
kubectl get ocirepositories,kustomizations,helmreleases -A -o yaml > "/tmp/kwok-debug-artifacts/${cluster}-flux-resources.yaml" 2>/dev/null || true
153+
kubectl get ocirepositories,gitrepositories,kustomizations,helmreleases -A -o yaml > "/tmp/kwok-debug-artifacts/${cluster}-flux-resources.yaml" 2>/dev/null || true
154154
kubectl logs -n flux-system deploy/source-controller --tail=500 > "/tmp/kwok-debug-artifacts/${cluster}-flux-source-controller.log" 2>/dev/null || true
155155
kubectl logs -n flux-system deploy/kustomize-controller --tail=500 > "/tmp/kwok-debug-artifacts/${cluster}-flux-kustomize-controller.log" 2>/dev/null || true
156156
kubectl logs -n flux-system deploy/helm-controller --tail=500 > "/tmp/kwok-debug-artifacts/${cluster}-flux-helm-controller.log" 2>/dev/null || true
157157
kubectl logs -n aicr-registry deploy/registry --tail=200 > "/tmp/kwok-debug-artifacts/${cluster}-registry.log" 2>/dev/null || true
158+
kubectl logs -n aicr-registry deploy/gitea --tail=200 > "/tmp/kwok-debug-artifacts/${cluster}-gitea.log" 2>/dev/null || true
158159
done
159160
160161
- name: Export Kind logs

.github/workflows/kwok-recipes.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ jobs:
228228
# shard's matrix under the limit. Keep this deployer list in sync
229229
# with the test-tier1 matrix above and the input doc in
230230
# .github/actions/kwok-test/action.yml.
231-
deployers='["helm","argocd-oci","argocd-helm-oci","flux-oci"]'
231+
deployers='["helm","argocd-oci","argocd-helm-oci","flux-oci","flux-git"]'
232232
readonly TIER3_BATCH_SIZE=200 # headroom under GitHub's 256 cap
233233
234234
# Fail closed if the batch size is ever raised past the hard limit —
@@ -275,7 +275,7 @@ jobs:
275275
fail-fast: false
276276
matrix:
277277
recipe: ${{ fromJSON(needs.discover.outputs.tier1) }}
278-
deployer: [helm, argocd-oci, argocd-helm-oci, flux-oci]
278+
deployer: [helm, argocd-oci, argocd-helm-oci, flux-oci, flux-git]
279279
steps:
280280
- name: Checkout Code
281281
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

.settings.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ testing_tools:
122122
# bundle consumes (OCIRepository -> Kustomization -> HelmRelease).
123123
# renovate: datasource=github-releases depName=fluxcd/flux2 depType=testing_tools
124124
flux_version: 'v2.8.8'
125+
# In-cluster Git server for the KWOK flux-git deployer lane (issue #963).
126+
# Rootless variant so the admin-user bootstrap can `kubectl exec gitea
127+
# admin user create` directly without su gymnastics.
128+
# renovate: datasource=docker depName=gitea/gitea depType=testing_tools
129+
gitea_image: 'gitea/gitea:1.26.2-rootless'
125130
# renovate: datasource=github-releases depName=hauler-dev/hauler depType=testing_tools
126131
hauler: 'v1.4.3'
127132
# renovate: datasource=github-releases depName=zarf-dev/zarf depType=testing_tools

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,14 @@ kwok-test-all: build ## Run all KWOK recipe tests in a shared cluster
781781
@bash kwok/scripts/run-all-recipes.sh
782782

783783
.PHONY: kwok-test-deployer
784-
kwok-test-deployer: build ## Validate scheduling under a specific deployer (RECIPE=… DEPLOYER=helm|argocd-oci|argocd-helm-oci|flux-oci)
784+
kwok-test-deployer: build ## Validate scheduling under a specific deployer (RECIPE=… DEPLOYER=helm|argocd-oci|argocd-helm-oci|flux-oci|flux-git)
785785
ifndef RECIPE
786786
@echo "Error: RECIPE is required"
787787
@echo "Usage: make kwok-test-deployer RECIPE=eks-training DEPLOYER=argocd-oci"
788788
@exit 1
789789
endif
790790
ifndef DEPLOYER
791-
@echo "Error: DEPLOYER is required (helm | argocd-oci | argocd-helm-oci | flux-oci)"
791+
@echo "Error: DEPLOYER is required (helm | argocd-oci | argocd-helm-oci | flux-oci | flux-git)"
792792
@exit 1
793793
endif
794794
@echo "Validating $(RECIPE) under deployer=$(DEPLOYER)"

docs/contributor/tests.md

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ real hardware. CI uses it to validate two things per recipe:
241241
the overlay expects.
242242
2. **Deployer output correctness.** The same recipe is re-rendered
243243
through every output adapter — `helm`, `argocd-oci`,
244-
`argocd-helm-oci`, `flux-oci` — and each renders to a working
245-
bundle the GitOps controllers can reconcile.
244+
`argocd-helm-oci`, `flux-oci`, `flux-git` — and each renders to a
245+
working bundle the GitOps controllers can reconcile.
246246

247247
KWOK nodes have no kubelet, so pods never actually run. KWOK testing
248248
**does not exercise** runtime validators (NCCL, inference-perf) or
@@ -255,31 +255,35 @@ simulated reflection of production shape, not a relaxed substitute.
255255

256256
For the design rationale and the spike findings that justify the
257257
chart pin and Repository-secret shape, see
258-
[ADR-008](https://github.com/NVIDIA/aicr/blob/main/docs/design/008-kwok-deployer-matrix.md).
258+
[ADR-008](https://github.com/NVIDIA/aicr/blob/main/docs/design/008-kwok-deployer-matrix.md);
259+
for the Git-source lanes (in-cluster Gitea, `flux-git`), see
260+
[ADR-010](https://github.com/NVIDIA/aicr/blob/main/docs/design/010-kwok-git-source-lanes.md).
259261
For cluster-level KWOK setup (node profiles, recipe auto-discovery),
260262
see [kwok/README.md](https://github.com/NVIDIA/aicr/blob/main/kwok/README.md).
261263

262264
### Deployer Coverage Matrix
263265

264266
| Tier | Trigger | Deployers exercised |
265267
|------|---------|----------------------|
266-
| Tier 1 — generic overlays | every PR + push | `helm`, `argocd-oci`, `argocd-helm-oci`, `flux-oci` |
268+
| Tier 1 — generic overlays | every PR + push | `helm`, `argocd-oci`, `argocd-helm-oci`, `flux-oci`, `flux-git` |
267269
| Tier 2 — diff-aware accelerator overlays | PR only, conditional on changed files | `helm` only |
268-
| Tier 3 — full overlay set | push to `main` + nightly schedule | `helm`, `argocd-oci`, `argocd-helm-oci`, `flux-oci` |
270+
| Tier 3 — full overlay set | push to `main` + nightly schedule | `helm`, `argocd-oci`, `argocd-helm-oci`, `flux-oci`, `flux-git` |
269271

270272
| Lane | Pull artifact | Apply manifests | Reconcile to Ready |
271273
|---|---|---|---|
272274
| `helm` | n/a (filesystem) | `helm install` | pods scheduled |
273275
| `argocd-oci` | repo-server OCI pull | Argo CD sync | `Synced+Healthy` |
274276
| `argocd-helm-oci` | `helm pull` OCI | wrapper chart install | `Synced+Healthy` |
275277
| `flux-oci` | source-controller OCI pull | kustomize-controller apply | all HelmReleases `Ready=True` + ArtifactGenerators Ready |
278+
| `flux-git` | source-controller Git clone (in-cluster Gitea) | kustomize-controller apply | GitRepositories Ready + all HelmReleases `Ready=True` |
276279

277280
Tier 2 stays `helm`-only because its job is to verify accelerator-specific
278281
overlays still render correctly when their inputs change. The deployer
279282
shape is orthogonal — re-running through Argo CD would only re-exercise
280283
template rendering, which Tier 1 and Tier 3 already cover on the generic
281-
overlays. For filesystem (Git-source) round-trip coverage of `argocd` /
282-
`flux`, see [#963](https://github.com/NVIDIA/aicr/issues/963).
284+
overlays. The `flux-git` lane covers the filesystem (Git-source)
285+
round-trip half of [#963](https://github.com/NVIDIA/aicr/issues/963);
286+
the `argocd-git` half is a follow-up on the same Gitea infrastructure.
283287

284288
### Running KWOK Locally
285289

@@ -293,11 +297,12 @@ make kwok-test-deployer RECIPE=eks-training DEPLOYER=argocd-oci
293297
```
294298

295299
Valid `DEPLOYER` values: `helm`, `argocd-oci`, `argocd-helm-oci`,
296-
`flux-oci`. The target invokes
300+
`flux-oci`, `flux-git`. The target invokes
297301
`kwok/scripts/run-all-recipes.sh --deployer <name> <recipe>`, which
298302
calls `install-infra.sh` once with `DEPLOYER` exported (in-cluster
299303
`registry:2` always; Argo CD for `argocd-*`; Flux 2 controllers for
300-
`flux-oci`), then runs `validate-scheduling.sh` for the recipe.
304+
`flux-*`; Gitea additionally for `flux-git`), then runs
305+
`validate-scheduling.sh` for the recipe.
301306

302307
**Registry host port.** The Kind cluster exposes the in-cluster
303308
`registry:2` Service on **host port 5500** (`kwok/kind-config.yaml`'s
@@ -308,11 +313,21 @@ macOS. Linux runners have 5500 free too. The in-cluster NodePort
308313
independent — Argo CD's repo-server reaches the registry via Service
309314
DNS (`registry.aicr-registry.svc.cluster.local:5000`) regardless.
310315

316+
**Gitea host port (flux-git).** The same pattern exposes the
317+
in-cluster Gitea on **host port 3300** (NodePort `30300`) so the
318+
runner can `git push` the filesystem bundle; 3300 avoids Gitea's
319+
default 3000, commonly held by Grafana / local dev servers. Flux's
320+
source-controller clones via Service DNS
321+
(`gitea.aicr-registry.svc.cluster.local:3000`). Clusters created
322+
before the 3300 mapping existed must be recreated
323+
(`kind delete cluster --name aicr-kwok-test`) — `install-infra.sh`
324+
exit code 71 is the telltale.
325+
311326
**Sweeping all deployers locally.** `make kwok-test-all` defaults to
312327
`helm`; there is no matrix-aware make target. Loop in shell:
313328

314329
```bash
315-
for d in helm argocd-oci argocd-helm-oci flux-oci; do
330+
for d in helm argocd-oci argocd-helm-oci flux-oci flux-git; do
316331
make kwok-test-deployer RECIPE=eks-training DEPLOYER="$d" || break
317332
done
318333
@@ -336,6 +351,9 @@ and local loops can branch on failure mode without parsing logs.
336351
| `install-infra.sh` | 60 | Flux install manifest apply failed |
337352
| `install-infra.sh` | 61 | Flux controller not Ready within 180 s |
338353
| `install-infra.sh` | 62 | Flux CRDs not Established within 60 s |
354+
| `install-infra.sh` | 70 | Gitea Deployment not Ready within 120 s |
355+
| `install-infra.sh` | 71 | Gitea not reachable on host port within 60 s (cluster likely predates the 3300 port mapping) |
356+
| `install-infra.sh` | 72 | Gitea admin user bootstrap failed |
339357
| `validate-scheduling.sh` | 50 | GitOps sync deadline hit |
340358
| `run-all-recipes.sh` | 50 | Three consecutive GitOps sync timeouts; ADR-008 3-strike rule tripped |
341359

@@ -353,9 +371,16 @@ independent.
353371
|----------|---------|---------|
354372
| `KWOK_ARGOCD_SYNC_TIMEOUT` | `300` s | Deadline for all child Argo CD Applications to reach `Synced+Healthy` |
355373
| `KWOK_ARGOCD_ROOT_GRACE` | `30` s | Grace period for the root Application before deadline counting starts |
356-
| `KWOK_FLUX_SYNC_TIMEOUT` | `300` s | Deadline for OCIRepository fetch + Kustomization apply + HelmReleases `Ready=True` + ArtifactGenerators Ready |
374+
| `KWOK_FLUX_SYNC_TIMEOUT` | `500` s | Deadline for source fetch (OCIRepository or GitRepository) + Kustomization apply + HelmReleases `Ready=True` + ArtifactGenerators Ready |
357375
| `KWOK_FLUX_ROOT_GRACE` | `30` s | Grace period for the outer Kustomization before deadline counting starts |
358376

377+
The `flux-git` lane additionally honors `KWOK_GITEA_HOST_PORT`
378+
(default `3300`), `KWOK_GITEA_USER` (default `aicr`), and
379+
`KWOK_GITEA_PASSWORD` (default `aicr-kwok-ci`) — shared between
380+
`install-infra.sh` (Gitea install + admin bootstrap) and
381+
`validate-scheduling.sh` (`git push`). The password is a CI-only
382+
credential for the ephemeral in-cluster Gitea, not a secret.
383+
359384
On a clean local Kind cluster `Synced+Healthy` lands in ~30 s; the
360385
300-second default exists to absorb CI variance. If a local run trips
361386
code 50 but the cluster is otherwise healthy, raise the relevant
@@ -369,8 +394,9 @@ When `kwok-test` fails, it uploads an artifact named
369394

370395
- `<cluster>-resources.txt`, `<cluster>-nodes.txt`, `<cluster>-pods.txt`, `<cluster>-events.txt`
371396
- `<cluster>-argo-apps.yaml` plus the repo-server and application-controller logs (argocd lanes)
372-
- `<cluster>-flux-resources.yaml` (OCIRepositories, Kustomizations, HelmReleases, ArtifactGenerators, ExternalArtifacts) plus source-, kustomize-, and helm-controller logs (flux-oci lane)
397+
- `<cluster>-flux-resources.yaml` (OCIRepositories, GitRepositories, Kustomizations, HelmReleases, ArtifactGenerators, ExternalArtifacts) plus source-, kustomize-, and helm-controller logs (flux-* lanes)
373398
- `<cluster>-registry.log` — last 200 lines of the in-cluster `registry:2`
399+
- `<cluster>-gitea.log` — last 200 lines of the in-cluster Gitea (flux-git lane)
374400

375401
Start with the repo-server log (Argo CD) or source-controller log
376402
(Flux) for OCI-pull failures. Application-controller / kustomize-controller
@@ -385,8 +411,9 @@ add a new value (say, `argocd-git`):
385411
1. Add a `case` branch in `kwok/scripts/validate-scheduling.sh`'s
386412
`resolve_argocd_root_app()` (or `resolve_flux_root_names()` for
387413
Flux-reconciled lanes), plus branches in `generate_bundle` and
388-
`deploy_bundle`. Reuse the existing `argocd-oci` / `flux-oci`
389-
branches as templates.
414+
`deploy_bundle`. Reuse the existing `argocd-oci` / `flux-oci` /
415+
`flux-git` branches as templates (`flux-git` is the closest model
416+
for Git-source lanes — Gitea install, dual-view URLs, push-to-create).
390417
2. Extend the `DEPLOYER` allowlist in
391418
`kwok/scripts/run-all-recipes.sh` (`case "$DEPLOYER" in` in `main()`).
392419
3. Extend the `case "${DEPLOYER}"` branches in `install-infra.sh`'s
@@ -478,4 +505,5 @@ the pre-push gate is local.
478505
- [validator.md](validator.md) — validator engine, chainsaw checks, container-per-validator pattern
479506
- [CLAUDE.md](https://github.com/NVIDIA/aicr/blob/main/.claude/CLAUDE.md) — coding rules and anti-patterns table
480507
- [ADR-008](https://github.com/NVIDIA/aicr/blob/main/docs/design/008-kwok-deployer-matrix.md) — KWOK deployer matrix rationale
508+
- [ADR-010](https://github.com/NVIDIA/aicr/blob/main/docs/design/010-kwok-git-source-lanes.md) — Git-source lanes (Gitea, flux-git)
481509
- [kwok/README.md](https://github.com/NVIDIA/aicr/blob/main/kwok/README.md) — KWOK cluster setup and node profiles

docs/design/008-kwok-deployer-matrix.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Implementation tracked under [#843](https://github.com/NVIDIA/aicr/issues/843).
88
The matrix dimensions, in-cluster topology, OCI flow, and acceptance
99
criteria described below are intent, not current behavior.
1010

11+
Extended by [ADR-010](010-kwok-git-source-lanes.md) [#963](https://github.com/NVIDIA/aicr/issues/963),
12+
which adds Git-source lanes (`flux-git` via in-cluster Gitea) for the
13+
filesystem-bundle round-trip. The "OCI over Git source" rationale
14+
below scoped the *first* lanes to OCI; ADR-010 supplements rather
15+
than reverses it.
16+
1117
## Problem
1218

1319
The KWOK CI workflow validates bundle deployment for the default

0 commit comments

Comments
 (0)