Description
Currently, the kustomize-controller can automatically generate a kustomization.yaml if it's missing in the spec.path. However, it lacks the ability to explicitly define a list of resources via the CRD.
While Flux is often presented as a "transport," in reality, it is already a powerful manifest generator: it allows overriding namespaces, names, patches, images, and variables. If Flux can manage "what to change" (patches), it should be able to manage "what to include" (resources).
The "Components" Precedent
Flux already supports spec.components, which allows injecting a list of files/directories. Since the controller already implements logic for injecting a list of components into the transient kustomization.yaml, forbidding the same for resources is an artificial and inconsistent limitation.
Proposed Change
Add a spec.resources field (list of strings) to the Kustomization CRD.
Expected Behavior
- Context:
spec.path serves as the root (work directory).
- Explicit Selection: If
spec.resources is defined, the controller uses this list and disables the default automatic recursive discovery (the "include all files" behavior).
- Merging: If a physical
kustomization.yaml exists in spec.path, spec.resources should be appended/merged (following the same merging logic already used for spec.components).
Why this is needed?
- Reducing Git Boilerplate: Currently, users are forced to create "garbage" one-liner overlays in Git just to have different resource lists for the same source.
- Consistency: If we can dynamically inject components and patches via CRD, we must be able to define the base resource list.
- Logical Alignment: If
spec.path is the "context," then spec.resources is the natural way to define the entry points within that context.
Example
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: example
spec:
interval: 5m
path: ...
resources:
- https://raw.githubusercontent.com/...
components: # already work, why doesn't the resource list?
- components/ingress
Description
Currently, the
kustomize-controllercan automatically generate akustomization.yamlif it's missing in thespec.path. However, it lacks the ability to explicitly define a list of resources via the CRD.While Flux is often presented as a "transport," in reality, it is already a powerful manifest generator: it allows overriding namespaces, names, patches, images, and variables. If Flux can manage "what to change" (patches), it should be able to manage "what to include" (resources).
The "Components" Precedent
Flux already supports
spec.components, which allows injecting a list of files/directories. Since the controller already implements logic for injecting a list of components into the transientkustomization.yaml, forbidding the same forresourcesis an artificial and inconsistent limitation.Proposed Change
Add a
spec.resourcesfield (list of strings) to theKustomizationCRD.Expected Behavior
spec.pathserves as the root (work directory).spec.resourcesis defined, the controller uses this list and disables the default automatic recursive discovery (the "include all files" behavior).kustomization.yamlexists inspec.path,spec.resourcesshould be appended/merged (following the same merging logic already used forspec.components).Why this is needed?
spec.pathis the "context," thenspec.resourcesis the natural way to define the entry points within that context.Example