You are viewing development documentation built from the latest commit on main (last tag v0.2.0-rc.2, source commit 25e1a892).
APIs and features are subject to change.
Augmenters and Delivery Intent
Two ways to shape what Flux does with one application: child layouts that an augmenter attaches, and the per-application delivery intent.
The Go blocks on this page are the bodies of Example functions in pkg/stack/fluxcd, which go test runs. They use the imports and the helpers named in the tutorial
.
Augmenter-Added Child Layouts
A LayoutAugmenter can attach sub-ManifestLayout children to a per-app layout after resource generation. In FluxIntegratedPerLayout mode kure automatically emits a Flux Kustomization CR for each eligible child.
Eligibility
A child layout receives a CR when:
!child.UmbrellaChildchild.ApplicationFileMode != AppFileSingle- it renders no bundle (a child that does already has that bundle’s CR in the parent)
- a source resolves: the
SourceRefof the nearest bundle-rendering layout at or above the parent, with bothKindandNameset (withBundleGrouping: GroupFlatthe root node’s directory renders no bundle and counts with theSourceRefof the root node’s own bundle; withGroupByNameno node’s directory counts), else the oneSourceRefthe URL-less bundles below the child share, else (noSourceRefwithout a URL below the child, or two that differ) theSourceRefof the bundle of the nearest node, at or above the child’s own, that has one: what a node’s directory takes withGroupByNamewhen everySourceRefat and below it has a URL or the ones without a URL below it differ (nil, empty struct, missing either field, or still ambiguous with no such bundle is a hard error — aKustomizationwithoutspec.sourceRefis invalid); the Kustomization of the root node’s directory, below aClusterNamewrapper, takes no Source the integration generates and is refused when no other is left (go-kure/kure#979)
CreateLayoutWithResources validates SourceRef completeness for all bundles before layout walking. Both the node bundle and every umbrella child bundle must have SourceRef.Kind and SourceRef.Name set when either inline mode (FluxIntegratedPerLayout or FluxIntegratedPerBundle) is active — both emit bundle/node CRs carrying a spec.sourceRef. FluxSeparate and non-Flux callers are unaffected.
Ordered reconciliation with DependsOn
Set ManifestLayout.DependsOn to the names of the sibling layouts to express reconciliation order between hook groups. A hook-group layout’s CR is named <unit name>-<layout name> (or by its KustomizationName), and the integrator writes that name into spec.dependsOn for an entry that names a layout of the same unit: a sibling first, else the one layout of that name below the unit’s directory. Any other entry is a Kustomization name and is written as given. This happens only under FluxIntegratedPerLayout; under the other placements the child gets no Kustomization and the field is refused (see A layout’s Kustomization settings are refused where it gets no Kustomization
):
Each layout’s CR is named <unit name>-<layout name>, and the entry is written as the CR name of
the layout it names. Below the bundle web this produces a web-nginx-01-hooks Kustomization CR
with:
Flux reconciles web-nginx-01-hooks only after web-nginx-00-pre-install is healthy. An entry
may also name another layout of the same bundle, the parent application layout for instance
(not while that layout’s Kustomization has wait, its own or the bundle’s: see Per-layout Kustomizations take the bundle’s readiness settings and labels
). An entry that names no such layout is written as given, as the name of a Kustomization.
Naming uniqueness
The Flux Kustomization CR’s metadata.name is <unit name>-<child layout Name>, or the child’s KustomizationName when the augmenter sets one. Since all Kustomization CRs live in the flux-system namespace, names must be globally unique across the cluster. The recommended convention for the layout name is {appName}-{hookGroupDir} (e.g. nginx-00-pre-install, nginx-01-hooks). Augmenters are responsible for enforcing this uniqueness within their bundle.
Extra files an augmenter attaches
ExtraFiles an augmenter attaches must use portable relative names (letters, digits, ., _,
-, and / between segments) and may not take a path the writer owns in the layout’s directory:
a generated resource file, a kustomize control file, a child layout’s directory or file, or
another extra file. The layout writers refuse such a layout with an error instead of letting the
extra file replace a generated manifest. ConfigMapGenerators need the layout’s own
kustomization.yaml, so the writers refuse them on an application written AppFileSingle (as
ArgoProfile writes applications), which gets none. See the
Layout Engine reference
for the full rule.
Disk layout
With the application nginx in the bundle web, each CR and its file carry the unit name:
clusters/production/prod/
flux-system-kustomization-web-nginx.yaml # app CR (placed at node level)
kustomization.yaml # references nginx CR
nginx/
flux-system-kustomization-web-nginx-00-pre-install.yaml
flux-system-kustomization-web-nginx-01-hooks.yaml
kustomization.yaml # references hook CRs
nginx-00-pre-install/
workload-*.yaml
kustomization.yaml
nginx-01-hooks/
workload-*.yaml
kustomization.yamlDelivery Intent per Application
Bundle.Prune and Bundle.Force apply to a whole Flux Kustomization. To protect one application
from pruning, or to allow delete-and-recreate for one application, set its Delivery:
The engine writes kustomize.toolkit.fluxcd.io/prune: disabled and
kustomize.toolkit.fluxcd.io/force: enabled on that application’s objects under every placement
and grouping, including the objects an augmenter adds to the application’s own layout and the
ConfigMaps its configMapGenerator entries build. For a List the application emits, the objects
it holds are annotated, those of a List inside it included, and never the List itself. An
object that already carries one of the two
annotations with another value is refused with an error naming it. The annotations are applied by
IntegrateWithLayout and CreateLayoutWithResources; see the
Flux Layout Integration reference
for the full rule, including what prune
protection means for generated ConfigMaps.