Skip to content

Introduce namespace management in ArtifactGenerator - #392

Open
matheuscscp wants to merge 1 commit into
mainfrom
namespaces
Open

matheuscscp wants to merge 1 commit into
mainfrom
namespaces

Conversation

@matheuscscp

@matheuscscp matheuscscp commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Closes: #388

This PR introduces two things that are tightly coupled: the ability to generate namespaces from .spec.artifacts[].namespace, and also making this field aware of .spec.pathPattern. Together, these two behaviors allow Flux users to generate namespaces from directories in source artifacts.

We are also aligning garbage collection behavior with kustomize-controller, which puts back objects into the inventory and keeps the finalizer when the AG is on deletion in case the API server does not confirm the deletion request for the object. Backoff retries from controller-runtime reattempt the finalization.

The API:

apiVersion: source.extensions.fluxcd.io/v1beta1
kind: ArtifactGenerator
metadata:
  name: my-ag
  namespace: my-ns
spec:
  commonMetadata: # Now gets applied to both EAs and Namespaces.
    ...
  namespaces:
    strategy: Managed # defaults to Unmanaged
    # prune: true     # true is the default
  sources:
    - alias: repo
      kind: OCIRepository
      name: monorepo
  pathPattern: ...
  artifacts:
    - name: ...
      namespace: ... # Resolves to "some-tenant".
status:
  inventory:
    - kind: Namespace
      name: some-tenant
      # Hash of the metadata applied by the AG.
      digest: sha256:589303e73217c92ae0d20d90d425cd143459e2ddc488aa38684d5e69e8c9b4b9

The namespaces generated by an ArtifactGenerator are the union of the namespaces rendered by all .spec.artifacts[]. The field .spec.commonMetadata is used for the metadata of the namespaces. If needed later, we can add .spec.namespaces.metadata to give users an override that is special for namespaces. Drift is detected against the inventory for garbage collection and against the metadata fields for correcting the remaining namespaces. Conflicts with other ArtifactGenerators and observability are similar to how we did it for ExternalArtifact.

@matheuscscp matheuscscp added enhancement New feature or request area/api API related issues and pull requests area/ux In pursuit of a delightful user experience area/generator Artifact generation related issues and pull requests labels Oct 4, 2026
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API related issues and pull requests area/generator Artifact generation related issues and pull requests area/ux In pursuit of a delightful user experience enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output artifact .namespace field does not support the .pathPattern placeholders

1 participant