feat(presentation): pluggable GitOps backend (ArgoCD + minimal Flux)#104
feat(presentation): pluggable GitOps backend (ArgoCD + minimal Flux)#104sini wants to merge 12 commits into
Conversation
…ault.nix to wiring
…split Application type import
…s config behind the backend
…zation) proving the seam
|
I provided only a minimal impl as a POC for framing discussion. |
|
I've been sitting and thinking about this today and I think I'm for the idea of supporting a pluggable "presentation" backend as long as the original ArgoCD experience doesn't suffer (apart from moving the options a bit, but the aliases help). I have used Flux a bit at $work but never liked it as much as ArgoCD, how do you propose the environmentPackage layout should be? Won't there need to be a similar app-of-apps setup? I think the consensus in the Flux community is that the rendered manifest pattern like nixidy uses (commit manifests to git) is an anti-pattern. I think they're more in favour of pushing manifests in OCI artifacts. I think it would make sense to have the standard flux backend be as close to the argocd one (but make it make sense for flux usage) but also offer a user provided backend if the user wants. Maybe someone could implement a new activation script that builds an OCI artifact and pushes it instead. Maybe What do you think? |
|
Yeah; that's in line with my thinking. The flux impl in this draft isn't intended to ship; just show what the restructure would look like for ArgoCD. ArgoCD of course remains the first class flagship, we just re-architect the backend model a bit to support (ideally, any) alternative gitops toolchains and more closely match a MVC-style rendering pattern for future enhancements. :) |
Draft for discussion. Makes the GitOps controller a pluggable presentation backend: ArgoCD is ported behind the seam as the default backend (non-breaking, output byte-identical), and a minimal Flux backend proves pluggability.
The idea
nixidy's core model — applications → rendered manifests → per-app output dirs — is GitOps-tool-agnostic; only the presentation (synthesizing ArgoCD
Applications + the app-of-apps bootstrap) is ArgoCD-specific. Today that's already a model-injection (app-of-apps adds synthetic apps whose resources areApplications, which ride the normal render path). D3 names that the present seam.A presentation backend is a conditional module that, when selected via
nixidy.presentation.backend(default"argocd"), contributes:applications.<name>.<backend>.*(threaded into the applications submodule),modules/nixidy/app-of-apps.nixandmodules/applications/argocd.nixare removed (their content moves into the argocd backend).Back-compat (non-breaking)
The per-app ArgoCD options (
project,finalizer,syncPolicy,destination,compareOptions,ignoreDifferences) move toapplications.<name>.argocd.*, and the top-levelnixidy.appOfApps.*/nixidy.defaults.{finalizer,syncPolicy,destination}move tonixidy.presentation.argocd.*. Every old path value-forwards viamkRenamedOptionModule— existing configurations evaluate unchanged, and withbackend = "argocd"the rendered output is byte-identical (the existing test suite is the oracle).Minimal Flux backend
backend = "flux"synthesizes a sharedGitRepository+ a per-appKustomization+ a root Kustomization, emitted as raw object attrsets (nixidy already renders plain manifests, so a FluxKustomizationper app-output-dir is the natural mapping). NoHelmRelease/full sync-option parity — it's a pluggability proof, not production Flux. Typed Flux modules viafromCRDModule(#103) would be the production path.Tests
Why draft
This changes the option schema (behind aliases), so it's the boldest of the three. Opening for discussion on whether pluggable backends fit nixidy's direction before polishing. Completes the "functional core / imperative shell" arc with #102 and #103.