diff --git a/pkg/kds/mux/zone_watch.go b/pkg/kds/mux/zone_watch.go index 4e22d5b922c5..36b65093798c 100644 --- a/pkg/kds/mux/zone_watch.go +++ b/pkg/kds/mux/zone_watch.go @@ -86,17 +86,14 @@ func (zw *ZoneWatch) Start(stop <-chan struct{}) error { log := kuma_log.AddFieldsFromCtx(zw.log, ctx, zw.extensions) if err := zw.rm.Get(ctx, zoneInsight, store.GetByKey(zone.zone, model.NoMesh)); err != nil { if store.IsResourceNotFound(err) { - zoneRes := system.NewZoneResource() - if err := zw.rm.Get(ctx, zoneRes, store.GetByKey(zone.zone, model.NoMesh)); err != nil && store.IsResourceNotFound(err) { - zw.bus.Send(service.ZoneWentOffline{ - Zone: zone.zone, - TenantID: zone.tenantID, - }) - delete(zw.zones, zone) - continue - } + zw.bus.Send(service.ZoneWentOffline{ + Zone: zone.zone, + TenantID: zone.tenantID, + }) + delete(zw.zones, zone) + } else { + log.Info("error getting ZoneInsight", "zone", zone.zone, "error", err) } - log.Info("error getting ZoneInsight", "zone", zone.zone, "error", err) continue } diff --git a/pkg/kds/mux/zone_watch_test.go b/pkg/kds/mux/zone_watch_test.go index 691d6c6d1280..e56f81727cb7 100644 --- a/pkg/kds/mux/zone_watch_test.go +++ b/pkg/kds/mux/zone_watch_test.go @@ -7,6 +7,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" system_proto "github.com/kumahq/kuma/api/system/v1alpha1" "github.com/kumahq/kuma/pkg/config/multizone" @@ -65,11 +66,18 @@ var _ = Describe("ZoneWatch", func() { Timeout: types.Duration{Duration: timeout}, } + rm = manager.NewResourceManager(memory.NewStore()) + zoneRes := system.NewZoneResource() + zoneRes.Spec.Enabled = wrapperspb.Bool(true) + Expect(rm.Create( + context.Background(), + zoneRes, + store.CreateByKey(zone, core_model.NoMesh), + )).To(Succeed()) zoneInsight := system.NewZoneInsightResource() zoneInsight.Spec.HealthCheck = &system_proto.HealthCheck{ Time: timestamppb.New(time.Now()), } - rm = manager.NewResourceManager(memory.NewStore()) Expect(rm.Create( context.Background(), zoneInsight,