Skip to content

k8s: the Flux surface stops at the CRDs — no composite, no tutorial (Argo has both) #1590

Closed

Description

@lex00

Repo/where. INTENTIUS/chant. Composite in the k8s lexicon at lexicons/k8s/src/composites/; tutorial under docs/src/content/docs/tutorials/; example under examples/.

Goal. Close the asymmetry between the Argo surface and the Flux surface. #858 generated K8s::Flux::* for all six groups and stopped there, by design. Nothing has been built on top since.

The asymmetry

Argo CD Flux
Typed CRDs ✅ #100 ✅ #858
Composites ArgoAppFor, ArgoAppSetForRegions —
Lint rules ARGO001–005 —
Skill chant-k8s-argo —
Tutorial argo-cd-gke —
Example examples/argo-cd-gke —

The CRDs are the hard part and they are done. What is missing is the thin layer that makes them usable and findable, and it is missing for the reconciler with the larger installed base among self-hosters.

Why bother

Not a hypothetical. A real production Flux estate already runs chant-built manifests:

  • jhgaylor/home-cloud — k3s across several Mac minis, Flux CD reconciling Kustomize overlays, Traefik IngressRoute, cert-manager, CNPG, Infisical. clusters/home/infra/ is 22 hand-written Flux Kustomization CRs carrying a dependsOn graph; clusters/home/apps/ is nine more GitRepository + Kustomization pairs.
  • jhgaylor/home-chant — chant apps deployed to that cluster, onboarded as one of those Flux sources.

Thirty-one hand-written call sites for a pair chant can now type. That is the composite's evidence base, and the tutorial's material.

Worth noting the substrate arrived for adjacent reasons and is already complete. #1318 took Fountain's production overlay from 14/18 kinds to 18/18 by adding CNPG (#1319), Traefik (#1320), and Infisical (#1321) on the same day. Those three plus Flux are the self-hosted stack. INTENTIUS/fountain-ops already deploys against it with seams for traefik | ingress | omit, cnpg | bundled, and infisical | sops | reference. Every piece exists; nothing points at them from the Flux direction.

Deliverable 1 — FluxAppFor

Independently shippable. The ArgoAppFor analogue: one call replaces a GitRepository + Kustomization pair, with defaults that match how people actually run Flux.

Sketch, not a signature — the real shape should be settled against the home-cloud call sites:

import { FluxGitSource, FluxAppFor } from "@intentius/chant-lexicon-k8s";

const source = FluxGitSource("home-chant", {
  url: "https://github.com/jhgaylor/home-chant",
  branch: "main",
});

export const hello = FluxAppFor("hello-chant", {
  source,
  path: "./apps/hello-chant/k8s",
  targetNamespace: "default",
  dependsOn: ["cert-manager", "traefik"],
});

Defaults worth arguing about, taken from the real files rather than the Flux docs:

  • interval — 5m on the source, 10m on the Kustomization
  • prune: true, wait: true
  • one source, many Kustomizations. The multi-app repo is the common shape and a GitRepository per app is the mistake the composite should make hard.
  • dependsOn as a name list, validated against the discovered set the way chant graph --components validates component dependsOn

The prize is that dependsOn stops being a YAML string that is correct until it isn't.

Open question. Whether a lint rule belongs here too, mirroring ARGO002/ARGO003 (a Kustomization whose sourceRef names no declared GitRepository; a dependsOn naming nothing). Cheap once the composite exists, and the same cross-resource post-synth shape. Happy to split.

Deliverable 2 — tutorial + example

Independently shippable, and useful even without deliverable 1.

argo-cd-gke is the model and its framing carries over unchanged:

The k8s lexicon stays runtime-agnostic. The workload (src/app) is plain Chant k8s — it knows nothing about Argo. Argo is opt-in, added by one ArgoAppFor call in src/bootstrap.

That is exactly the home-cloud/home-chant split, arrived at independently by someone who had not read that page. The Flux version should be a homelab rather than a GKE cluster, because that is where Flux users are and because it removes the cloud account from the on-ramp.

Suggested scope: k3d or k3s, one workload, one FluxAppFor, Traefik IngressRoute instead of Ingress, a cert-manager Certificate. No cloud, no account.

Acceptance criteria

  • FluxAppFor exported from the k8s lexicon, emitting GitRepository + Kustomization
  • Composite test covering props, defaults, and the multi-app single-source shape
  • examples/flux-* builds in CI under the existing describeAllExamples harness
  • Tutorial page added, and added to the sidebar in astro.config.mjs (Starlight does not auto-discover)
  • Argo composites page cross-links to the Flux one and vice versa
  • chant-k8s-flux skill, or a Flux section in chant-k8s — either, decided explicitly

Prior art

Appendix — the adoption path this came out of

Ordered decisions for taking an existing Flux + Kustomize homelab onto chant, written against the repos above. Included because it is the argument for both deliverables, and because most of it is the tutorial's outline.

Fourteen choices, in order

0. Upgrade the pin. home-chant pins ^0.18.36; current is 0.41.20. Everything below landed in between. Rebuild and confirm byte-identical output before changing anything.

1. Delete the CRD escape hatch. home-chant/apps/hello-chant/src/crds.ts wraps createResource with a synthetic K8s::Core::IngressRoute entityType so resolveGVK returns non-null, then overrides apiVersion from props. A correct read of the serializer, and undocumented internals. K8s::Traefik::IngressRoute is typed now (#1320), so it deletes for free.

2–4. Keep the shape. Two repos, one chant project per app, and the four-line k8s/kustomization.yaml wrapping manifests.yaml. All three already correct. The wrapper is why Flux does not need to know chant exists.

5. Convert leaf-first and stateless-first. Leave traefik, cert-manager, longhorn, cnpg, infisical for last or never — they change rarely and converting them puts chant on the critical path of cluster bootstrap. A partial end state is a fine end state.

6. Import, don't rewrite. chant import --kustomize ../home-cloud/k8s/ntfy --output apps/ntfy/src. Hand-rewriting a manifest you already have is how a conversion stalls at app four.

7. Extract the composite after the third app, not the first. mealie, ntfy, and hello-chant are the same eight resources, including two IngressRoutes where the second exists only to carry the redirect-https middleware. That is a TraefikApp, and its props should be shaped by three real call sites.

8. Namespace. Currently set at the Flux Kustomization via targetNamespace to satisfy WK8001. A params.namespace build parameter satisfies it properly, since WK8001 objects to hardcoding rather than to namespaces. Switch when the composite lands.

9. Build-time parameters for domain and issuer. A parameter folds to a literal; process.env cannot and is rejected by name.

10. Bind the cluster. k8s: { profiles: { home: { context: "home-cloud" } } }. Without it an unrelated kubectl config use-context turns a drift report into a confident list of things missing from the wrong cluster.

11. Ownership marker on, stack = app name. Lower value under Flux, which prunes by its own labels, but it is what lets chant kube's verdict column separate chant's resources from the operator-generated ones beside them.

12. chant lifecycle affected --base origin/main in CI once the app count makes the rebuild-everything check drag.

13. chant kube for day-2. chant kube source deploy mealie answers "what is this and who made it" against a live object, which in a cluster where Flux and three operators all create Deployments is the recurring question.

14. Flux control plane into chant, last. Only once converting an app is dull — this is the machinery that applies everything else.

Skip: kustomize-apply and ApplyOp (Flux already applies; two things applying the same resources is the failure mode worth engineering against), the component model (its motivation is off-cluster pipeline sprawl), Temporal, the k3d lexicon (this is k3s on Lima), the helm lexicon (it authors charts; the typed surface wanted here is Flux HelmRelease).

Activity

  1. added
    enhancement
    needs-review
    on Aug 7, 2026
  2. lex00 commented on Aug 9, 2026

    @lex00
    ContributorAuthor

    Closing: the asymmetry table is now even.

    Argo CD Flux
    Typed CRDs #100 #858
    Composites ArgoAppFor, ArgoAppSetForRegions FluxGitSource, FluxAppFor (#1608)
    Lint rules ARGO001–005 FLUX001–003 (#1608)
    Skill chant-k8s-argo chant-k8s-flux (#1615)
    Tutorial argo-cd-gke flux-apps (#1615)
    Example examples/argo-cd-gke examples/flux-apps (#1615)

    Defaults were shaped on the home-cloud call sites as this issue asked, not the Flux docs — 5m/10m intervals, prune+wait on, one source many apps, dependsOn validated against the declared set (FLUX003). The deploy side landed separately as flux-reconcile (#1607) with the #1554 readiness entries, and controller-created objects attribute as runtime through the labels channel (#1558) plus the discovery-driven sweep (#1609).

    The home-cloud/home-chant conversion itself lives in those repos, on their timetable — the step-by-step plan in the details block above stays the reference for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions