Allow cross-shard dependency check

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan 2024-09-25 11:45:10 +03:00
parent aabb41fc5d
commit 2b44187c23
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF
3 changed files with 4 additions and 1 deletions

View File

@ -89,6 +89,7 @@ type KustomizationReconciler struct {
artifactFetchRetries int artifactFetchRetries int
requeueDependency time.Duration requeueDependency time.Duration
APIReader client.Reader
StatusPoller *polling.StatusPoller StatusPoller *polling.StatusPoller
PollingOpts polling.Options PollingOpts polling.Options
ControllerName string ControllerName string
@ -488,7 +489,7 @@ func (r *KustomizationReconciler) checkDependencies(ctx context.Context,
Name: d.Name, Name: d.Name,
} }
var k kustomizev1.Kustomization var k kustomizev1.Kustomization
err := r.Get(ctx, dName, &k) err := r.APIReader.Get(ctx, dName, &k)
if err != nil { if err != nil {
return fmt.Errorf("dependency '%s' not found: %w", dName, err) return fmt.Errorf("dependency '%s' not found: %w", dName, err)
} }

View File

@ -176,6 +176,7 @@ func TestMain(m *testing.M) {
reconciler = &KustomizationReconciler{ reconciler = &KustomizationReconciler{
ControllerName: controllerName, ControllerName: controllerName,
Client: testEnv, Client: testEnv,
APIReader: testEnv,
EventRecorder: testEnv.GetEventRecorderFor(controllerName), EventRecorder: testEnv.GetEventRecorderFor(controllerName),
Metrics: testMetricsH, Metrics: testMetricsH,
ConcurrentSSA: 4, ConcurrentSSA: 4,

View File

@ -238,6 +238,7 @@ func main() {
ControllerName: controllerName, ControllerName: controllerName,
DefaultServiceAccount: defaultServiceAccount, DefaultServiceAccount: defaultServiceAccount,
Client: mgr.GetClient(), Client: mgr.GetClient(),
APIReader: mgr.GetAPIReader(),
Metrics: metricsH, Metrics: metricsH,
EventRecorder: eventRecorder, EventRecorder: eventRecorder,
NoCrossNamespaceRefs: aclOptions.NoCrossNamespaceRefs, NoCrossNamespaceRefs: aclOptions.NoCrossNamespaceRefs,