diff --git a/controllers/slice/namespaces.go b/controllers/slice/namespaces.go index 742cb02b5..15217adc4 100644 --- a/controllers/slice/namespaces.go +++ b/controllers/slice/namespaces.go @@ -89,7 +89,7 @@ func (r *SliceReconciler) reconcileAppNamespaces(ctx context.Context, slice *kub log.Error(err, "Failed to list namespaces") return ctrl.Result{}, err, true } - log.Info("reconciling", "existingAppNsList", existingAppNsList) + debugLog.Info("reconciling", "existingAppNsList", existingAppNsList) // Convert the list into a map for faster lookups. Will come in handy when we compare // existing namespaces against configured namespaces. existingAppNsMap := make(map[string]*nsMarker) diff --git a/go.mod b/go.mod index 26de77582..6345e984b 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/kubeslice/apis v0.3.0 github.com/kubeslice/gateway-sidecar v0.2.0 - github.com/kubeslice/kubeslice-monitoring v0.1.10 + github.com/kubeslice/kubeslice-monitoring v0.2.1 github.com/kubeslice/netops v0.1.3 github.com/kubeslice/router-sidecar v1.4.0 github.com/kubeslice/slicegw-edge v1.0.0 diff --git a/go.sum b/go.sum index cd620fb12..bd822126d 100644 --- a/go.sum +++ b/go.sum @@ -385,8 +385,8 @@ github.com/kubeslice/apis v0.3.0 h1:sSaMLKWN9OfUdcTYAcIaUpRwlZqrmgKLPG5I8dYYH2k= github.com/kubeslice/apis v0.3.0/go.mod h1:YDSfpIsQM+FtQPaZVGNCTZnlp3viWuQhkjJjIHQdaYs= github.com/kubeslice/gateway-sidecar v0.2.0 h1:Ja3fIUivuSjUFQ4lPCt79ATq99BxslvAFYUwV9Urpy4= github.com/kubeslice/gateway-sidecar v0.2.0/go.mod h1:nM1+Wjud2vk44cUg+9iwBbWTpqI+2Ecbn9NuaHEs9aY= -github.com/kubeslice/kubeslice-monitoring v0.1.10 h1:ozzGuSxr5dsouI2ATtPOLygsKfQ8w6wUI9QHkSp33TQ= -github.com/kubeslice/kubeslice-monitoring v0.1.10/go.mod h1:Ux4e/ZvTKru8ewnOP0YudLey6ZItriCx6Tzjt9oVnHg= +github.com/kubeslice/kubeslice-monitoring v0.2.1 h1:wtmIEigpQoKzuckof7QRqdsaa4lV/rqxd/FcmOj5N5Q= +github.com/kubeslice/kubeslice-monitoring v0.2.1/go.mod h1:PASwPHqwCjfL838gC6cSiGNu9aML9RTvDqyTpbC1FWo= github.com/kubeslice/netops v0.1.3 h1:XT9RDxIwh/6381c/GwZi1vHCw8D0ZKQUPISok326/Aw= github.com/kubeslice/netops v0.1.3/go.mod h1:ZHUN74gCIkjtJO2BS2w0+JvTi+366JxxgCpU3OvLDk0= github.com/kubeslice/router-sidecar v1.4.0 h1:UX2HBoLfFhc2b5mdFx9pj3kQZJffav70zaiPUWcYu1s= diff --git a/pkg/hub/controllers/cluster/reconciler.go b/pkg/hub/controllers/cluster/reconciler.go index a9ae3a5ff..d4ab17977 100644 --- a/pkg/hub/controllers/cluster/reconciler.go +++ b/pkg/hub/controllers/cluster/reconciler.go @@ -97,7 +97,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reco return reconcile.Result{}, err } - log.Info("got cluster CR from hub", "cluster", cr) + log.Info("got cluster CR from hub", "cluster", cr.Name) requeue, result, err := r.handleClusterDeletion(cr, ctx, req) if requeue { return result, err diff --git a/pkg/hub/controllers/slice_controller.go b/pkg/hub/controllers/slice_controller.go index 1f71b4017..b7edf9296 100644 --- a/pkg/hub/controllers/slice_controller.go +++ b/pkg/hub/controllers/slice_controller.go @@ -245,7 +245,7 @@ func (r *SliceReconciler) Reconcile(ctx context.Context, req reconcile.Request) return reconcile.Result{}, err } else { utils.RecordEvent(ctx, r.EventRecorder, slice, nil, ossEvents.EventWorkerSliceHealthUpdated, sliceControllerName) - log.Info("succesfully updated the slice CR ", "slice CR ", slice) + log.Info("succesfully updated the slice CR ", "slice CR ", slice.Name) } } r.counterSliceUpdated.WithLabelValues(sliceName).Add(1) diff --git a/vendor/github.com/kubeslice/kubeslice-monitoring/pkg/events/events.go b/vendor/github.com/kubeslice/kubeslice-monitoring/pkg/events/events.go index 0a3d2fa51..119525098 100644 --- a/vendor/github.com/kubeslice/kubeslice-monitoring/pkg/events/events.go +++ b/vendor/github.com/kubeslice/kubeslice-monitoring/pkg/events/events.go @@ -166,7 +166,6 @@ func (er *eventRecorder) WithProject(project string) EventRecorder { } // RecordEvent raises a new event with the given fields -// TODO: events caching and aggregation func (er *eventRecorder) RecordEvent(ctx context.Context, e *Event) error { ref, err := reference.GetReference(er.Scheme, e.Object) if err != nil { @@ -174,6 +173,11 @@ func (er *eventRecorder) RecordEvent(ctx context.Context, e *Event) error { return err } + if ref.Namespace == "" { + er.Logger.Debugf("reference namespace is empty using name instead ", ref.Name) + ref.Namespace = ref.Name + } + ns := er.Options.Namespace if ns == "" { ns = ref.Namespace @@ -248,7 +252,8 @@ func (er *eventRecorder) RecordEvent(ctx context.Context, e *Event) error { } else { er.cache.Add(key, ev) } - er.Logger.Infof("event has been created %v", ev) + er.Logger.Infof("event has been created object: %s/%s kind: %s type: %s reason %s message %s", + ev.InvolvedObject.Namespace, ev.InvolvedObject.Name, ev.InvolvedObject.Kind, ev.Type, ev.Reason, ev.Message) } else { // event already present in cache e := lastSeenEvent.(*corev1.Event) @@ -260,7 +265,8 @@ func (er *eventRecorder) RecordEvent(ctx context.Context, e *Event) error { } // update the cache er.cache.Add(key, e) - er.Logger.Infof("event has been updated %v", ev) + er.Logger.Debugf("event has been created object: %s/%s kind: %s type: %s reason %s message %s", + ev.InvolvedObject.Namespace, ev.InvolvedObject.Name, ev.InvolvedObject.Kind, ev.Type, ev.Reason, ev.Message) } return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 8ca72310d..78ed35755 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -128,7 +128,7 @@ github.com/kubeslice/gateway-sidecar/pkg/metrics github.com/kubeslice/gateway-sidecar/pkg/nettools github.com/kubeslice/gateway-sidecar/pkg/sidecar/sidecarpb github.com/kubeslice/gateway-sidecar/pkg/status -# github.com/kubeslice/kubeslice-monitoring v0.1.10 +# github.com/kubeslice/kubeslice-monitoring v0.2.1 ## explicit; go 1.19 github.com/kubeslice/kubeslice-monitoring/pkg/events github.com/kubeslice/kubeslice-monitoring/pkg/logger