Skip to content

feat(bundler): add Flux CD deployer type #617

Description

@mchmarny

Summary

Add a flux deployer type to the bundler, enabling generation of Flux CD deployment artifacts (HelmRelease, Kustomization, GitRepository sources) alongside the existing helm, argocd, and argocd-helm deployers.

Motivation

AICR currently supports three deployer types: helm (default), argocd, and argocd-helm. Organizations using Flux CD as their GitOps controller have no native bundle output — they must manually translate Helm bundles into Flux CRDs. A first-class flux deployer would close this gap and align AICR with the two dominant GitOps ecosystems (ArgoCD and Flux).

Scope

New deployer: pkg/bundler/deployer/flux/

Implement the deployer.Deployer interface (Generate(ctx, outputDir) (*Output, error)) producing:

Artifact Purpose
HelmRelease per Helm component Declares chart source, version, values
Kustomization per Kustomize component Points to Git source + path
HelmRepository / GitRepository sources Declares upstream chart repos and Git repos
Root kustomization.yaml Orchestrates all resources with dependsOn ordering
README.md Deployment instructions (flux reconcile, prerequisites)

Registration changes

File Change
pkg/bundler/config/config.go Add DeployerFlux DeployerType = "flux", update ParseDeployerType and GetDeployerTypes
pkg/bundler/bundler.go Add case config.DeployerFlux in buildDeployer() switch (~L282)
pkg/bundler/bundler.go Add Flux mapping in runDeployer() result type (~L430)

Config options to support

  • --repo-url and --target-revision (reuse existing config fields, same as ArgoCD)
  • --dynamic support TBD — may follow the argocd-helm pattern with valuesFrom / postBuild.substituteFrom

Flag compatibility (pre-flight validation in buildDeployer)

Flag Supported Reason
--attest No (initially) Same limitation as argocd-helm
--data No (initially) Same limitation as argocd-helm
--dynamic Deferred Needs design for Flux valuesFrom / postBuild mapping

Output structure (proposed)

output/
├── README.md
├── kustomization.yaml          # Root Kustomization referencing all resources
├── sources/
│   ├── helmrepo-<name>.yaml    # HelmRepository per unique chart repo
│   └── gitrepo-<name>.yaml     # GitRepository per unique Git source
├── cert-manager/
│   ├── helmrelease.yaml        # HelmRelease CR (dependsOn ordering)
│   └── values.yaml             # Helm values (inline or ConfigMap)
└── gpu-operator/
    ├── helmrelease.yaml
    └── values.yaml

Implementation notes

  • Follow the existing deployer pattern: struct with exported fields, compile-time interface check (var _ deployer.Deployer = (*Generator)(nil))
  • Use shared helpers from pkg/bundler/deployer/helpers.go (SafeJoin, WriteValuesFile, GenerateFromTemplate, SortByDeploymentOrder)
  • Deployment ordering maps to dependsOn in HelmRelease/Kustomization CRs (analogous to ArgoCD sync-waves)
  • Flux API versions: source.toolkit.fluxcd.io/v1 and helm.toolkit.fluxcd.io/v2 (stable APIs)
  • Kustomize components use Kustomization CR pointing to GitRepository source with path/tag

Test plan

  • Unit tests for flux.Generator.Generate() covering Helm, Kustomize, and mixed-component recipes
  • Table-driven tests for HelmRelease and Kustomization CR generation
  • Verify dependsOn ordering matches recipe deployment order
  • Verify flag incompatibility errors (--attest, --data)
  • E2E: aicr bundle --deployer flux produces valid Flux CRDs (YAML schema validation)
  • Update ParseDeployerType and GetDeployerTypes tests

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions