Skip to content

Add DirectSourceFetch feature gate to bypass cache for source objects#314

Merged
matheuscscp merged 1 commit intofluxcd:mainfrom
dipti-pai:direct-source-fetch
Feb 15, 2026
Merged

Add DirectSourceFetch feature gate to bypass cache for source objects#314
matheuscscp merged 1 commit intofluxcd:mainfrom
dipti-pai:direct-source-fetch

Conversation

@dipti-pai
Copy link
Member

@dipti-pai dipti-pai commented Feb 13, 2026

This feature gate enables fetching source objects (GitRepository, OCIRepository, Bucket) directly from the API server using APIReader, bypassing the controller's cache. This can be useful when immediate consistency is required for source object reads.

When enabled via --feature-gates=DirectSourceFetch=true:

Source objects are fetched using r.APIReader instead of r.Client A log message is emitted at startup indicating the feature is active Changes:

Add DirectSourceFetch field to ArtifactGeneratorReconciler struct
Update getSource() to use APIReader when feature is enabled
Add internal/features package with feature gate definitions
Register feature gate with default value false (opt-in)
Add unit tests for sources
Update pkg/runtime dependency to v0.100.1

Part of : fluxcd/kustomize-controller#1583

@dipti-pai dipti-pai marked this pull request as ready for review February 14, 2026 00:00
Copy link
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! 🚀

Just a tiny fix in a comment

case sourcev1.ExternalArtifactKind:
var chart sourcev1.ExternalArtifact
err := r.Get(ctx, namespacedName, &chart)
var ea sourcev1.ExternalArtifact
Copy link
Member

Choose a reason for hiding this comment

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

Good catch!

This feature gate enables fetching source objects (GitRepository, OCIRepository, Bucket) directly from the API server using APIReader, bypassing the controller's cache. This can be useful when immediate consistency is required for source object reads.

When enabled via --feature-gates=DirectSourceFetch=true:

Source objects are fetched using r.APIReader instead of r.Client
A log message is emitted at startup indicating the feature is active
Changes:

Add DirectSourceFetch field to ArtifactGeneratorReconciler struct
Update getSource() to use APIReader when feature is enabled
Add internal/features package with feature gate definitions
Register feature gate with default value false (opt-in)
Add unit tests for sources
Update pkg/runtime dependency to v0.100.1

Signed-off-by: Dipti Pai <diptipai89@outlook.com>
@stefanprodan stefanprodan changed the title [SW] Add DirectSourceFetch feature gate to bypass cache for source objects Add DirectSourceFetch feature gate to bypass cache for source objects Feb 15, 2026
Copy link
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 @dipti-pai

@matheuscscp matheuscscp merged commit a17238d into fluxcd:main Feb 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants