Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ that extends Flux with advanced source composition and decomposition patterns.
The source-watcher controller implements the [ArtifactGenerator](docs/README.md) API,
which allows Flux users to:

- 🔗 **Compose** multiple Flux sources (GitRepository, OCIRepository, Bucket, HelmChart) into a single deployable artifact
- 🔗 **Compose** multiple Flux sources (GitRepository, OCIRepository, Bucket, HelmChart, ExternalArtifact) into a single deployable artifact
- 📦 **Decompose** monorepos into multiple independent artifacts with separate deployment lifecycles
- 🎯 **Optimize** reconciliation by only triggering updates when specific paths change
- 🏗️ **Structure** complex deployments from distributed sources maintained by different teams
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/artifactgenerator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type SourceReference struct {
Namespace string `json:"namespace,omitempty"`

// Kind of the source.
// +kubebuilder:validation:Enum=Bucket;GitRepository;OCIRepository;HelmChart
// +kubebuilder:validation:Enum=Bucket;GitRepository;OCIRepository;HelmChart;ExternalArtifact
// +required
Kind string `json:"kind"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ spec:
- GitRepository
- OCIRepository
- HelmChart
- ExternalArtifact
type: string
name:
description: Name of the source.
Expand Down
2 changes: 1 addition & 1 deletion config/samples/source_v1beta1_artifactgenerator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: podinfo
spec:
# Sources is a list of references to Flux source-controller resources
# (GitRepository, OCIRepository, Bucket and HelmChart) that will be
# (GitRepository, OCIRepository, Bucket, HelmChart and ExternalArtifact) that will be
# used to generate ExternalArtifact resources.
sources:
- alias: chart
Expand Down
4 changes: 2 additions & 2 deletions docs/spec/v1beta1/artifactgenerators.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The ArtifactGenerator is an extension of Flux APIs that allows source composition and decomposition.
It enables the generation of [ExternalArtifacts][externalartifact] from multiple sources
([GitRepositories][gitrepository], [OCIRepositories][ocirepository], [Buckets][bucket] and [HelmChart][helmchart])
([GitRepositories][gitrepository], [OCIRepositories][ocirepository], [Buckets][bucket], [HelmCharts][helmchart] and [ExternalArtifacts][externalartifact])
or the splitting of a single source into multiple artifacts.

## Source Composition Example
Expand Down Expand Up @@ -203,7 +203,7 @@ for artifact generation. Each source must specify:
- `alias`: A unique identifier used to reference the source in copy operations.
Alias names must be unique within the same ArtifactGenerator and can only contain
alphanumeric characters, dashes and underscores.
- `kind`: The type of Flux source resource (`GitRepository`, `OCIRepository`, `Bucket` or `HelmChart`)
- `kind`: The type of Flux source resource (`GitRepository`, `OCIRepository`, `Bucket`, `HelmChart`, or `ExternalArtifact`)
- `name`: The name of the source resource
- `namespace` (optional): The namespace of the source resource if different from the ArtifactGenerator namespace

Expand Down
10 changes: 10 additions & 0 deletions internal/controller/artifactgenerator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ func (r *ArtifactGeneratorReconciler) observeSources(ctx context.Context,
return nil, fmt.Errorf("unable to get source '%s': %w", namespacedName, err)
}
source = &chart
case sourcev1.ExternalArtifactKind:
var chart sourcev1.ExternalArtifact
err := r.Get(ctx, namespacedName, &chart)
if err != nil {
if apierrors.IsNotFound(err) {
return nil, err
}
return nil, fmt.Errorf("unable to get source '%s': %w", namespacedName, err)
}
source = &chart
default:
return nil, fmt.Errorf("source `%s` kind '%s' not supported",
src.Name, src.Kind)
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/artifactgenerator_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ func (r *ArtifactGeneratorReconciler) SetupWithManager(ctx context.Context,
handler.EnqueueRequestsFromMapFunc(r.requestsForSourceChange),
builder.WithPredicates(sourceChangePredicate),
).
Watches(
&sourcev1.ExternalArtifact{},
handler.EnqueueRequestsFromMapFunc(r.requestsForSourceChange),
builder.WithPredicates(sourceChangePredicate),
).
WithOptions(controller.Options{
RateLimiter: opts.RateLimiter,
}).
Expand Down
Loading