Skip to content

Add .spec.commonMetadata to Artifact Generator#333

Merged
stefanprodan merged 1 commit into
fluxcd:mainfrom
vocarista:flux-op/421
May 24, 2026
Merged

Add .spec.commonMetadata to Artifact Generator#333
stefanprodan merged 1 commit into
fluxcd:mainfrom
vocarista:flux-op/421

Conversation

@vocarista
Copy link
Copy Markdown
Contributor

Description
This PR implements CommonMetadata support for the ArtifactGenerator API in source-watcher. This is a foundational step towards enabling decoupled artifact discovery (controlplaneio-fluxcd/flux-operator#421), as it allows the ResourceSetInputProvider to select generated ExternalArtifact objects via label selectors. The implementation strictly mirrors the CommonMetadata pattern established in flux-operator and kustomize-controller.

Changes Made

  1. API Update: Defined CommonMetadata in source-watcher/api/v1beta1 and added .spec.commonMetadata to ArtifactGeneratorSpec.
  2. Reconciliation Logic: Updated reconcileExternalArtifact to propagate the user-defined labels and annotations to the output ExternalArtifact objects.
  3. Safe Overrides: Controller-managed labels (app.kubernetes.io/managed-by and ArtifactGeneratorLabel) are applied after user-metadata to guarantee they cannot be overridden, ensuring secure tracking of the generated artifacts.
  4. Testing: Added TestArtifactGeneratorReconciler_CommonMetadata to integration tests verifying that ExternalArtifact inherits the metadata during creation and correctly strips metadata when it is removed from the spec.

@matheuscscp matheuscscp requested a review from stefanprodan May 23, 2026 19:15
Copy link
Copy Markdown
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@stefanprodan stefanprodan added area/api API related issues and pull requests area/generator Artifact generation related issues and pull requests labels May 24, 2026
Copy link
Copy Markdown
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add CommonMetadata to the API doc https://github.com/fluxcd/source-watcher/blob/main/docs/spec/v1beta1/artifactgenerators.md It can go last in the "Writing an ArtifactGenerator" section.

Signed-off-by: Kumar Piyush <kr.piyush888@gmail.com>
Assisted-by: Antigravity/Gemini
Copy link
Copy Markdown
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @vocarista 🏅

@stefanprodan stefanprodan merged commit 51a84ec into fluxcd:main May 24, 2026
5 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants