In this pattern, the Flux Operator generates the delivery pipeline directly from the directory structure. No Flux Kustomization is written by hand; adding a directory deploys it, and removing it prunes it.
How it Works
- An
ArtifactGenerator with a pathPattern produces one labeled ExternalArtifact per <thing>/envs/<env> directory. - A
ResourceSetInputProvider of type: ExternalArtifact exports one input per artifact. - A
ResourceSet templates a Flux Kustomization per input. - Usually, the entire setup is pushed as one OCI artifact per cluster using a
FluxInstance with sync.kind: OCIRepository, meaning the cluster never reads Git directly.
Key Characteristics
- Environment Types:
- Cluster env (
dev/prod): Selected via flux-vars to pick infra/**/envs/<env>. - App env (
test/staging/prod): A namespace apps-<app_env> hosting instances of apps.
- Ordering: Managed at the
ResourceSet level: infra-core → infra-controllers → apps-<app_env> → per-app ResourceSets. Use wait: true and dependsOn with namespace settings. - App Composition: Apps combine manifests from a generated
ExternalArtifact with image versions from an OCIArtifactTag provider pinned via spec.images (newTag + digest). - Parameterization: Only
clusters/<cluster>/ differs between clusters; all other paths are parameterized by ${env}, ${cluster_registry}, ${app_registry}, ${app_env}, and ${app_semver}.
Audit Checklist
When auditing this pattern, check for:
source-watcher being enabled.base + overlay being copied by every pathPattern generator.- YAML-safe substituted values.
- Plain image names in
spec.images[].name. namespace defined on ResourceSet dependsOn.wait: true and reconcileTimeout on every ResourceSet.
kubernetes/
├── clusters/<cluster>/
│ ├── flux-instance.yaml
│ ├── flux-vars.yaml
│ ├── infra-reconcilers.yaml
│ └── apps-<app_env>-reconcilers.yaml
├── infra/
│ ├── reconcilers/
│ │ ├── core.yaml
│ │ ├── controllers.yaml
│ │ └── configs.yaml
│ ├── core/{base,envs/<env>}/
│ └── components/<name>/
│ ├── controllers/{base,envs/<env>}/
│ └── configs/{base,envs/<env>}/
└── apps/
├── reconcilers/
│ ├── artifacts.yaml
│ ├── env.yaml
│ └── <app>.yaml
└── <app>/{base,envs/<app_env>}/