Skip to content

Commit

Permalink
Merge pull request #1248 from fluxcd/deps-api-reader
Browse files Browse the repository at this point in the history
Allow cross-shard dependency check
  • Loading branch information
stefanprodan committed Sep 26, 2024
2 parents 1899e6c + 2b44187 commit 0d28f0f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/controller/kustomization_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type KustomizationReconciler struct {
artifactFetchRetries int
requeueDependency time.Duration

APIReader client.Reader
StatusPoller *polling.StatusPoller
PollingOpts polling.Options
ControllerName string
Expand Down Expand Up @@ -488,7 +489,7 @@ func (r *KustomizationReconciler) checkDependencies(ctx context.Context,
Name: d.Name,
}
var k kustomizev1.Kustomization
err := r.Get(ctx, dName, &k)
err := r.APIReader.Get(ctx, dName, &k)
if err != nil {
return fmt.Errorf("dependency '%s' not found: %w", dName, err)
}
Expand Down
1 change: 1 addition & 0 deletions internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func TestMain(m *testing.M) {
reconciler = &KustomizationReconciler{
ControllerName: controllerName,
Client: testEnv,
APIReader: testEnv,
EventRecorder: testEnv.GetEventRecorderFor(controllerName),
Metrics: testMetricsH,
ConcurrentSSA: 4,
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ func main() {
ControllerName: controllerName,
DefaultServiceAccount: defaultServiceAccount,
Client: mgr.GetClient(),
APIReader: mgr.GetAPIReader(),
Metrics: metricsH,
EventRecorder: eventRecorder,
NoCrossNamespaceRefs: aclOptions.NoCrossNamespaceRefs,
Expand Down

0 comments on commit 0d28f0f

Please sign in to comment.