Skip to content

Commit

Permalink
handle subscriptions whose tenants don't have a collector
Browse files Browse the repository at this point in the history
Signed-off-by: Kristof Gyuracz <kristof.gyuracz@gmail.com>
  • Loading branch information
kristofgyuracz committed Jan 31, 2024
1 parent b08189a commit ccf519c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions internal/controller/telemetry/collector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,17 @@ func (r *CollectorReconciler) SetupWithManager(mgr ctrl.Manager) error {
subscriptionsForTenant, subscriptionsToUpdate, err := r.getSubscriptionsForTenant(ctx, &tenant)
if err != nil {
logger.Error(errors.WithStack(err), "failed listing subscriptions for collector, notifying collector anyways")
requests = addCollectorRequest(requests, tenant.Status.Collector)
if tenant.Status.Collector != "" {
requests = addCollectorRequest(requests, tenant.Status.Collector)
}
continue TenantLoop
}

for _, s := range append(subscriptionsForTenant, subscriptionsToUpdate...) {
if s.Name == subscription.Name {
requests = addCollectorRequest(requests, tenant.Status.Collector)
if tenant.Status.Collector != "" {
requests = addCollectorRequest(requests, tenant.Status.Collector)
}
continue TenantLoop
}
}
Expand All @@ -365,7 +369,9 @@ func (r *CollectorReconciler) SetupWithManager(mgr ctrl.Manager) error {

for _, s := range subscriptionsToDisown {
if s.Name == subscription.Name {
requests = addCollectorRequest(requests, tenant.Status.Collector)
if tenant.Status.Collector != "" {
requests = addCollectorRequest(requests, tenant.Status.Collector)
}
continue TenantLoop
}
}
Expand Down

0 comments on commit ccf519c

Please sign in to comment.