Skip to content

Commit ccf519c

Browse files
handle subscriptions whose tenants don't have a collector
Signed-off-by: Kristof Gyuracz <[email protected]>
1 parent b08189a commit ccf519c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

internal/controller/telemetry/collector_controller.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,17 @@ func (r *CollectorReconciler) SetupWithManager(mgr ctrl.Manager) error {
350350
subscriptionsForTenant, subscriptionsToUpdate, err := r.getSubscriptionsForTenant(ctx, &tenant)
351351
if err != nil {
352352
logger.Error(errors.WithStack(err), "failed listing subscriptions for collector, notifying collector anyways")
353-
requests = addCollectorRequest(requests, tenant.Status.Collector)
353+
if tenant.Status.Collector != "" {
354+
requests = addCollectorRequest(requests, tenant.Status.Collector)
355+
}
354356
continue TenantLoop
355357
}
356358

357359
for _, s := range append(subscriptionsForTenant, subscriptionsToUpdate...) {
358360
if s.Name == subscription.Name {
359-
requests = addCollectorRequest(requests, tenant.Status.Collector)
361+
if tenant.Status.Collector != "" {
362+
requests = addCollectorRequest(requests, tenant.Status.Collector)
363+
}
360364
continue TenantLoop
361365
}
362366
}
@@ -365,7 +369,9 @@ func (r *CollectorReconciler) SetupWithManager(mgr ctrl.Manager) error {
365369

366370
for _, s := range subscriptionsToDisown {
367371
if s.Name == subscription.Name {
368-
requests = addCollectorRequest(requests, tenant.Status.Collector)
372+
if tenant.Status.Collector != "" {
373+
requests = addCollectorRequest(requests, tenant.Status.Collector)
374+
}
369375
continue TenantLoop
370376
}
371377
}

0 commit comments

Comments
 (0)